Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Oh boy this is a qustion and a half.

Simply put when i set up the server it wasn't intended to be used for what it is now, and root (/) has run out of diskspace, while /home has tonnes of the stuff floating around.

Filesystem           1K-blocks      Used Available Use% Mounted on
rootfs                10157944   9600344     45656 100% /
/dev/root             10157944   9600344     45656 100% /
/dev                   8183468         8   8183460   1% /dev
none                   1636756       252   1636504   1% /run
none                      5120         0      5120   0% /run/lock
none                   8183772         0   8183772   0% /run/shm
/dev/md3             211225328  17996836 182583336   9% /home

LESSON LEARNED! (give / more room next time...)

Here's the output from parted showing the disks and their current sizes, and the RAID array.

Model: ATA INTEL SSDSA2CW12 (scsi)
Disk /dev/sda: 120GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type     File system     Flags
 1      2097kB  10.5GB  10.5GB  primary  ext4            boot, raid
 2      10.5GB  11.0GB  535MB   primary  linux-swap(v1)
 3      11.0GB  120GB   109GB   primary                  raid


Model: ATA INTEL SSDSA2CW12 (scsi)
Disk /dev/sdb: 120GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type     File system     Flags
 1      2097kB  10.5GB  10.5GB  primary  ext4            raid
 2      10.5GB  11.0GB  535MB   primary  linux-swap(v1)
 3      11.0GB  120GB   109GB   primary                  raid


Model: Linux Software RAID Array (md)
Disk /dev/md3: 218GB
Sector size (logical/physical): 512B/512B
Partition Table: loop

Number  Start  End    Size   File system  Flags
 1      0.00B  218GB  218GB  ext4


Model: Linux Software RAID Array (md)
Disk /dev/md1: 10.5GB
Sector size (logical/physical): 512B/512B
Partition Table: loop

Number  Start  End     Size    File system  Flags
 1      0.00B  10.5GB  10.5GB  ext4

What i need to do is shrink the /home partition by 40GB and increase the / partition by 40GB. Parted told me when i used the resize command that:

"WARNING: you are attempting to use parted to operate on (resize) a file system.
parted's file system manipulation code is not as robust as what you'll find in
dedicated, file-system-specific packages like e2fsprogs.  We recommend
you use parted only to manipulate partition tables, whenever possible.
Support for performing most operations on most types of file systems
will be removed in an upcoming release."

and looking up e2fsprogs tells me they are ext2 tools, which scares the hell out of me considering the disks are EXT4.

Is there a safe way to resize the partitions? I'm working on this 600miles away from the server by SSH with no direct access.

Thanks in Advance!

Andrew "Laice" Faulkner

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Ext2, ext3 and ext4 are evolutions of the same filesystem; in fact an ext4 filesystem with none of the newer features activated is an ext3 filesystem, and an ext3 filesystem with none of the newer features activated is an ext2 filesystem. That's why there's no separate set of programs for ext3 and ext4: it's the same set of tools, e2fsprogs, that's been gradually enhanced to cope with ext3 and ext4.

A limitation of resize2fs (“ext2/ext3/ext4 file system resizer”) is that it can shrink a filesystem only while it's unmounted. So if you want to shrink /home, you'll need to unmount it first. You can enlarge a mounted filesystem, that won't be a problem for /.

Your bigger problem will be resizing the RAID-0 array. The one tool to manage RAID arrays is mdadm. As far as I know, it's not possible to resize a RAID-0 array.

As far as I can see, you're stuck with this configuration unless you're willing to copy all the data off /home and / for the duration of the maintenance. (You could get away with copying only the data off /home and creating a larger root partition encroaching on its space.) You could use that unpartitioned space at the beginning of the disk to store the current contents of /home. This is not very difficult, but it is error-prone. That's not something I'd attempt without physical access (it's especially easy to screw up the bootloader when you're shuffling the root partition around). Your lack of familiarity with the tools makes it all the more likely that you'll make a tiny mistake that's easily fixed but only by inserting a boot CD.

My recommendation would be to move a large chunk of / to /home and create a symbolic link, until such time as someone can attend that server physically.

For the future, I recommend not using md-RAID's RAID-0 and using LVM stripping instead. LVM volumes can be resized, even stripped volumes. LVM is slightly slower here, but easier to manage (as the issue you're having now illustrates). Use RAID for mirroring (RAID-1) and for other RAID modes.

Also, should you decide to stick to RAID-0 for that 5% performance boost, it would have been easier if you'd had a single RAID-0 array.

share|improve this answer
    
Thankyou for your response. We've performed a remote reinstall now and taken all this into account :) –  Laice Nov 8 '11 at 3:58

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.