Move directory from one petition/device to another

Cameron Beattie kjcsb at orcon.net.nz
Fri Sep 16 23:25:13 UTC 2005


> Had you picked almost any other directory, there'd have probably been no 
> problem in doing so...
>
> However, /etc is necessary very early in the boot process. (i.e. before 
> all the mounts are done.) Things like /etc, /bin, /sbin, /var need to be 
> in the root so that they can be used during the boot. Other things, like 
> /usr, /tmp, /opt can be moved into other partitions or devices / 
> filesystems, and can be set up in /etc/fstab to be mounted during the boot 
> process, without any harm to the system.
>
> Doing so is just a matter of mounting the new filesystem at a convenient 
> mount point, cloning the directory structure over to it (tar is useful for 
> this), getting into single user mode, deleting the original files and then 
> mounting the new filesystem over the old directory as a mountpoint.
>
This is where I'm a bit lost. I have replicated the directory /etc as 
follows:
mkdir /newetc
mount -t ext3 /dev/sda2 /newetc
cd /
tar cf - ./etc | (cd /newetc; tar xf -)

How do I now convince the system to look in /dev/sda2/newetc/etc rather than 
/dev/sdb1/etc when I do a cd /etc?
> If you're not completely brave (reckless), mount the new filesystem over 
> the old directory first without removing the old files, and test it to be 
> sure everything is happy, before going into single user mode and deleting 
> the files. Testing saves much time and effort.
>
>
Thanks and regards

Cameron 




More information about the fedora-list mailing list