id: f514ebcd82184e3c975c71591d94a1ea
parent_id: 
item_type: 1
item_id: b0b783e8ab584f988e7866e3a96b6eac
item_updated_time: 1764345565447
title_diff: "[{\"diffs\":[[1,\"OpenWRT X86 增加空间 [2]\"]],\"start1\":0,\"start2\":0,\"length1\":0,\"length2\":20}]"
body_diff: "[{\"diffs\":[[1,\"<html>\\\r\\\n<head>\\\r\\\n  <title>OpenWRT X86 增加空间</title>\\\r\\\n  <basefont face=\\\"微软雅黑\\\" size=\\\"2\\\" />\\\r\\\n  <meta http-equiv=\\\"Content-Type\\\" content=\\\"text/html;charset=utf-8\\\" />\\\r\\\n  <meta name=\\\"exporter-version\\\" content=\\\"YXBJ Windows/608924 (zh-CN, DDL); Windows/10.0.0 (Win64); EDAMVersion=V2;\\\"/>\\\r\\\n  <meta name=\\\"application-data:2525275\\\" content=\\\"70800145/s394/0d029d57-8a2c-47a2-8778-e1987adfb411/www.evernote.com\\\"/>\\\r\\\n  <style>\\\r\\\n\\tbody, td {\\\r\\\n\\t  font-family: 微软雅黑;\\\r\\\n\\t  font-size: 12pt;\\\r\\\n\\t}\\\r\\\n  </style>\\\r\\\n</head>\\\r\\\n<body>\\\r\\\n<a name=\\\"9977\\\"></a>\\\r\\\n<h1>OpenWRT X86 增加空间</h1>\\\r\\\n\\\r\\\n<div><span><br/><div style=\\\"font-size: 16px\\\"><div style=\\\"font-size:100%;\\\"><div style=\\\"font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:14px;line-height:20px;color:rgb(51, 51, 51);background-color:rgb(198, 215, 222);\\\"><div style=\\\"border-radius:9px;background-color:rgb(255, 255, 255);\\\"><div style=\\\"box-sizing:border-box;vertical-align:top;\\\"><div><div><div style=\\\"text-align:left;\\\">\\\n    \\\n        <h2 style=\\\"font-family:inherit;font-weight:700;line-height:normal;color:rgb(51, 51, 51);text-rendering:optimizeLegibility;padding:0px;margin:12px 0px;font-size:22px;\\\">Step 2: Adding space.</h2>\\\n    \\\n\\\n    \\\n      \\\n\\\n\\\n<div style=\\\"position:relative;text-align:center;border:1px solid rgba(0, 0, 0, 0.207843);min-height:109px;margin-bottom:35px;padding:22px;background-color:rgb(246, 246, 246);\\\">\\\n    \\\n        \\\n            <div style=\\\"position:relative;display:inline-block;zoom:1;\\\">\\\n                <a href=\\\"http://www.instructables.com/file/FGE3QRLGV9SPNS3/\\\" style=\\\"color:rgb(232, 108, 0);text-decoration:none;\\\">\\\n                    <img src=\\\":/95f213ecac9f4bd1aa02ef77a4ea2336\\\" type=\\\"image/jpeg\\\" data-filename=\\\"FGE3QRLGV9SPNS3.MEDIUM.jpg\\\" alt=\\\"Picture of Adding space.\\\" height=\\\"620\\\" style=\\\"vertical-align:middle;border:0px;max-width:none;height:auto;width:100%;\\\" width=\\\"524\\\"/>\\\n                </a>\\\n            </div>\\\n        \\\n    \\\n    \\\n      \\\n    \\\n        \\\n</div>\\\n    \\\n\\\n    <div style=\\\"margin:20px;word-wrap:break-word;font-size:17px;line-height:1.3em;\\\">\\\n      This section requires knowledge of bash. Please get a professional to help if you are unsure.<br/>\\\n<br/>\\\n<blockquote style=\\\"padding:0px 0px 0px 15px;margin:0px 0px 20px;border-left-width:5px;border-left-style:solid;border-left-color:rgb(238, 238, 238);\\\"><span style=\\\"\\\"></span>\\\n\\t<p style=\\\"margin:0px 0px 10px;margin-bottom:0px;font-size:17.5px;font-weight:300;line-height:1.25;\\\">\\\n\\t\\tThe root partition of the official x86 OpenWrt image is not very big, about 50 MiB.  Many find it too small after installing a few add-on packages.  Here I will cover the steps to expand it.  The resultant image can be used in a live USB (see <a href=\\\"http://macbruins.wordpress.com/2011/09/01/easy-live-usb-for-x86-openwrt/\\\" style=\\\"color:rgb(232, 108, 0);text-decoration:none;\\\" title=\\\"Easy Live USB for x86 OpenWRT\\\">Easy Live USB for x86 OpenWRT</a>) or copied to a hard disk.</p>\\\n<span style=\\\"\\\"></span></blockquote>\\\n<blockquote style=\\\"padding:0px 0px 0px 15px;margin:0px 0px 20px;border-left-width:5px;border-left-style:solid;border-left-color:rgb(238, 238, 238);\\\"><span style=\\\"\\\"></span>\\\n\\t<h3 style=\\\"margin:0px;font-family:inherit;font-weight:700;line-height:normal;color:rgb(51, 51, 51);text-rendering:optimizeLegibility;font-size:16px;padding:0px;\\\">\\\n\\t\\t<span style=\\\"x-evernote:highlighted;background-color:#F6EE96;\\\">Procedure Outline</span></h3><span style=\\\"x-evernote:highlighted;background-color:#F6EE96;\\\">\\\n</span><span style=\\\"\\\"></span></blockquote><span style=\\\"x-evernote:highlighted;background-color:#F6EE96;\\\">\\\n</span><blockquote style=\\\"padding:0px 0px 0px 15px;margin:0px 0px 20px;border-left-width:5px;border-left-style:solid;border-left-color:rgb(238, 238, 238);\\\"><span style=\\\"\\\"></span><span style=\\\"x-evernote:highlighted;background-color:#F6EE96;\\\">\\\n\\t</span><ol style=\\\"padding:0px;margin:0px 0px 9px 25px;list-style:decimal;\\\"><span style=\\\"x-evernote:highlighted;background-color:#F6EE96;\\\">\\\n\\t\\t</span><li style=\\\"line-height:20px;\\\"><span style=\\\"x-evernote:highlighted;background-color:#F6EE96;\\\">\\\n\\t\\t\\tGet an uncompressed disk image.</span></li><span style=\\\"x-evernote:highlighted;background-color:#F6EE96;\\\">\\\n\\t\\t</span><li style=\\\"line-height:20px;\\\"><span style=\\\"x-evernote:highlighted;background-color:#F6EE96;\\\">\\\n\\t\\t\\tPad image to desired size</span></li><span style=\\\"x-evernote:highlighted;background-color:#F6EE96;\\\">\\\n\\t\\t</span><li style=\\\"line-height:20px;\\\"><span style=\\\"x-evernote:highlighted;background-color:#F6EE96;\\\">\\\n\\t\\t\\tAttach the image file to a loop device</span></li><span style=\\\"x-evernote:highlighted;background-color:#F6EE96;\\\">\\\n\\t\\t</span><li style=\\\"line-height:20px;\\\"><span style=\\\"x-evernote:highlighted;background-color:#F6EE96;\\\">\\\n\\t\\t\\tEdit image partition table to enlarge the root partition</span></li><span style=\\\"x-evernote:highlighted;background-color:#F6EE96;\\\">\\\n\\t\\t</span><li style=\\\"line-height:20px;\\\"><span style=\\\"x-evernote:highlighted;background-color:#F6EE96;\\\">\\\n\\t\\t\\tResize the file system in root partition</span></li><span style=\\\"x-evernote:highlighted;background-color:#F6EE96;\\\">\\\n\\t\\t</span><li style=\\\"line-height:20px;\\\"><span style=\\\"x-evernote:highlighted;background-color:#F6EE96;\\\">\\\n\\t\\t\\tDetach the image from the loop device.</span></li>\\\n\\t</ol>\\\n<span style=\\\"\\\"></span></blockquote>\\\n<p style=\\\"margin:0px 0px 10px;\\\">\\\n\\tAll commands below are run in Bash.</p>\\\n<h3 style=\\\"margin:0px;font-family:inherit;font-weight:700;line-height:normal;color:rgb(51, 51, 51);text-rendering:optimizeLegibility;font-size:16px;padding:0px;\\\">\\\n\\tUncompress Image File</h3>\\\n<p style=\\\"margin:0px 0px 10px;\\\">\\\n\\tUse whichever method you like to download an image file from OpenWrt (<a href=\\\"http://downloads.openwrt.org/\\\" style=\\\"color:rgb(232, 108, 0);text-decoration:none;\\\">http://downloads.openwrt.org</a>) and uncompress it using gzip.  For example, these two commands download and uncompress the 10.03.1-rc6 disk image.</p>\\\n<pre style=\\\"line-height:20px;padding:9.5px;font-size:13px;color:rgb(51, 51, 51);border-radius:4px;display:block;margin:0px 0px 10px;font-family:Monaco, Menlo, Consolas, 'Courier New', monospace;word-break:break-all;word-wrap:break-word;white-space:pre-wrap;border:none;background-color:transparent;margin-left:0px;\\\">bash$ wget --quiet http://downloads.openwrt.org/backfire/10.03.1-rc6/x86_generic/openwrt-x86-generic-combined-ext2.img.gz\\\nbash$ gunzip openwrt-x86-generic-combined-ext2.img.gz\\\n\\\n</pre>\\\n<p style=\\\"margin:0px 0px 10px;\\\">\\\n\\tAlternative, you can just copy an image file from a live USB flash drive.  This will save you the trouble of restoring custom configurations.</p>\\\n<h3 style=\\\"margin:0px;font-family:inherit;font-weight:700;line-height:normal;color:rgb(51, 51, 51);text-rendering:optimizeLegibility;font-size:16px;padding:0px;\\\">\\\n\\tPad Disk Image</h3>\\\n<p style=\\\"margin:0px 0px 10px;\\\">\\\n\\tThe next step is to use “dd” to increase the size of the disk image.</p>\\\n<pre style=\\\"line-height:20px;padding:9.5px;font-size:13px;color:rgb(51, 51, 51);border-radius:4px;display:block;margin:0px 0px 10px;font-family:Monaco, Menlo, Consolas, 'Courier New', monospace;word-break:break-all;word-wrap:break-word;white-space:pre-wrap;border:none;background-color:transparent;margin-left:0px;\\\">bash$ dd if=/dev/zero bs=1M count=50 &gt;&gt; openwrt-x86-generic-combined-ext2.img\\\n\\\n</pre>\\\n<p style=\\\"margin:0px 0px 10px;\\\">\\\n\\tThis command appends 50 MiB of zeros to the end of the disk image:  “if=/dev/zero” tells dd to copy data from /dev/zero; “bs=1M” sets the block size to 1 MiB (1024*1024 bytes); “count=50” tells dd to copy 50 blocks.</p>\\\n<h3 style=\\\"margin:0px;font-family:inherit;font-weight:700;line-height:normal;color:rgb(51, 51, 51);text-rendering:optimizeLegibility;font-size:16px;padding:0px;\\\">\\\n\\tAttach to Loop Device</h3>\\\n<p style=\\\"margin:0px 0px 10px;\\\">\\\n\\t<strong style=\\\"font-weight:700;\\\">Note:  All commands from this point to the end need to be run by a user with root privilege.</strong></p>\\\n<p style=\\\"margin:0px 0px 10px;\\\">\\\n\\tThese commands find an unused loop device and attach it to the image file.</p>\\\n<pre style=\\\"line-height:20px;padding:9.5px;font-size:13px;color:rgb(51, 51, 51);border-radius:4px;display:block;margin:0px 0px 10px;font-family:Monaco, Menlo, Consolas, 'Courier New', monospace;word-break:break-all;word-wrap:break-word;white-space:pre-wrap;border:none;background-color:transparent;margin-left:0px;\\\">bash$ loop_dev=`losetup -f`\\\nbash$ echo $loop_dev\\\n/dev/loop3\\\nbash$ losetup $loop_dev openwrt-x86-generic-combined-ext2.img\\\n</pre>\\\n<p style=\\\"margin:0px 0px 10px;\\\">\\\n\\tThe first command uses “losetup -f” to find an unused device and stores the result in the shell variable loop_dev.  The “echo” command shows the device found.  Finally “losetup” attaches the device to the disk image.</p>\\\n<h3 style=\\\"margin:0px;font-family:inherit;font-weight:700;line-height:normal;color:rgb(51, 51, 51);text-rendering:optimizeLegibility;font-size:16px;padding:0px;\\\">\\\n\\tEdit Partition Table</h3>\\\n<p style=\\\"margin:0px 0px 10px;\\\">\\\n\\tTo expand a disk partition, it needs to be deleted first.  A new, larger partition is then created to take its place.  This new partition must start from the same sector as the old to prevent loss of data.</p>\\\n<p style=\\\"margin:0px 0px 10px;\\\">\\\n\\tfdisk is used to manipulate the disk partition table.</p>\\\n<pre style=\\\"line-height:20px;padding:9.5px;font-size:13px;color:rgb(51, 51, 51);border-radius:4px;display:block;margin:0px 0px 10px;font-family:Monaco, Menlo, Consolas, 'Courier New', monospace;word-break:break-all;word-wrap:break-word;white-space:pre-wrap;border:none;background-color:transparent;margin-left:0px;\\\">bash$ fdisk -u=sectors -c=dos $loop_dev\\\n</pre>\\\n<p style=\\\"margin:0px 0px 10px;\\\">\\\n\\tThe -u option asks fdisk to list partitions in sectors.  The -c option tells fdisk to operate in DOS compatibility mode.  $loop_dev is the loop device attached to the image file.</p>\\\n<p style=\\\"margin:0px 0px 10px;\\\">\\\n\\tTo see the existing partitions, type “p” at the fdisk prompt.</p>\\\n<pre style=\\\"line-height:20px;padding:9.5px;font-size:13px;color:rgb(51, 51, 51);border-radius:4px;display:block;margin:0px 0px 10px;font-family:Monaco, Menlo, Consolas, 'Courier New', monospace;word-break:break-all;word-wrap:break-word;white-space:pre-wrap;border:none;background-color:transparent;margin-left:0px;\\\">Command (m for help): p\\\n\\\nDisk /dev/loop3: 107 MB, 107437568 bytes\\\n16 heads, 63 sectors/track, 208 cylinders, total 209839 sectors\\\nUnits = sectors of 1 * 512 = 512 bytes\\\nSector size (logical/physical): 512 bytes / 512 bytes\\\nI/O size (minimum/optimal): 512 bytes / 512 bytes\\\nDisk identifier: 0x00000000\\\n\\\n      Device Boot      Start         End      Blocks   Id  System\\\n/dev/loop3p1   *          63        9071        4504+  83  Linux\\\n/dev/loop3p2            9135      107855       49360+  83  Linux\\\n</pre>\\\n<p style=\\\"margin:0px 0px 10px;\\\">\\\n\\tfdisk shows /dev/loop3 has 209839 sectors.  It also lists two partitions.  The first one, /dev/loop3p1, is a small boot partition.  The second, /dev/loop3p2, is the root partition.  The root partition starts from sector 9135.  Make a note of this number.</p>\\\n<p style=\\\"margin:0px 0px 10px;\\\">\\\n\\tNow delete the root partition and create a new one that covers all available space.</p>\\\n<pre style=\\\"line-height:20px;padding:9.5px;font-size:13px;color:rgb(51, 51, 51);border-radius:4px;display:block;margin:0px 0px 10px;font-family:Monaco, Menlo, Consolas, 'Courier New', monospace;word-break:break-all;word-wrap:break-word;white-space:pre-wrap;border:none;background-color:transparent;margin-left:0px;\\\">Command (m for help): d\\\nPartition number (1-4): 2\\\n\\\nCommand (m for help): n\\\nCommand action\\\n   e   extended\\\n   p   primary partition (1-4)\\\np\\\nPartition number (1-4, default 2): 2\\\nFirst sector (9072-209838, default 9072): 9135\\\nLast sector, +sectors or +size{K,M,G} (9135-209838, default 209838): 209838\\\n\\\nCommand (m for help): w\\\nThe partition table has been altered!\\\n\\\nThe “d” command asks fdisk to delete a partition, and “2” selects the\\\n second partition for deletion.  The “n” command asks fdisk to create a \\\nnew partition.  “p” specifies a primary partition, and “2” selects the \\\nsecond primary partition.  The first sector of this partition is sector \\\n9135, same as the deleted partition.  Its last sector is sector 209838, \\\nthe default choice.  This is also the last sector on /dev/loop3.  \\\nFinally, the “w” command writes the new partition table through \\\n/dev/loop3 to the disk image.</pre>\\\n<h3 style=\\\"margin:0px;font-family:inherit;font-weight:700;line-height:normal;color:rgb(51, 51, 51);text-rendering:optimizeLegibility;font-size:16px;padding:0px;\\\">\\\n\\tResize Root File System</h3>\\\n<p style=\\\"margin:0px 0px 10px;\\\">\\\n\\tThe following commands will expand the root file system to the size of the root partition.</p>\\\n<pre style=\\\"line-height:20px;padding:9.5px;font-size:13px;color:rgb(51, 51, 51);border-radius:4px;display:block;margin:0px 0px 10px;font-family:Monaco, Menlo, Consolas, 'Courier New', monospace;word-break:break-all;word-wrap:break-word;white-space:pre-wrap;border:none;background-color:transparent;margin-left:0px;\\\">bash$ kpartx -a $loop_dev\\\n/dev/mapper/loop3p1: mknod for loop3p1 failed: File exists\\\n</pre>\\\n<p style=\\\"margin:0px 0px 10px;\\\">\\\n\\tThe “kpartx -a” command creates device nodes for the partitions in the disk image.  The output of “kpartx –a” (“mknod for loop3p1 failed”) seems to be a bug in my system.  As far as I can tell, the creation and deletion of loop3p1 occur normally.</p>\\\n<p style=\\\"margin:0px 0px 10px;\\\">\\\n\\tAnother thing worth noting:  kpartx and fdisk use different naming conventions.  kpartx uses “/dev/mapper/device_name”, for example ”/dev/mapper/loop3p1″.  fdisk uses “/dev/device_name”, such as “/dev/loop3p1″.  This is because kpartx works with the device mapper.</p>\\\n<p style=\\\"margin:0px 0px 10px;\\\">\\\n\\tNow run “fsck” to check the file system before resizing it.  In fact, some file systems can’t be resized until they are checked.</p>\\\n<pre style=\\\"line-height:20px;padding:9.5px;font-size:13px;color:rgb(51, 51, 51);border-radius:4px;display:block;margin:0px 0px 10px;font-family:Monaco, Menlo, Consolas, 'Courier New', monospace;word-break:break-all;word-wrap:break-word;white-space:pre-wrap;border:none;background-color:transparent;margin-left:0px;\\\">bash$ fsck -f /dev/mapper/loop3p2\\\nfsck from util-linux 2.19.1\\\ne2fsck 1.41.14 (22-Dec-2010)\\\nFilesystem did not have a UUID; generating one.\\\n\\\nPass 1: Checking inodes, blocks, and sizes\\\nPass 2: Checking directory structure\\\nPass 3: Checking directory connectivity\\\nPass 4: Checking reference counts\\\nPass 5: Checking group summary information\\\n\\\n/dev/mapper/loop3p2: ***** FILE SYSTEM WAS MODIFIED *****\\\n/dev/mapper/loop3p2: 957/6000 files (0.2% non-contiguous), 8173/49152 blocks\\\n</pre>\\\n<p style=\\\"margin:0px 0px 10px;\\\">\\\n\\tThe “-f” option forces a run even when the file system seems clean.<br/>\\\n\\tFinally, resize the root file system.</p>\\\n<pre style=\\\"line-height:20px;padding:9.5px;font-size:13px;color:rgb(51, 51, 51);border-radius:4px;display:block;margin:0px 0px 10px;font-family:Monaco, Menlo, Consolas, 'Courier New', monospace;word-break:break-all;word-wrap:break-word;white-space:pre-wrap;border:none;background-color:transparent;margin-left:0px;\\\">bash$ resize2fs /dev/mapper/loop3p2\\\nresize2fs 1.41.14 (22-Dec-2010)\\\nResizing the filesystem on /dev/mapper/loop3p2 to 100352 (1k) blocks.\\\nThe filesystem on /dev/mapper/loop3p2 is now 100352 blocks long.\\\n\\\nbash$ kpartx -d $loop_dev\\\n</pre>\\\n<p style=\\\"margin:0px 0px 10px;\\\">\\\n\\tAfter resizing, “kpartx -d” reverses the changes made by “kpartx -a”.</p>\\\n<h3 style=\\\"margin:0px;font-family:inherit;font-weight:700;line-height:normal;color:rgb(51, 51, 51);text-rendering:optimizeLegibility;font-size:16px;padding:0px;\\\">\\\n\\tDetach From Loop Device</h3>\\\n<p style=\\\"margin:0px 0px 10px;\\\">\\\n\\tThe final step is to detach the image file from the loop device.</p>\\\n<pre style=\\\"line-height:20px;padding:9.5px;font-size:13px;color:rgb(51, 51, 51);border-radius:4px;display:block;margin:0px 0px 10px;font-family:Monaco, Menlo, Consolas, 'Courier New', monospace;word-break:break-all;word-wrap:break-word;white-space:pre-wrap;border:none;background-color:transparent;margin-left:0px;\\\">bash$ losetup –d $loop_dev\\\n\\\nThat’s it.  The disk image is now ready to be used in a live USB or copied to a hard disk.</pre>\\\n<blockquote style=\\\"padding:0px 0px 0px 15px;margin:0px 0px 20px;border-left-width:5px;border-left-style:solid;border-left-color:rgb(238, 238, 238);\\\"><span style=\\\"\\\"></span>\\\n\\t<pre style=\\\"line-height:20px;padding:9.5px;font-size:13px;color:rgb(51, 51, 51);border-radius:4px;display:block;margin:0px 0px 10px;font-family:Monaco, Menlo, Consolas, 'Courier New', monospace;word-break:break-all;word-wrap:break-word;white-space:pre-wrap;border:none;background-color:transparent;margin-left:0px;\\\"></pre>\\\n<span style=\\\"\\\"></span></blockquote>\\\n\\\n    </div>    \\\n\\\n    \\\n    \\\n       \\\n  </div></div></div></div></div></div></div></div><br/></span>\\\n</div></body></html>\\u0000\"]],\"start1\":0,\"start2\":0,\"length1\":0,\"length2\":16759}]"
metadata_diff: {"new":{"id":"b0b783e8ab584f988e7866e3a96b6eac","parent_id":"f67288c3a0be4374b5d532b5dcc3aabc","latitude":"0.00000000","longitude":"0.00000000","altitude":"0.0000","author":"","source_url":"","is_todo":0,"todo_due":0,"todo_completed":0,"source":"joplin-desktop","source_application":"net.cozic.joplin-desktop","application_data":"","order":1764348822942,"markup_language":2,"is_shared":0,"share_id":"","conflict_original_id":"","master_key_id":"","user_data":"","deleted_time":0},"deleted":[]}
encryption_cipher_text: 
encryption_applied: 0
updated_time: 2025-11-28T21:03:57.200Z
created_time: 2025-11-28T21:03:57.200Z
type_: 13