Resizing an EXT3 partition

Associate
Joined
19 Jun 2003
Posts
1,680
Location
West Yorks, UK
Hi all,
I have a server that has an Adaptec RAID controller in it, running a RAID-5 array. It had 3 x 500GB disks in, and i've added a 4th disk to give 1.5TB of storage.

I've expanded the disk with the Adaptec Storage Manager, but now need to expand my partition within Ubuntu 7.04. My disk looks like this:
Code:
Disk /dev/sdb: 1499.8 GB, 1499872624640 bytes
255 heads, 63 sectors/track, 182349 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1      121565   976470831   83  Linux

What do I need to do to safely resize the partition, without losing data? I know about resize2fs but i'm unclear as to what steps i should follow to make the process safe. Any help would be greatly appreciated.

Cheers,
Matt
 
I usually do this by :

1) sfdisk -d /dev/sdb > BACKUP :)
2) deleting the partition, and recreating it using the new space, making sure it's from the same start sector and is at least as big as before.
3) running resize2fs on the partition - it should grow to fill the partition size (on recent kernels, the filesystem can be mounted while you do this)

If you can possibly do these steps with the filesystem in the partition not mounted - probably best if you do, but I've never had a problem resizing ext3 online myself, since the kernel has had support.

You may find (g)parted easier to use, but it has flat-out refused to resize quite a few filesystems in my experience.

You might want to check out LVM2 if you setup more machines and want to do filesystem resizing - it eliminates the pain of partitioning, with LVM2 this would become : pvresize /dev/sda2 ; lvextend -L+500G /dev/vg/lv ; resize2fs /dev/vg/lv
 
Last edited:
Thanks for the advice. Couple more questions:

1) Is an LVM still useful when there is only 1 disk in use (well, 1 big array i mean)? I've used it to create a big blob of storage with 4 seperate drives and it was great

2) I'm guessing that my volume will need umount'ing before it is resized using Gparted. Any ideas on how long it might take to resize from 1TB to 1.5TB? Need to think how i schedule the job in

Cheers,
Matt
 
1) Is an LVM still useful when there is only 1 disk in use (well, 1 big array i mean)? I've used it to create a big blob of storage with 4 seperate drives and it was great
Absolutely, it frees you from a lot of restrictions which partitioning enforces on you - like the number of partitions and how they are layout on the disk. Only with LVM2 can you move a running system from one disk (well, any block device) to another (even across a network) whilst the system is running, and removing the former device :)

2) I'm guessing that my volume will need umount'ing before it is resized using Gparted. Any ideas on how long it might take to resize from 1TB to 1.5TB? Need to think how i schedule the job in
I've never had an ext3 filesystem expansion to take longer than about 40 seconds (similar sort of sizes as yourself), usually the time it takes to write new redundant superblocks. XFS is even faster because it is extent-based.

Using resize2fs to reduce a filesystem can take a LOT longer since it may have to relocate the files from the end of the filesystem to a place nearer the beginning. It'd typically take up to 2 * speed(MB/sec) * size_difference(MB) seconds, as a worst case, to do the job in that case.
 
matja, thanks for your reply. That gives me all the info I need. I can't setup the LVM2 just yet, but will bear it in mind for the future. Thanks again.

Matt
 
Humm strange. I've installed and loaded GParted, but it only shows the disk as being 1TB - ie., it isn't recognising the extra space given by the Adaptec RAID card. Do I have to look at editing stuff in FDisk to get the space in there? If so, what do i need to change?

Thanks again for any help.

Matt
 
Back
Top Bottom