Re: Moving Directory help

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

 



Dan Track wrote:
Hi

I've got /var in the root filesystem. What I would like to do is move
it to a new separate partition. I've created the partition but when I
mount /var onto it /var is empty. If I umount it I can see all the
directories again e.g /var/log. Can someone please tell me why this is
happening and find a way round this?


This is the expected result.

When you create a new partition and make a new empty file system in it,
the file system is empty of files.  When you mount this onto /var,
an then look at /var, the OS is showing you what's in
your new empty file system you've just created and mounted.  The
original /var contents is "under" the /var mount and will only be
accessible when you unmount the empty file system you mounted on /var.

In order to have all the original contents in the newly created
partition and file system, you will have to do something like this:
1) Boot into Linux Rescue from FC media.  This is because you
   will need to copy files in /var, which may not be readable or
   removable if a process is using them.
2) Mount the new partition/file system somewhere like varnew
3) Copy var into varnew, remove var (to recover the disk space)
   taking care to keep permissions the same.  Something like
   # cd to / on the original root disk (not the running live / )
   # cd var; tar cf - . | (cd varnew; tar xvf - )
4) Unmount varnew and mount it as var.  Make sure this is set
   in etc/fstab so that the system will have the new partition/
   file system as /var when we boot.
4) Reboot

Good luck,
Khoa Ton





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

  Powered by Linux