{"id":890,"date":"2025-02-20T21:30:05","date_gmt":"2025-02-20T13:30:05","guid":{"rendered":"https:\/\/flighhai.cn\/?p=890"},"modified":"2025-02-21T18:17:46","modified_gmt":"2025-02-21T10:17:46","slug":"openwrt-%e4%bd%bf%e7%94%a8overlay","status":"publish","type":"post","link":"https:\/\/flighhai.cn\/?p=890","title":{"rendered":"Openwrt \u4f7f\u7528Overlay"},"content":{"rendered":"<p><strong>1. \u767b\u5f55<\/strong><br \/>\nssh root@192.168.5.18<\/p>\n<p><strong>2. \u8fd4\u56de\u5230\u6839\u76ee\u5f55<\/strong><br \/>\ncd ..<\/p>\n<p><strong>3. \u67e5\u770b\u786c\u76d8\u6dfb\u52a0\u524d\u7684\u60c5\u51b5<\/strong><br \/>\ndf -h<br \/>\n\u8f93\u51fa<br \/>\nFilesystem\u00a0 \u00a0Size\u00a0 \u00a0 \u00a0 Used\u00a0 \u00a0Available\u00a0 \u00a0Use%\u00a0 \u00a0 Mounted on<br \/>\n\/dev\/root\u00a0 \u00a098.3M\u00a0 \u00a0 66.6M\u00a0 \u00a0 \u00a0 29.7M\u00a0 \u00a0 \u00a069%\u00a0 \u00a0 \u00a0\/<br \/>\ntmpfs\u00a0 \u00a0 \u00a0 \u00a0 352.5M\u00a0 \u00a0272.0K\u00a0 \u00a0 352.2M\u00a0 \u00a0 \u00a0 0%\u00a0 \u00a0 \u00a0\/tmp<br \/>\n\/dev\/sda1 16.0M\u00a0 \u00a0 \u00a0 6.2M\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 9.7M\u00a0 \u00a0 39%\u00a0 \u00a0 \/boot<br \/>\n\/dev\/sda1 16.0M\u00a0 \u00a0 \u00a0 6.2M\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 9.7M\u00a0 \u00a0 39%\u00a0 \u00a0 \/boot<br \/>\ntmpfs\u00a0 \u00a0 \u00a0 \u00a0 512.0K\u00a0 \u00a0 \u00a0 \u00a0 0\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 512.0K\u00a0 \u00a0 \u00a0 0%\u00a0 \u00a0 \u00a0\/dev<\/p>\n<p>fdisk -l<br \/>\n\u8f93\u51fa<br \/>\nDisk \/dev\/sda: 120.28 MiB, 126123520 bytes, 246335 sectors<br \/>\nDisk model: VMware Virtual S<br \/>\nUnits: sectors of 1 * 512 = 512 bytes<br \/>\nSector size (logical\/physical): 512 bytes \/ 512 bytes<br \/>\nI\/O size (minimum\/optimal): 512 bytes \/ 512 bytes<br \/>\nDisklabel type: gpt<br \/>\nDisk identifier: 11458228-0839-40E2-FE5C-7D7FC0445100<\/p>\n<p>Device Start End Sectors Size Type<br \/>\n\/dev\/sda1 512 33279 32768 16M Linux filesystem<br \/>\n\/dev\/sda2 33280 246271 212992 104M Linux filesystem<br \/>\n\/dev\/sda128 34 511 478 239K BIOS boot<\/p>\n<p><strong>4. \u865a\u62df\u673a\u8bbe\u7f6e\u91cc\u9762\u6dfb\u52a0\u4e00\u4e2a8GB\u7684\u786c\u76d8<\/strong><br \/>\n\u662f\u6dfb\u52a0\u53e6\u4e00\u4e2a\u786c\u76d8\uff0c\u4e0d\u662f\u6269\u5bb9\u539f\u6765\u7684<br \/>\nfdisk -l<br \/>\n\u8f93\u51fa<br \/>\nDisk \/dev\/sda: 120.28 MiB, 126123520 bytes, 246335 sectors<br \/>\nDisk model: VMware Virtual S<br \/>\nUnits: sectors of 1 * 512 = 512 bytes<br \/>\nSector size (logical\/physical): 512 bytes \/ 512 bytes<br \/>\nI\/O size (minimum\/optimal): 512 bytes \/ 512 bytes<br \/>\nDisklabel type: gpt<br \/>\nDisk identifier: 11458228-0839-40E2-FE5C-7D7FC0445100<\/p>\n<p>Device Start End Sectors Size Type<br \/>\n\/dev\/sda1 512 33279 32768 16M Linux filesystem<br \/>\n\/dev\/sda2 33280 246271 212992 104M Linux filesystem<br \/>\n\/dev\/sda128 34 511 478 239K BIOS boot<\/p>\n<p>Partition table entries are not in disk order.<\/p>\n<p>Disk \/dev\/sdb: 8 GiB, 8589934592 bytes, 16777216 sectors<br \/>\nDisk model: VMware Virtual S<br \/>\nUnits: sectors of 1 * 512 = 512 bytes<br \/>\nSector size (logical\/physical): 512 bytes \/ 512 bytes<br \/>\nI\/O size (minimum\/optimal): 512 bytes \/ 512 bytes<\/p>\n<p>&nbsp;<\/p>\n<p>ls \/dev\/sd*<\/p>\n<p>\u8f93\u51fa<\/p>\n<p>\/dev\/sda \/dev\/sda1 \/dev\/sda128 \/dev\/sda2 \/dev\/sdb<\/p>\n<p><strong>5. \u5728\u8fd9\u4e2a\u8bbe\u5907\u5206\u533a<\/strong><br \/>\nfdisk \/dev\/sdb<br \/>\n\u8f93\u51fa<br \/>\nWelcome to fdisk (util-linux 2.40.2).<br \/>\nChanges will remain in memory only, until you decide to write them.<br \/>\nBe careful before using the write command.<\/p>\n<p>Device does not contain a recognized partition table.<br \/>\nCreated a new DOS (MBR) disklabel with disk identifier 0xc2f9fad7.<\/p>\n<p>Command (m for help): n<br \/>\nPartition type<br \/>\np primary (0 primary, 0 extended, 4 free)<br \/>\ne extended (container for logical partitions)<br \/>\nSelect (default p):<\/p>\n<p>Using default response p.<br \/>\nPartition number (1-4, default 1): 1<br \/>\nFirst sector (2048-16777215, default 2048):<br \/>\nLast sector, +\/-sectors or +\/-size{K,M,G,T,P} (2048-16777215, default 16777215):<\/p>\n<p>Created a new partition 1 of type &#8216;Linux&#8217; and of size 8 GiB.<\/p>\n<p>Command (m for help): w<br \/>\nThe partition table has been altered.<br \/>\nCalling ioctl() to re-read partition table.<br \/>\nSyncing disks.<\/p>\n<p><strong>6. \u683c\u5f0f\u5316\/dev\/sdb1\u4e3aext4\u683c\u5f0f<\/strong><br \/>\nmkfs.ext4 \/dev\/sdb1<br \/>\n\u8f93\u51fa<br \/>\nmke2fs 1.47.0 (5-Feb-2023)<br \/>\nCreating filesystem with 2096896 4k blocks and 524288 inodes<br \/>\nFilesystem UUID: d57470c8-8542-48be-9e50-24565944bb38<br \/>\nSuperblock backups stored on blocks:<br \/>\n32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632<\/p>\n<p>Allocating group tables: done<br \/>\nWriting inode tables: done<br \/>\nCreating journal (16384 blocks): done<br \/>\nWriting superblocks and filesystem accounting information: done<\/p>\n<p><strong>7. \u521b\u5efa\/mnt\/data\u76ee\u5f55<\/strong><br \/>\nmkdir \/mnt\/data<\/p>\n<p><strong>8. \u5c06\/dev\/sdb1\u6302\u8f7d\u5230\/mnt\/data\u76ee\u5f55<\/strong><br \/>\nmount \/dev\/sdb1 \/mnt\/data<\/p>\n<p><strong>9. \u7528vi\u4fee\u6539fstab\u5185\u5bb9<\/strong><br \/>\nvi \/etc\/config\/fstab<br \/>\n\u589e\u52a0\u4ee5\u4e0b\u5185\u5bb9<br \/>\nconfig &#8216;mount&#8217;<br \/>\noption target &#8216;\/mnt\/data&#8217;<br \/>\noption device &#8216;\/dev\/sdb1&#8217;<br \/>\noption fstype &#8216;ext4&#8217;<br \/>\noption options &#8216;rw,sync&#8217;<br \/>\noption enabled &#8216;1&#8217;<\/p>\n<p>config &#8216;mount&#8217;<br \/>\noption target &#8216;\/overlay&#8217;<br \/>\noption device &#8216;\/dev\/sdb1&#8217;<br \/>\noption fstype &#8216;ext4&#8217;<br \/>\noption options &#8216;rw,sync&#8217;<br \/>\noption enabled &#8216;1&#8217;<\/p>\n<p><strong>10. \u91cd\u542f\u670d\u52a1<\/strong><br \/>\n\/etc\/init.d\/fstab restart<\/p>\n<p><strong>11. \u5378\u8f7d\u73b0\u6709\u7684 overlay\uff08\u5982\u679c\u5df2\u7ecf\u6302\u8f7d\uff09<\/strong><br \/>\numount \/overlay<\/p>\n<p><strong>12. \u5b89\u88c5rsync<\/strong><br \/>\nopkg update<br \/>\nopkg install rsync<\/p>\n<p><strong>13. \u5c06\u73b0\u6709\u7684 \/overlay \u76ee\u5f55\u5185\u5bb9\u79fb\u52a8\u5230\u65b0\u786c\u76d8\u4e0a<\/strong><br \/>\nrsync -aAXv \/overlay\/ \/mnt\/data\/<\/p>\n<p><strong>14. \u624b\u52a8\u6302\u8f7d overlay<\/strong><br \/>\nmount \/dev\/sdb1 \/overlay<\/p>\n<p><strong>15. \u68c0\u67e5 overlay \u662f\u5426\u6210\u529f\u6302\u8f7d\u5230\u65b0\u786c\u76d8<\/strong><br \/>\ndf -h<br \/>\n\u8f93\u51fa<br \/>\nFilesystem Size Used Available Use% Mounted on<br \/>\n\/dev\/root 98.3M 68.4M 27.8M 71% \/<br \/>\ntmpfs 352.5M 236.0K 352.2M 0% \/tmp<br \/>\n\/dev\/sda1 16.0M 6.2M 9.7M 39% \/boot<br \/>\n\/dev\/sda1 16.0M 6.2M 9.7M 39% \/boot<br \/>\ntmpfs 512.0K 0 512.0K 0% \/dev<br \/>\n\/dev\/sdb1 7.8G 2.0M 7.4G 0% \/mnt\/data<br \/>\n\/dev\/sdb1 7.8G 2.0M 7.4G 0% \/overlay<br \/>\n<strong>16. \u91cd\u542f<\/strong><br \/>\nreboot<\/p>\n<p><strong>\u5176\u4ed6<\/strong><\/p>\n<p>\u5982\u679c\u662f\u786c\u8def\u7531\u5347\u7ea7\u5230openwrt<\/p>\n<p>root@OpenWrt:~# df -h<\/p>\n<p>Filesystem\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0Size\u00a0\u00a0\u00a0\u00a0\u00a0 Used Available Use% Mounted on<\/p>\n<p>\/dev\/root\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 4.8M\u00a0\u00a0\u00a0\u00a0\u00a0 4.8M\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0 100% \/rom<\/p>\n<p>tmpfs\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 242.9M\u00a0\u00a0\u00a0\u00a0\u00a0 1.2M\u00a0\u00a0\u00a0 241.7M\u00a0\u00a0 1% \/tmp<\/p>\n<p>\/dev\/ubi0_2\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 44.6M\u00a0\u00a0\u00a0\u00a0\u00a0 1.1M\u00a0\u00a0\u00a0\u00a0 41.1M\u00a0\u00a0 3% \/overlay<\/p>\n<p>overlayfs:\/overlay\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 44.6M\u00a0\u00a0\u00a0\u00a0\u00a0 1.1M\u00a0\u00a0\u00a0\u00a0 41.1M\u00a0\u00a0 3% \/<\/p>\n<p>tmpfs\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 512.0K\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0 512.0K\u00a0\u00a0 0% \/dev<\/p>\n<p>\u770b\u5230\u7684\u662f\u6839\u76ee\u5f55 \/ \u4e0b\u6302\u8f7d\u4e86\/overlay<\/p>\n<p>\u5b89\u88c5\u5de5\u5177<\/p>\n<p>opkg update\u00a0\u00a0\u00a0\u00a0\u00a0 #\u6bcf\u6b21\u66f4\u65b0\u548c\u5b89\u88c5\u8f6f\u4ef6\u90fd\u9700\u8981\u6267\u884c<\/p>\n<p>opkg install kmod-usb-core\u00a0\u00a0\u00a0\u00a0\u00a0 #usb\u9a71\u52a8<\/p>\n<p>opkg install kmod-scsi-core\u00a0\u00a0\u00a0\u00a0 #SCSI\u603b\u7ebf\u9a71\u52a8<\/p>\n<p>opkg install kmod-scsi-generic<\/p>\n<p>opkg install kmod-usb-uhci\u00a0\u00a0\u00a0\u00a0\u00a0 #USB OHCI controllers<\/p>\n<p>opkg install kmod-usb-ohci\u00a0\u00a0\u00a0\u00a0\u00a0 #USB UHCI controllers<\/p>\n<p>opkg install kmod-usb2\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 #usb2.0\u9a71\u52a8<\/p>\n<p>opkg install kmod-usb3\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 #usb3.0\u9a71\u52a8<\/p>\n<p>opkg install kmod-usb-storage\u00a0\u00a0\u00a0\u00a0\u00a0 #usb\u5b58\u50a8\u8bbe\u5907\u9a71\u52a8<\/p>\n<p>opkg install kmod-usb-storage-extras\u00a0\u00a0 #\u5176\u4ed6USB\u8bfb\u5361\u5668\u8bbe\u5907\u9a71\u52a8<\/p>\n<p>opkg install kmod-fs-ext2\u00a0\u00a0\u00a0 #\u5b89\u88c5ext2\u5206\u533a\u652f\u6301<\/p>\n<p>opkg install kmod-fs-ext3\u00a0\u00a0\u00a0 #\u5b89\u88c5ext3\u5206\u533a\u683c\u5f0f\u652f\u6301\u7ec4\u4ef6<\/p>\n<p>opkg install kmod-fs-ext4\u00a0\u00a0\u00a0 #\u5b89\u88c5ext4\u5206\u533a\u683c\u5f0f\u652f\u6301\u7ec4\u4ef6<\/p>\n<p>opkg install kmod-fs-ntfs\u00a0\u00a0\u00a0\u00a0 #ntfs\u5185\u6838\u9a71\u52a8<\/p>\n<p>opkg install kmod-fs-vfat \u00a0\u00a0\u00a0\u00a0#\u6302\u8f7dFAT<\/p>\n<p>opkg install block-mount\u00a0 \u00a0 \u00a0 #\u5728web\u9875\u9762\u91cc\u663e\u793amount points<\/p>\n<p>opkg install e2fsprogs\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 #ext4\u683c\u5f0f\u5316\u5de5\u5177<\/p>\n<p>\u6267\u884c\u5b8c\u8fd9\u4e9b\u4ee5\u540e\uff0c\u5c31\u53ef\u4ee5\u7528<strong> fdisk -l<\/strong> \u770b\u5230\u63d2\u5165\u7684U\u76d8<\/p>\n<p>\u4e00\u6837\u7684\u7ed9\u786c\u76d8\u683c\u5f0f\u5316\u3001\u505a\u5206\u533a<\/p>\n<p>Web\u8fdb\u5230 system &#8211;&gt; mount points<\/p>\n<p>Mount points \u4e0b\u70b9\u51fb add<\/p>\n<p>UUID 1ad87fa0-7a87-4d32-a7f3-9e4c4472fec4 (\/dev\/sda1, 58.59 GiB)<\/p>\n<p>Mount point Use as external overlay (\/overlay)<\/p>\n<p>\u4fdd\u5b58\u4ee5\u540e\u522b\u5fd8\u8bb0\u70b9\u6574\u4e2a\u9875\u9762\u7684Save &amp; Apply<\/p>\n<p>Reboot<\/p>\n<p><strong>ssh\u767b\u5f55\u65f6\u63d0\u793a\u9519\u8bef<\/strong><\/p>\n<p>PS C:\\Users\\xyah&gt; ssh root@192.168.1.1<\/p>\n<p>@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@<\/p>\n<p>@\u00a0\u00a0\u00a0 WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!\u00a0\u00a0\u00a0\u00a0 @<\/p>\n<p>@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@<\/p>\n<p>IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!<\/p>\n<p>Someone could be eavesdropping on you right now (man-in-the-middle attack)!<\/p>\n<p>It is also possible that a host key has just been changed.<\/p>\n<p>The fingerprint for the ED25519 key sent by the remote host is<\/p>\n<p>SHA256:hGAb7k4v4OML2EdNP2Uu80GoYr8L1\/zrTRbEDDhQJm4.<\/p>\n<p>Please contact your system administrator.<\/p>\n<p>Add correct host key in C:\\\\Users\\\\xyah\/.ssh\/known_hosts to get rid of this message.<\/p>\n<p>Offending ED25519 key in C:\\\\Users\\\\xyah\/.ssh\/known_hosts:3<\/p>\n<p>Host key for 192.168.1.1 has changed and you have requested strict checking.<\/p>\n<p>Host key verification failed.<\/p>\n<p><strong>\u6267\u884cssh-keygen -R 192.168.1.1\u540e\u518d\u6b21\u767b\u5f55<\/strong><\/p>\n<p>\u6267\u884cdf -h\uff0c\u53ef\u4ee5\u770b\u5230\u65b0\u7684\u6302\u8f7d\u60c5\u51b5<\/p>\n<p>root@OpenWrt:~# df -h<\/p>\n<p>Filesystem\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Size\u00a0\u00a0\u00a0\u00a0\u00a0 Used Available Use% Mounted on<\/p>\n<p>\/dev\/root\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 4.8M\u00a0\u00a0\u00a0\u00a0\u00a0 4.8M\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0 100% \/rom<\/p>\n<p>tmpfs\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 242.9M\u00a0\u00a0\u00a0 256.0K\u00a0\u00a0\u00a0 242.7M\u00a0\u00a0 0% \/tmp<\/p>\n<p>\/dev\/sda1\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 57.4G\u00a0\u00a0\u00a0\u00a0\u00a0 2.4M\u00a0\u00a0\u00a0\u00a0 54.4G\u00a0\u00a0 0% \/overlay<\/p>\n<p>overlayfs:\/overlay\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 57.4G\u00a0\u00a0\u00a0\u00a0\u00a0 2.4M\u00a0\u00a0\u00a0\u00a0 54.4G\u00a0\u00a0 0% \/<\/p>\n<p>tmpfs\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 512.0K\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0 512.0K\u00a0\u00a0 0% \/dev<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. \u767b\u5f55 ssh root@192.168.5.18 2. &hellip;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"_links":{"self":[{"href":"https:\/\/flighhai.cn\/index.php?rest_route=\/wp\/v2\/posts\/890"}],"collection":[{"href":"https:\/\/flighhai.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/flighhai.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/flighhai.cn\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/flighhai.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=890"}],"version-history":[{"count":4,"href":"https:\/\/flighhai.cn\/index.php?rest_route=\/wp\/v2\/posts\/890\/revisions"}],"predecessor-version":[{"id":904,"href":"https:\/\/flighhai.cn\/index.php?rest_route=\/wp\/v2\/posts\/890\/revisions\/904"}],"wp:attachment":[{"href":"https:\/\/flighhai.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=890"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/flighhai.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=890"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/flighhai.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=890"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}