-   Linux - Software (
-   -   Access file after FS mounted on parent folder (

mslootweg 10-10-2009 07:40 PM

Access file after FS mounted on parent folder
I've set up debian to run in a read only envoirement. /var and /etc are ram drives. The way I do this is to run a boot script right after the usual boot mounting that mounts a ram disk(tmpfs specifically) on /etc and /var. I then mount the root partition a second time on /mnt/sda1 and copy over the contents from /mnt/sda1/etc to /etc and the contents from /mnt/sda1/var to /var. My problem is that mounting the same device twice has unpredictable results. Sometimes it works, sometimes it returns "mount: /dev/sda1 already mounted or /dev/sda1 busy"

I'm thinking the best way of fixing this issue is to not mount the root filesystem a second time, it's an ugly solution anyway. Is there anyway to access /etc on the device /dev/sda1 after a ram disk has been mounted on /etc?

penguiniator 10-11-2009 12:17 PM

I'm assuming /etc is in a separate partition? You could create a different mount point for it and use that instead.

mslootweg 10-12-2009 07:28 AM

Unfortunatly I haven't found a way to get /etc off the root partition. this is because the debian boot sequence reads /etc/fstab to know where specific mounts are located. It can't read in /etc/fstab if the location of /etc isn't known yet.

So my full debian install is on one giant root partition all together, some directories are then replaced by ramdrives and filled by the files that were in those directories.

But after mounting a ramdrive on /var I can't find a way to get to the original files that are on the harddrive in /var without unmounting the ramdrive first, which would destroy the ramdrive.

All times are GMT -5. The time now is 03:56 AM.