LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Partition Free Space - Move /home to the new partition (https://www.linuxquestions.org/questions/linux-general-1/partition-free-space-move-home-to-the-new-partition-126198/)

gregkise 12-15-2003 08:46 PM

Partition Free Space - Move /home to the new partition
 
Hi All,

When I installed RH 9 for some reason it put the boot and swap on hda and everything else on hdb. It also left 37 gig of free space on hda (which I would like to reclaim). How do I make a new ext3 partition out of the free space and then move /home to the new partition.

BTW - my overall theoritical strategy was to use Disk Druid to partition the free space, then copy /home to a temporary directory ( /newhome ) on the new partition, then edit fstab to make the new directory home. But I don't know the details to make this work without screwing something up.

Thanks much!
Greg

-----------------------------------------------------------------------

Here is the data from fdisk -l (with some editing).

Disk /dev/hda: 40.0 GB, 40027029504 bytes (Maxtor 40gig)
255 heads, 63 sectors/track, 4866 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 13 104391 83 Linux
/dev/hda2 14 143 1044225 82 Linux swap
........................144 4866 37048000 FREE SPACE

Disk /dev/hdb: 40.0 GB, 40020664320 bytes (Seagate 40gig)
255 heads, 63 sectors/track, 4865 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hdb1 * 1 4865 39078081 83 Linux

Scruff 12-16-2003 12:16 AM

You've got it basically. I just helped someone do this same thing a week or two ago here.

Give that a quick look and if you have any questions post em up :)

trickykid 12-16-2003 07:56 AM

If you want to take a look at my latest journal, I explained in it how I moved my partition /var to a new drive/partition. Might be helpful to you: http://www.linuxquestions.org/questi...60&action=view

ac1980 12-16-2003 06:04 PM

I had a look at Scuff post, and I have a patch to suggest (can u apply it, pls?):

When moving/archiving filesystem piecies as root, I strongly suggest giving cp the "--archive" (short -a) option instead of -R, It will keep original ownership, permissions and so on.
Refer to cp manpage.

Scruff 12-16-2003 06:16 PM

lol! Just got finished reading your post on the other thread. Good idea though, and I will make the changes.

gregkise 12-16-2003 10:19 PM

Woohoo
 
I think I just graduated from newbie-ville.

I successfully partitioned the free space (using cfdisk), set up my file system (mkfs.ext3), and moved my /home directory to the new partition using this great command from MaroonBaboon:

# cd /home ; tar cf - * | ( cd /mnt/newhome ; tar xvf - )

BTW - I made a small variation on the whole move thing which worked quite nicely.

1) I copied /home to /mnt/newhome, edited fstab appropriately, and testing that this worked by mounting and unmounting.

2) I created a dummy directory called /home/test. Remember I previously copied /home to /mnt/newhome without the dummy "test" directory

3) I edited fstab to mount the new partition at /home. And then mounted the new partition.

4) If the mount worked properly and all was well I should no longer see /home/test. And this is exactly what happened (fortuitously). I could then umount and see the /home/test directory reappear.

5) Finally I reboot and start working on the new partition. Assuming all goes well for the next couple of weeks I'll unmount the new partition and delete the old /home (I know I could probably do this now, but I'm a chickenS&!t).

Oh yeah -- I also rearranged the desktop on the old home just to make doubly sure when I rebooted.

--------
A couple things that might help other newbies with similar problems. First, cfdisk doesn't come installed on RH9 machines - you have to go out and download the cfdisk rpm (I used cfdisk-glibc).

Second, I wasn't able to access these commands from a terminal inside X - even as SU. I had to open a new shell using ctrl-alt-F1 then login as root to use fdisk and/or cfdisk.

Third, the documentation on cfdisk is a little sketchy. It wasn't clear that you have to Write the partition after you set it up - and doing this the first time is a little scary if you're not 100% positive that this is the proper thing to do (I was probably 95%).

That's all. Thanks Scruff and Trickykid. I really appreciate all your help!

Greg


All times are GMT -5. The time now is 10:46 PM.