how do i move /home to a partition?

Howard Coles Jr. dhcolesj at gmail.com
Sat Oct 7 04:27:04 UTC 2006


On Friday 06 October 2006 5:10 pm, Buzzy! wrote:
> can i do that??
> i have only about 2 Gb free on disk...and  i have 2 partitions: swap + /
> pls help me

This may not be the best way as I'm not a wiz at this stuff but . . . .
1.  install a new hard drive (or new partition if you have the space).  (if 
you haven't set a password for root you'll need to put "sudo" in front of any 
examples I'll give).
2.  setup the partition on the drive (using fdisk or gparted) and format it 
with a filesystem ( like reiser or ext3)
3.  Create a temporary spot to mount the new drive (like so:  
mkdir /mnt/hometmp )
3. mount the new drive / partition in a temporary home.  For example:
    mount -t ext3 /dev/hdb1 /mnt/hometmp (If you used ext3 to format the 
second drive on the first IDE channel with 1 partition, or the first 
partition)
4.  copy all the data over and protect permissions.  (for example:
     cp -dpR /home/* /mnt/home/ ).  Of course, you'll need to make sure you 
are not logged in via KDE while doing this because you'll have files open 
during the copy, which could make them fail.  I would suggest logging out of 
KDE or Gnome altogether and switching to say, terminal 2 (Ctrl+Alt+F2) and 
logging in to do this.  
5.  compare the two directories to make sure everything was copied (however 
you like).
6.  Once the compare is to your liking, you can optionally delete everything 
under /home and / or just unmount /dev/hdb1 from /mnt/hometmp.  
(umount /mnt/hometmp) and mount the new drive manually at first to its new 
home (mount -t ext3 /dev/hdb1 /home).
7.  if everything looks like you expected and you like what you see, you can 
edit the /etc/fstab so this happens everytime you boot.  
here's an example line:
/dev/hdb1       /home           ext3    defaults        0       1
8.  After you have done all that, I would recommend if you didn't delete 
everything from the old /home you go back and do it now.  MAKE DARN SURE you 
have unmounted the NEW drive first so you don't accidentally wind up wiping 
both copies away.  Then after the delete is finished remount the new drive, 
or reboot to test your fstab entries,

Trust me, correcting these instructions would not offend anyone!  :-D.   I 
know there are some particulars that are left out.  Simply because I wasn't 
sure, and I didn't want to intentionally steer you wrong.

-- 
See Ya'
Howard Coles Jr.
John 3:16!

http://risenbooks.com Christian bookstore




More information about the kubuntu-users mailing list