Reload fstab without rebooting?

I have an SD card that I use overlay on:

# mkfs.ext4 /dev/mmcblk0
# mount /dev/mmcblk0 /mnt
# tar -C /overlay -cvf - . | tar -C /mnt -xf -
# umount /mnt
# block detect > /etc/config/fstab
# sed -i "s#/mnt/mmcblk0#/overlay#g" /etc/config/fstab
# sed -i "s/option\senabled\s'0'/option  enabled '1'/g" /etc/config/fstab

On reboot this works. However I want to do this without rebooting as this process is part of a set of setup scripts I'm writing to setup a new device. Is this possible?

Btw, I've tried:

# /etc/init.d/fstab stop
# /etc/init.d/fstab boot


# mount -a


# block umount
# block mount

None of which work. I do not see the SD card mounted on the overlay but /dev/mtdblock6 unless I reboot the device.


Here is # df before reboot:

Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/root                 4352      4352         0 100% /rom
/dev/mtdblock6           10240      2816      7424  28% /overlay
overlayfs:/overlay       10240      2816      7424  28% /

And after:

Filesystem                Size      Used  Available Use% Mounted on
/dev/root                 4352      4352         0 100% /rom
/dev/mmcblk0             14.5G     40.3M      13.7G   0% /overlay
overlayfs:/overlay       14.5G     40.3M      13.7G   0% / 
1 Like

You need to reboot since overlay is configured at the preinit stage.
Set up extroot as a child script/function and reboot at the end of the script.
Check if the overlay is mounted to avoid duplication before invoking the script.


This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.