Bilal Dar wrote:
Follow these steps and it should work very well. If nervous about following these steps, follow the steps for /home first and after it works and you are comfortable then repeat the steps to do /var.Well thanks but i am not even at this step now, my new device is /dev/hdb. I made two partitions /dev/hdb1 and /dev/hdb2. Now what should be my next step. I dont know what to do next.
Thanks
----- Original Message ----- From: Gertjan Vinkesteijn To: For users of Fedora Core releases Sent: Sunday, April 11, 2004 2:10 PM
Subject: Re: hardisk full
Bilal Dar wrote: Dear all,
I am having this problem, my harddrive got full so i added another one to my machine. Now i don't know how to move my /home /var to the new drive. Can someone guide me, i just made the partitions using fdisk.
Use tar because it easily maintains ownership and permissions whereas cp requires special flags to do that.
This all must be done as root.
1. create 2 mount points in /mnt. call them /mnt/home and /mnt/var
2. mount the appropriate partition on each. mount /dev/hdb1 /mnt/home etc.
3. create tar files (This assumes you have at least twice the currently used space in each of the new partitons. If not, choose a different location where space is available to create the tar files, or do just one filesystem at a time and use the other partition as the location to create that file.)
# tar cvf /mnt/home/home.tar /home
# tar cvf /mnt/var/var.tar /var
4. Now extract the tarball to the new partitions
# cd /mnt
# tar xvf home/home.tar
# tar xvf var/var.tar
5. do a quick verification of the completeness of both new sets of files extracted.
A quick way to check it is close is
du -s /var
du -s /mnt/var
The numbers should be very close if not exact.
6. (this one can be done now or later) If step 5 appears good then do # rm /mnt/home.tar /mnt/var/var.tar
7. Now comes the hard (easy??) part -- actually putting the new filesystems on the mount point.
a. Edit /etc/fstab to make sure the new partitons will be mounted on /home and /var
eg. /dev/hdb1 /home ext3 defaults 1 2
/dev/hdb2 /var ext3 defaults 1 2
b. You must remove the old contents of /home and /var _before_ you mount the new partions at that point so you have that space available. (If you do not, the space will not be available and the clearing cannot be done with the filesystem mounted at that point)
(carefull on the spelling with this one)
# rm -rf /home/*
then
# rm -rf /var/*
c: Reboot
If you have carefully followed all the steps above, now reboot and everything will be on the new filesystems and space previously used will be free.