PDA

View Full Version : Can I Expand The Size of a Partition?



JonBL
29th August 2011, 11:42 AM
When partitioning disk devices for F14 on my new x86-64 box, I allocated 100G for / mounted on /dev/sda1. It's now 100% full. I have 365G free space available on the disk. Can I somehow extend /dev/sda1 to use some of this free space?

TIA,
Jon

sea
29th August 2011, 11:54 AM
1st) of this, i'd have to ask, have you defined /boot and /home as diffrent partitions, or are they all at the same mount point?
2nd) using (for example) Disk utility (system tools) you could simply ADD new partitions
3rd) To expand a current partition, you most likley will need a CLI like gdisk. I'm not aware of GUI tools to do so.

to 1) If you have them all at the same mount point, i'd suggest you make an exta /home (lv_home), copy all files to it and set its mount point to /home. Either in fstab or disk utility, rename the 'old' /home
Afterwards, when you made sure that the new partition is automounted to /home, you can rename /remove the old /home_old.
Beside, same goes for any swap partition if you have it.

However, dont do anything without having done a backup.
As soon one is doing/playing around with partititions, its important to have recent uptodate backups, regardless of one skill level.

Dangermouse
29th August 2011, 12:11 PM
If i remember correctly Yes, i think gparted (in repos) can do that in a simple gui just move the slider along, but i havent done this in years so back up etc...

bodhi.zazen
29th August 2011, 05:29 PM
When partitioning disk devices for F14 on my new x86-64 box, I allocated 100G for / mounted on /dev/sda1. It's now 100% full. I have 365G free space available on the disk. Can I somehow extend /dev/sda1 to use some of this free space?

TIA,
Jon

Yes you can do this, but it depends on if you are using LVM or not.

If you are not using LVM, you can do it with gparted from a live CD. You may well have to do it in steps or stages depending on where your free space is located.

If you are using LVM, add another physical volume (partition) to you LVM.

Gareth Jones
29th August 2011, 05:45 PM
When partitioning disk devices for F14 on my new x86-64 box, I allocated 100G for / mounted on /dev/sda1. It's now 100% full. I have 365G free space available on the disk. Can I somehow extend /dev/sda1 to use some of this free space?

The best way to do this depends on how your volumes and filesystems are set up. Note that the size of the filesystem is determined by its internal data structures and is controlled distinctly from the size of the containing volume.

As others have said, it is usually a good idea to have / and /home on separate partitions.

As for resizing, if you are using LVM then adding a new physical volume (i.e. a new partition) to the volume group and expanding the appropriate logical volume into the new space would be the way to go. If you are mounting /dev/sda1 directly on /, then LVM isn't being used. You can only expand the primary partition sda1 as long as there is free space immediately after it.

If the free space is directly after it, then using GParted to enlarge both the partition and it's contained filesystem is the easiest way. From the command line, you would have to use cfdisk or similar to delete the original partition and create a new larger one starting at the same sector. Then, assuming that you're using ext4fs, resize2fs will let you enlarge the filesystem to use the larger partition.

Resizing the / filesystem is complicated by the fact that you cannot safely use user-space tools to modify a mounted filesystem. There is a bootable GParted CD image available that you could use to get around this.

Backups are a good plan, although expanding a filesystem is relatively safe. You should run fsck before and after resizing though.

Gareth

JonBL
29th August 2011, 11:28 PM
Thanks everyone, for your advice. I've just re-booted this morning, and /dev/sda1 mounted on / is now only 4% used! No idea what's going on, here. I'm looking at the output of df -h from last night - saved it to a file - and it definately says /dev/sda1 was 100% used. :confused:

For the record, I'm using simple ext4 partitions, not LVM. I'll leave things alone for the time being, but next time I rebuild, I'll set up a partition for /home, as suggested.

Regards,
Jon

Gareth Jones
30th August 2011, 03:10 AM
Thanks everyone, for your advice. I've just re-booted this morning, and /dev/sda1 mounted on / is now only 4% used! No idea what's going on, here. I'm looking at the output of df -h from last night - saved it to a file - and it definately says /dev/sda1 was 100% used. :confused:

Had the system been running for a long time at that point? The only thing I can think of is if some misbehaving program was using a ridiculous amount of space in /tmp (or possibly /home), but 100 GB would be quite extreme.

Gareth

JonBL
30th August 2011, 04:27 AM
The box had been up for a while, and I had been trying to install Google Earth (no install errors, but app doesn't start - but that's another story). I don't know whether this was causing the problems, or not. I did note that Firefox would not save bookmarks at the time.

Anyway, /dev/sda1 (mounted on /) is at 6% - 5Gb used. This sounds about right for a F14 Graphics Desktop install, plus a small amount of /home data.

I'll put this one down to cosmic rays in the lack of a better explanation...

Regards,
Jon