I have tested this pivot overlay on TP-LINK WR1043ND v2.1 router
1. Compile custom firmware image as described in my previous post. For enabling usb select following packages in menuconfig.
kernel modules -> usb support -> kmod-usb-storage, kmod-usb-storage-extras, kmod-usb-uhci (If needed, ohci is selected by default)
kernel modules -> filesystems -> kmod-fs-ext4
Utilities -> Filesystem -> e2fsprogs
Utilities -> disc -> fdisk
Utilities -> usbutils
Base system -> block-mount
Alternately these packages can be installed using 'opkg install'
2. Create the linux partitions using fdisk as per your need
fdisk /dev/sda
m - Help
p - to print partition
n - new partition
d - delete partition
My partitions for example -
fdisk -l /dev/sda
Disk /dev/sda: 3.8 GiB, 4009754624 bytes, 7831552 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000
Device Boot Start End Blocks Id System
/dev/sda1 2048 7362559 3680256 83 Linux
/dev/sda2 7362560 7831551 234496 82 Linux swap / Solaris
3. Format the partition with ext4
mkfs.ext4 /dev/sda1
Now mount the filesystem
mkdir /mnt/sda1
mount /dev/sda1 /mnt/sda1
4. Copy contents from /overlay to usb device
tar -C /overlay -cvf - . | tar -C /mnt/sda1 -xf -
5. Generate and edit fstab file
block detect > /etc/config/fstab
vi /etc/config/fstab
change the target to '/overlay' & enabled option to '1'. Do not change UUID or other settings.
6. Restart the router.
7. Verify the mount after reboot (My output shown below).
Filesystem Size Used Available Use% Mounted on
rootfs 3.4G 7.2M 3.2G 0% /
/dev/root 3.0M 3.0M 0 100% /rom
tmpfs 30.0M 48.0K 30.0M 0% /tmp
/dev/sda1 3.4G 7.2M 3.2G 0% /overlay
overlayfs:/overlay 3.4G 7.2M 3.2G 0% /
tmpfs 512.0K 0 512.0K 0% /dev
8. Block mount also detects other settings, fstab file after reboot with detected settings is shown below:
config 'global'
option anon_swap '0'
option anon_mount '0'
option auto_swap '1'
option auto_mount '1'
option delay_root '35'
option check_fs '0'
config 'mount'
option target '/overlay'
option uuid '4367f74a-86e8-4340-b8d2-fd458433f9d0'
option fstype 'ext4'
option options 'rw,sync'
option enabled_fsck '0'
option enabled '1'
References:
http://wiki.openwrt.org/doc/howto/extroot
http://wiki.openwrt.org/doc/uci/fstab
1. Compile custom firmware image as described in my previous post. For enabling usb select following packages in menuconfig.
kernel modules -> usb support -> kmod-usb-storage, kmod-usb-storage-extras, kmod-usb-uhci (If needed, ohci is selected by default)
kernel modules -> filesystems -> kmod-fs-ext4
Utilities -> Filesystem -> e2fsprogs
Utilities -> disc -> fdisk
Utilities -> usbutils
Base system -> block-mount
Alternately these packages can be installed using 'opkg install'
2. Create the linux partitions using fdisk as per your need
fdisk /dev/sda
m - Help
p - to print partition
n - new partition
d - delete partition
My partitions for example -
fdisk -l /dev/sda
Disk /dev/sda: 3.8 GiB, 4009754624 bytes, 7831552 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000
Device Boot Start End Blocks Id System
/dev/sda1 2048 7362559 3680256 83 Linux
/dev/sda2 7362560 7831551 234496 82 Linux swap / Solaris
3. Format the partition with ext4
mkfs.ext4 /dev/sda1
Now mount the filesystem
mkdir /mnt/sda1
mount /dev/sda1 /mnt/sda1
4. Copy contents from /overlay to usb device
tar -C /overlay -cvf - . | tar -C /mnt/sda1 -xf -
5. Generate and edit fstab file
block detect > /etc/config/fstab
vi /etc/config/fstab
change the target to '/overlay' & enabled option to '1'. Do not change UUID or other settings.
6. Restart the router.
7. Verify the mount after reboot (My output shown below).
Filesystem Size Used Available Use% Mounted on
rootfs 3.4G 7.2M 3.2G 0% /
/dev/root 3.0M 3.0M 0 100% /rom
tmpfs 30.0M 48.0K 30.0M 0% /tmp
/dev/sda1 3.4G 7.2M 3.2G 0% /overlay
overlayfs:/overlay 3.4G 7.2M 3.2G 0% /
tmpfs 512.0K 0 512.0K 0% /dev
8. Block mount also detects other settings, fstab file after reboot with detected settings is shown below:
config 'global'
option anon_swap '0'
option anon_mount '0'
option auto_swap '1'
option auto_mount '1'
option delay_root '35'
option check_fs '0'
config 'mount'
option target '/overlay'
option uuid '4367f74a-86e8-4340-b8d2-fd458433f9d0'
option fstype 'ext4'
option options 'rw,sync'
option enabled_fsck '0'
option enabled '1'
References:
http://wiki.openwrt.org/doc/howto/extroot
http://wiki.openwrt.org/doc/uci/fstab
No comments:
Post a Comment