View Full Version : Resizing root partition
widesteps
5th March 2004, 11:21 PM
Hi all,
Got FC1 installed on 80GB disk.
/boot 100Mb (ext3)
/ 78GB!!!! (ext3)
/swap 1Gb
I have decided I want to split the massive root partition into two, So can roll my own on the new partitiion. How do I do it without shafting my system?
I have looked at parted, fdisk and linux howto's but nothing is explained very well. This is my root partition with everything on it so I am very wary.
Being the root partition I cannot use parted direct but have to use a bootdisk disk. I can't seem to get partboot to work correctly...and what is this partROOT(?!) business all about it isn't described anywhere!
I have used a Live CD (MEPIS) and tried parted from in there but parted says something about the disk being a strange layout and can't do it.
So what is a guy supposed to do?
Am I using the right app/approach?
Can i do it? and How?
Hope you can help
Cheers
micha
6th March 2004, 01:30 AM
I had the same problem. I tried parted and it didn't work. I finally got around using Partition Magic to resize the root partition.
widesteps
6th March 2004, 02:17 AM
My machine does not have windows on it. It is a straight linux box and I think partition magic is a windows only product?
Anyway does PM have bootdisks? cos to resize the root partition I thought you couldn't be 'running' from there - chicken and egg syndrome.
mhelios
6th March 2004, 03:48 AM
Being the root partition I cannot use parted direct but have to use a bootdisk disk.
That's correct; however, if you simply boot off the fedora CD#1 and type "linux rescue", you will be taken to a limited root prompt with parted. (choose to not mount partitions when prompted)
When at the prompt type `chroot /mnt/sysimage` and then follow this to resize:
http://www.redhat.com/docs/manuals/linux/RHL-9-Manual/custom-guide/s1-parted-resize-part.html
widesteps
6th March 2004, 05:02 PM
Thanks for that mhelios, very Helpful.
Unfortunately I now have the problem that my root partition is of type ext3 and parted only handles ext2!! Any suggestions around this one? Surely there is a tool that can resize an ext3 partition.
Also for future ref: you are dropped into th eboot prompt after yo 'skip' mounting the sysimage. From here ' chroot /mnt/sysimage` fails as nothing is mounted!! just run parted at this point and look at you disk and partitions. No chroot needed.
Cheers for the help so far. Much appreciated.
mhelios
7th March 2004, 04:07 AM
There is a know problem with some versions of parted not recognising ext3 partitions. They are supposed to be supported. You can either upgrade or look at using either "ext2resize" or "resize2fs".
See this thread for the issues with parted:
https://listman.redhat.com/archives/ext3-users/2002-March/msg00139.html
widesteps
7th March 2004, 12:01 PM
Thanks mhelios,
However, (there is always a however!) I'm doing a root partition resize and am using the FC1 disk 1 in rescue mode, how do I upgrade the version of parted on that? and if I were to use the other utilities how do I get them integrated with the FC1 boot CD?
It's getiing to the point where it seems a reinstall is easier than just resizing a $%^&* partition.
I must add that when I run resize in parted the 'error' says something along the lines of 'the partition has a strange layout so it can't continue'. I have taken that to mean the partition is ext3 and parted can't handle it, meaning it's an old version of parted on FC1 disk 1. If this is NOT the case then I have been misleading you, apologies...and do you know what the real problem would be?
Cheers
RanCyyD
7th March 2004, 01:13 PM
Maybe this can help?
http://fedoranews.org/contributors/stephen_webley/resize/
Now how does one resize a partition in Linux ???. My disk is pretty straight forward. I have a 128 meg primary partition #1 that mounts to /boot. I have a root primary partition #2 that takes up the remaining disk (minus my swap partition #3). On the new disk the same was so except there was a heap of free space at the end of the disk. The system started and ran with no errors so all that was left was to expand my root partition and enjoy some free space at last. He is how I did it. Once again boot to the rescue disk with my new 15 gig as the master and again I didn't mount my system. I then used fdisk to toast my swap partition noting the size in blocks. I then toasted my data partition and recreated it with THE SAME STARTING POINT. I naturaly used all the free space minus what I needed for my swap partition. I then ran resize2fs /dev/hda2 and it complained about needing a check and kindely spat out instructions on how to do this. Next I ran the command e2fsck -f /dev/hda2 and tried the resize program again. SUCCESS it did what I wanted and maxed out the filesystem in the partition and all was well.
widesteps
7th March 2004, 04:49 PM
Ok,
With all your help I have finally done it! This is a quick run down of what I did.
I have presented it here as a possible little howto on going from the standard 3 partition install to a 4 partition setup by splitting the usually large root partition. Hope it helps someone else in the future. Thanks again for your help fed forum.
Initial partitions on 80Gb disk.
/boot (100Mb, /dev/hda1)
/ (~78Gb, /dev/hda2 - Splitting this one)
/swap (1Gb, /dev/hd3)
Use FC1 disk 1 and boot up 'linux rescue'. Do not mount sysimage partition.
# e2fsck -f /dev/hda2
# resize2fs -p /dev/hda2 40G
# fdisk /dev/hda
Use fdisk commands to delete (d) the root partition (and the swap partition if you want neat sequential partition numbers later - Note: remember the start cyl for the swap partition)
Add (n) a new primary partition (the start cyl defaults to the end of the /boot partition). Calculate and set the required end cyl. This is the tricky bit!
Add (n) another new primary partition (the start cyl defaults to the end of the previous new partition). Set the end cyl to the noted start cyl for the previously deleted swap partition - see above.
Add (n) another new primary partition for the swap. you can use the default start and end cyl to use up the rest of the disk.
Set the system id (t) of the swap partition to hex 82 to identify it as swap space.
Write (w) partition table to disk and exit fdisk
Now create a filesystem on the new partition /dev/hda3
# mkfs.ext3 /dev/hda3
(mkfs.ext2 and mkfs.jfs are also available)
Now I thought I was very careful when I calculated matching partition and file system sizes. A reboot showed that my root partition was smaller than the filesystem, aargh!
So while back in rescue mode before rebooting it would be wise to resize the root partition again to fit perfectly the new partition size.
# e2fsck -f /dev/hda2
# resize2fs -p /dev/hda2 (No size needed as it defaults to the size of the partition - nice!)
Which I did by rebooting into rescue mode. Note when running e2fsck it will warn you about your corrupted partition/fileystem numbers and offer you the option of aborting the check, just say no and it will continue quite happily.
/boot (100Mb, /dev/hda1)
/ (~78Gb, /dev/hda2 - Splitting this one)
/new (~38Gb, /dev/hda3)
/swap (1Gb, /dev/hd4)
Hope this is helpful.
Cheers
widesteps
7th March 2004, 04:54 PM
Sorry that last table above should read...
/boot (100Mb, /dev/hda1)
/ (~40Gb, /dev/hda2)
/new (~38Gb, /dev/hda3)
/swap (1Gb, /dev/hda4)
crackers
7th March 2004, 08:38 PM
I know it's a bit too late in this instance, but I'll mention this for anyone else that might need to do this:
Knoppix comes with QTParted, which makes it trivial to muck around with your partitions (generally). It'll even handle NTFS partitions...
Ug
7th March 2004, 09:57 PM
But remember folks, if you're on dialup a Knoppix ISO could take 3 days to download.
mhelios
13th March 2004, 04:30 PM
OP confirmed problem fixed, so changing to status RESOLVED.
foolish
13th March 2004, 05:47 PM
You can install qtparted in Fedora Core as well, http://newrpms.sunsite.dk offers qtparted packages.
Powered by vBulletin® Version 4.2.5 Copyright © 2023 vBulletin Solutions Inc. All rights reserved.