Никак не могу перенести overlay на Flash. Имею заново перепрошитый девайс, доставлены пакеты usb-ohci, usb-storage, usb2, fs-ext4, block-mount. Через хаб подключена Flash (1 раздел - sdb1 для overlay) и HDD (два раздела - sda1 под swap, sda2 под /home):
root@OpenWRT:/# dmesg | grep sd
[ 17.430000] sd 0:0:0:0: no of_node; not parsing pinctrl DT
[ 17.430000] sd 0:0:0:0: [sda] 625142448 512-byte logical blocks: (320 GB/298 GiB)
[ 17.540000] sd 0:0:0:0: [sda] Write Protect is off
[ 17.540000] sd 0:0:0:0: [sda] Mode Sense: 34 00 00 00
[ 17.580000] sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[ 18.170000] sda: sda1 sda2
[ 18.210000] sd 0:0:0:0: [sda] Attached SCSI disk
[ 18.340000] sd 1:0:0:0: no of_node; not parsing pinctrl DT
[ 18.340000] sd 1:0:0:0: [sdb] 7843840 512-byte logical blocks: (4.01 GB/3.74 GiB)
[ 18.370000] sd 1:0:0:0: [sdb] Write Protect is off
[ 18.380000] sd 1:0:0:0: [sdb] Mode Sense: 03 00 00 00
[ 18.390000] sd 1:0:0:0: [sdb] No Caching mode page found
[ 18.400000] sd 1:0:0:0: [sdb] Assuming drive cache: write through
[ 18.450000] sd 1:0:0:0: [sdb] No Caching mode page found
[ 18.460000] sd 1:0:0:0: [sdb] Assuming drive cache: write through
[ 18.690000] sdb: sdb1
[ 18.750000] sd 1:0:0:0: [sdb] No Caching mode page found
[ 18.770000] sd 1:0:0:0: [sdb] Assuming drive cache: write through
[ 18.780000] sd 1:0:0:0: [sdb] Attached SCSI removable disk
[ 28.340000] Adding 102396k swap on /dev/sda1. Priority:-1 extents:1 across:102396k
[ 28.880000] EXT4-fs (sda2): mounted filesystem with ordered data mode. Opts:
root@OpenWRT:/# block info
/dev/mtdblock4: UUID="e5e5f760-da88e06b-6dba20f7-5b5028e7" VERSION="1024.0" TYPE="squashfs"
/dev/mtdblock5: TYPE="jffs2"
/dev/sda1: UUID="4d6a85df-e44f-4b03-95a5-4fa803caa25c" LABEL="Swap" VERSION="2" TYPE="swap"
/dev/sda2: UUID="4088b4e7-0b27-4c14-91a3-59690b743c16" LABEL="Ext4" NAME="EXT_JOURNAL" VERSION="1.0" TYPE="ext4"
/dev/sdb1: UUID="32cc0df9-5538-4e29-b6c6-6a8759ef17d5" LABEL="Ext4" NAME="EXT_JOURNAL" VERSION="1.0" TYPE="ext4"
root@OpenWRT:/# cat /etc/config/fstab
config global automount
option from_fstab '1'
option anon_mount '1'
config global autoswap
option from_fstab '1'
option anon_swap '0'
config mount
option target '/'
# option device '/dev/sdb1'
option uuid '32cc0df9-5538-4e29-b6c6-6a8759ef17d5'
option fstype 'ext4'
option options 'rw,sync'
option enabled '1'
option enabled_fsck '1'
option is_rootfs '1'
config swap
# option device '/dev/sda1'
option uuid '4d6a85df-e44f-4b03-95a5-4fa803caa25c'
option enabled '1'
config mount
option target '/home'
# option device '/dev/sda2'
option uuid '4088b4e7-0b27-4c14-91a3-59690b743c16'
option fstype 'ext4'
option options 'rw,sync'
option enabled '1'
option enabled_fsck '1'
Мои действия:
1. При подключенных Flash и HDD загружается девайс. Отключаю автомонтирование в fstab. Перезагружаю.
2. Монтирую раздел Flash:
mkdir /mnt/sdb1
mount /dev/sdb1 /mnt/sdb1
3. Удаляю все файлы на нем: rm -R /mnt/sda1/* (поскольку уже надцать раз пробовал все делать)
4. Копирую на flash все данные:
mkdir /tmp/cproot
mount --bind / /tmp/cproot
tar -C /tmp/cproot -cvf - . | tar -C /mnt/sdb1 -xvf -
sync
5. Восстанавливаю автомонтирование и загрузку разделов
6. Копирую fstab на Flash
7. Отмонтировываю разделы и перезагружаю девайс.
Итог - sda2 (/home) и swap есть, а overlay штатный...:
root@OpenWRT:/# df -h
Filesystem Size Used Available Use% Mounted on
rootfs 4.8M 688.0K 4.1M 14% /
/dev/root 2.0M 2.0M 0 100% /rom
tmpfs 14.3M 72.0K 14.2M 0% /tmp
/dev/mtdblock5 4.8M 688.0K 4.1M 14% /overlay
overlayfs:/overlay 4.8M 688.0K 4.1M 14% /
tmpfs 512.0K 0 512.0K 0% /dev
/dev/sda2 293.2G 3.2G 275.1G 1% /home
root@OpenWRT:/# free
total used free shared buffers
Mem: 29192 20600 8592 0 1836
-/+ buffers: 18764 10428
Swap: 102396 0 102396