-   Linux - Software (
-   -   Resizing and moving partitions (

linmix 02-18-2005 10:30 AM

Resizing and moving partitions
Last year I made another serious start to learn to use linux and after some reading I set up several distros to see which one I liked best. I used partition magic to create the framework for my attempts and made several sets of '/boot'+'/'+'/home' partitions. Now, I'm happy using FC3 (although I would like to leave some space to test other distros) and I'm in dire need of more space for my FC3 partitions.

When I boot into Knoppix and start qtparted it gives me the following info:

|-01 /dev/hda1 fat32 (windows)
|-02 /dev/hda3 linux-swap 525MB
|-03 /dev/hda2 extended
| |
| |-04 /dev/hda5 fat32 (windows program files)
| |-05 /dev/hda6 fat32 (offline folder)
| |-06 /dev/hda7 fat32 (documents)
| |
| |-07 /dev/hda8 ext3 (old /boot 100mb)
| |-08 /dev/hda9 ext3 (old / 6.5Gb)
| |-09 /dev/hda10 ext3 (old /home 1Gb)
| |
| |-10 /dev/hda11 ext3 (=fc3 /boot)
| |-11 /dev/hda12 reiserfs (=fc3 /)
| |-12 /dev/hda13 reiserfs (=fc3 /home)
|-13 /dev/hda-1 free 12.05GB

However, the hardware browser in FC3 places partitions hda11-13 phisically before hda8-10. I seem to remember these partitions ware made during the FC3 setup/installation and were placed before partitions 8-10, but I'm not sure.

I would like to resize /dev/hda12 and /dev/hda13, but qtparted will only allow me to make them smaller, even though there is 12BG of free space at the end. I can't make the extended partition bigger either.

I'm afraid to erase dev/hda8-10 because I'm not sure what the consequences would be for my existing FC3 installation. I suppose I'd have to change grub and point it to the new location (it only mentions the '/boot' location specifically), but would there be anything else I need to do to keep everything working? Which file(s) tell my system where '/' and '/home' are, starting from '/boot'?

While I'm at it, one last question: My current size for '/' is 7GB and i've got 1.5Gb free space. '/home' is about 2,5Gb, but I need space for other users and for a big .wine folder. I also have a 30Gb fat32 partition for sharing files with windows (in the long run that may become a 'shared' linux partition for all users). At the moment I have about 20Gb of 'free' space (old '/boot'+'/'+'/home'+free space at end. I'd like to leave some space to be able to check out another distro occasionally. What sizes would you recommend for '/' and '/home'?

aus9 02-19-2005 06:14 AM

I think playing with partitions is ok with 2 things in mind
1) you know how to manually to create your table if things go awry
2) you have a tool to re-create the table exactly.

I recommend you consider using knoppix cd to use partimage to save your images.
and use cfdisk to record the details of your case we have to rebuild manually.

then you use knoppix or your windows or linux to burn those images to cdr
name them MS c drive Prog etc
and for linux boot root (aka /) home

then use knoppix and qtparted to write a brand new table any size you like BUT each partition must be of equal or greater size to allow partimage to overwrite to.

you do not image a linux swap file.

if this interests you I can explain more.

jumping ahead.......once you have linux /boot / /home /usr etc partitions set in concrete you just format them and then install each new distro......take images name them eg suseboot suseroot etc slackboot slack root

Well you get the idea.......some work for you to set up but once you understand the power of images you will never look back.

some links for you

linmix 02-19-2005 09:40 AM

If I catch your meaning, you're telling me to create images of the existing partitions (a complete, but comressed copy) and burn these to CDs (I don't know about the compression rate, but my windows partition add up to some 25GB!!), then clean the HD and create a new partition system big enough to hold the data of the original partitions and copy everything back.

I suppose for safety reasons I may do this for the about 7GB of my running linux before I start shuffling partitions, but at the moment I'm not convinced this is the best option. All I really want to do at this stage is enlarge the extended partition to include all of the free space at the end of the drive and probably delete the old linux setup to move my current running linux toward the beginning of the drive (right after my last fat32 partition)

I've just burned Knoppix 3.7 from an image I had on a DVD. It looks great and I've heard a lot of good things about it. Your first link looks very interesting, but I don't see any direct relation to my problem (still, always eager to learn). I'm going through the second post, but I'll need to read up on hdparm.

Will it be possible to only set back the partitions I'm interested in (that is forget about hda8-10)? If so how will this affect my system - will I need to make any changes other than to grub and fstab?

aus9 02-20-2005 06:53 AM

thats a lot......unless you have a dvd burner.....oh well

I may not a bit blunt enough so here goes

you create a part table that is set in has its share but you may have to keep it where it is if you have no dvd burner........partimage can SPLIT the images into 700 megs but I have never had an image that big.

so staying with your linux change that swap into a /boot keep all the windows the same and then make a swap at the end of any spare space you may have.

I was not trying to tell what sizes to use but now I know you are reluctant to mess with the windows we keep them and change the format of the swap to format as ext2/ext3/reiserfs ....your choice and that becomes a /boot

then everything after all the windows is deleted and you make new partitions

yes partimage has saved my bacon many a time and it saves windows......since you did not mention the size of the windows I gave it no thought..

anyhow see what I am now saying and see if that fits in to your current understanding

linmix 02-20-2005 11:10 AM

Why would I change my swap to /boot and put swap at the end?
When installing Nero under windows it checked my drives to find the fastest one and the 'further away' from the MBR, the 'slower' partitions became, so shouldn't swap be at the beginning of the disk?

What exactly do you mean by setting the partitionin concrete? Do you mean you use a tool or I make up my mind about what I want my HD to look like?

If I do change swap to /boot, copy my boot content to old swap, back up the other partitions, recreate the partition table after windows (provided qtparted lets me extend the extended partition, which is the big problem right now, and there are still 3 fat32 partitions inside that extended partition) and copy back the partition info to the newly created partition, what changes do I make to boot (?), fstab or any other file to keep my system working? (I know I'll have to point grub at the new /boot location)

aus9 02-21-2005 01:24 AM

my poor grammar on concrete expression.

1) my suggestion is leave table alone for sizes so that its
|-01 /dev/hda1 fat32 (windows)
|-02 /dev/hda3 linux-swap 525MB BUT reformatted to ext2 or ext3 or reiserfs to become /boot
|-03 /dev/hda2 extended
| |
| |-04 /dev/hda5 fat32 (windows program files)
| |-05 /dev/hda6 fat32 (offline folder)
| |-06 /dev/hda7 fat32 (documents)

the above means no windows is lost so no images needed if you can't spare the cdrs.

btw partimage compresses to gunzip (gz) format one third of total data used.....not parition space.

then you delete with qtparted all the other logicals.......and create new ones.

the new ones you set the size "in concrete' as you would only change them by formatting them ok?

each new distro you try would need to have a /boot a / a /usr and maybe a /home all the rest goes into / and leave some space at the end roughly 3 times your ram unless you have 1G of ram or more the end of your disk.

yes you are right the speed of swap is faster on the outer edge....the left side....but if you have 1G I have yet to need swap.

I changed tactics when I realised your ms stuff was after the swap 02......and you don't have proof that qtparted and resize will not destroy any ms stuff.

I am a little puzzled by your can only have 4 primary and if you want more than 4 partitions one must become extended and logicals are numbered 5 and up.

so its
01 C
02 /boot
03 extended
05 prog
06 offline
07 dox

is that clearer?

your other question I was not going to initially answer in the first post......but now that you are asking....

with each new distro you use knoppix to format /boot / /home etc
then install then it should want to install a bootloader......

if you see my tutorial you can see that you can get into ms anytime with knoppix......if no grub in mbr by
root (hd0,0)
chainloader +1

and because you set in concrete your /boot partition is always 02 thats
root (hd0,1)
kernel /etc
initrd /etc.....if needed

obviously some mdk and suse can use grub and config ms stuff for you

Each /etc/fstab may have differences in the way they treat cdroms and floppy drives and udev/devfs but thats for you to find out?

lukeleia3 02-21-2005 01:38 AM

i go
1st partition mount point /swap 2x the size of ram
2nd partiion mount point / the rest of the disk all native linux and pile the data on

linmix 02-21-2005 10:44 AM


Originally posted by lukeleia3
i go
1st partition mount point /swap 2x the size of ram
2nd partiion mount point / the rest of the disk all native linux and pile the data on

Not if you wanna use windows!! Windows needs to be first, and at this point I can't afford to lose it (yet)

linmix 02-21-2005 10:56 AM


I'm puzzled by the numbers as well. How can my extended partition be hda2 if swap is before that and is hda3??

And if qtparted doesn't let me make the extended bigger, why would it once I delete some linux partitions.

01 C
02 /boot
03 extended
05 prog
06 offline
07 dox
is pretty accurate

Are you suggesting I use the same /boot for all distros?

jiml8 02-21-2005 01:17 PM

I have been reading this thread and am a bit confused by it. I strongly suspect you can do what you want to do, but I would like to see some different information before committing myself one way or the other.

Skip the parted output; it doesn't help.

Run fdisk -l and post the results. That'll tell where everything is physically located on the HD.

Also please specify how much of each partition is in use, particularly that great big Windows partition.


linmix 02-21-2005 03:31 PM

# /sbin/fdisk -l

Disk /dev/hda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 455 3654756 b W95 FAT32
/dev/hda2 523 8156 61320105 f W95 Ext'd (LBA)
/dev/hda3 456 522 538177+ 82 Linux swap
/dev/hda5 523 1436 7341673+ b W95 FAT32
/dev/hda6 1437 1697 2096451 b W95 FAT32
/dev/hda7 1698 5904 33792696 b W95 FAT32
/dev/hda8 7180 7183 32098+ 83 Linux
/dev/hda9 7184 8034 6835626 83 Linux
/dev/hda10 8035 8156 979933+ 83 Linux
/dev/hda11 5905 5917 104391 83 Linux
/dev/hda12 5918 6880 7735266 83 Linux
/dev/hda13 6881 7179 2401686 83 Linux

Partition table entries are not in disk order

used space:
/dev/hda1 1GB
/dev/hda5 3,5 GB
/dev/hda6 1,5GB
/dev/hda7 20GB
/dev/hda12 5,5GB
/dev/hda13 2GB

rest can be deleted (skipped boot, but that's really small, as usual)

jiml8 02-21-2005 06:30 PM

weird. I've never seen a drive labeled like this.

But changing it is certainly possible. hda2 is your extended partition; use parted to enlarge it to encompass the remainder of the drive. You should be able to use parted or one of the linux graphical tools to resize the extended partition after you have blown at least one partition off of the end of it. At least, I think so.

If you can't do it with parted, then try sfdisk. I think sfdisk will do the whole thing, but you had better read and understand the man page thoroughly.

You also could do it with lde or else use dd to copy the mbr, edit the mbr in a hex editor, then put it back. You will definitely want to avoid doing this if you can.

In the worst case if you can't redo the extended partition, you can define another primary partition since you have the room in your partition table. This will work fine and, given how funky your partition numbering already, is it really won't matter.

You have enough space in hda1 and in hda7 to gather up the contents of the partitions at the end of the drive, which will allow you to resize those partitions then reload them.

If I were you I would take the path of least resistance, by copying off the contents of hda8 hda9 and hda10 to images on hda1. I then would delete hda8, hda9, and hda10, and resize the extended partition to fill the drive if I could, and I would create a new primary partition if I couldn't.

Then I would resize hda13 to suit me, then recreate hda8 hda9 and hda10 in the remaining space - or, if I had created a new primary partition, I would recreate only two of those three in the remaining space. I would make one of those partitions a replacement for hda12 and would then copy the contents of hda12 onto it. Then I would restore one of the image files to hda12 and restore the other two, as appropriate, to the other two newly created partitions. I would then change fstab to accomodate the changed location of things, and keep on truckin'.

Really, I think fsdisk might prove the best choice for enlarging the extended partition. You need to be very careful, but if you properly construct the interactive dialog as described in the man pages you can just lay the whole thing right down - after, of course, you make the images of the partitions to be resized. If you are careful to back up all partition tables BEFORE making the changes, if you goof you will be able to put everything back.

linmix 02-22-2005 12:18 PM

I think I read somewhere but don't remember, will look, kow to back up the partuition table.

I'll wipe 8-10 without backup (was gonna lose them anyway) and then try again to use qtparted to resize the extended partition. Cross my fingers it'll let me this time). Hadn't thought of backing up 11-13 on my fat drives. Intersting idea.

What size is your /home directory (just to give me an idea on new partition size)

jiml8 02-22-2005 09:23 PM


I'll wipe 8-10 without backup (was gonna lose them anyway) and then try again to use qtparted to resize the extended partition. Cross my fingers it'll let me this time). Hadn't thought of backing up 11-13 on my fat drives. Intersting idea.
I have never tried to resize an extended partition with any of the parted variants. As I read the docs, it won't work.

sfdisk will certainly do it. sfdisk will do anything - and is very unforgiving of mistakes.

My /home is kind of scattered. My system has 4 users, and three never access the system except from the network. Their home directories are therefore small and /home shares a partition with / which is 10 gigs. Presently 5 gigs are in use.

My personal home directory was getting big. I didn't want to repartition, so I moved my personal directory to another drive and put a symlink into /home to point to it. That works fine. But as a consequence, my home directory and my vmware installation are jointly sharing a 15 Gig 15000 RPM Ultra-SCSI drive. The vmware installation takes about 5 gigs, including 2 copies of Win2K, one copy of WinNT, and a DOS installation. The remainder of the drive is occupied by my personal home directory and, because I got careless, I got the "drive is full" message a couple of days ago, which prompted me to scroll off a DVD worth of packages and misc stuff.

linmix 02-23-2005 10:30 AM

I had some trouble opening an mp3 file with audacity, so I changed it's temp file to 'fat32 dox' It turned out it neede a whooping big tmp file: 10GB!!. makes me wonder what to do with my partitioning.

I'm not very happy about having to use cfdisk, but I'll back-up, read-up and jump in the deep end - that's taught me a lot so far!

Thanks for the info. I'll be screaming HELP if I run into any further peoblems ;)

All times are GMT -5. The time now is 08:52 PM.