Re: Move directory from one petition/device to another

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Fri, 2005-09-16 at 18:25, Cameron Beattie wrote:
> 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?

Errr....  You did read the part above that you quoted above noting
that /etc was a special case that needs to be on the / partition
didn't you?    The way you make your new partition appear at a
certain directory is to mount it there.  You might unmount it
from it's /newetc mount point and remount on /etc _but_ the
way the system determines what to mount at bootup is to
read /etc/fstab.  Notice the problem yet?  What you are
doing would work with /home, /var or about anything else.
Your next step would be to set up the /etc/fstab entry,
rename the old directory (so you can delete the contents
later), make a new empty one for the mount point, and
reboot.
I did read it and I understood it to be difficult but not impossible. So I'm
now attempting to do the difficult and failing!

If I follow what you say (and I'm not sure I do), I would do the following (having copied the contents of /etc to /newetc):
vi /etc/fstab
/dev/sda2 /etc ext3 defaults 0 0

mv /etc /oldetc
mv /newetc /etc
reboot

The contents of /etc are typically not all that big.  Why
do you want it on a separate partition anyway?
I probably should have told the whole story. What I have is a bunch on
directories on a RAID5 array and want to move all the system-type ones e.g.
/etc /bin /sbin/ to a RAID1 array, leaving /home /usr etc where they are. I
guess it would be easier the other way around but that's not an option.

Any further advice would be appreciated.

Regards

Cameron

[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux