Advanced

Expanding A Root-FS

Posted by falko on · 9 comments
HowtoForge; By Gerd Bitzer
Mail this story
Print this story

There might be the situation, that your root filesystem runs out of space, so it has to be expanded. With filesystems other than the root filesystem this could easily be done for instance with gparted. With the root filesystem this is not possible, as gparted could only expand filesystems that are not mounted, which is impossible with the root filesystem. The only way to enlarge the root filesystem is to boot from a kind of rescuesystem, Live-CD or the like, and then to expand the root filesystem. The following tutorial describes, how this is achieved by using Systemrescue-CD.

There might be the situation, that your root filesystem runs out of space, so it has to be expanded. With filesystems other than the root filesystem this could easily be done for instance with gparted. With the root filesystem this is not possible, as gparted could only expand filesystems that are not mounted, which is impossible with the root filesystem. The only way to enlarge the root filesystem is to boot from a kind of rescuesystem, Live-CD or the like, and then to expand the root filesystem. The following tutorial describes, how this is achieved by using Systemrescue-CD.

http://www.howtoforge.com/expanding-a-root-fs

Full Story

  Nav
» Read more about: Story Type: Tutorial; Groups: Linux

» Get new stories by e-mail: nightly or as they are published

« Return to the newswire homepage

Comments (9)

If using ReiserFS on LVM, you can expand the file system hot, without unmounting. Just expand the LV with lvresize, then run resize_reiserfs, and it is done, no unmounting needed. This is the reason I have not moved to EXT3 or 4. I can expand file systems without unmounting. I only need to take the system down to add drives, and that is just a simple reboot.
Eh? You can grow ext2, ext3 and ext4 online since kernel 2.6.7. IIRC you just can't shrink them online.
I have tried. It always complains that you cannot modify a mounted file system. I am on 2.6.30. Go try it, and let me know. Maybe there is a newer version of the EXT FS Tools. or something. I am on Debian Squeeze.
@amadensor: I don't have any filesystems I can resize at the moment. But the resize2fs manpage on Squeeze says this:

Quoting:If the filesystem is mounted, it can be used to expand the size of the mounted filesystem, assuming the kernel supports on-line resizing. (As of this writing, the Linux 2.6 kernel supports on-line resize for filesystems mounted using ext3 only.).


So, it's only ext3 and not ext2/4 as I said in my previous post. It should work (it will generate a warning saying the filesystem is mounted and that online resizing is required. It should work. If it does not, it's a bug in Squeeze.
On the other hand XFS support online resize *only* :)
XFS prefers to use a copy-and-examine mechanism that works in online filesystems only.
jezuch: "Online grow" would be more correct. XFS cannot be shrunk.
Just tested this on

2.6.28-gentoo-r5 #5 SMP GNU/Linux

on a 100M ext3-filesystem and it seems to work:

#mount -l /dev/mapper/vg0-testlv on /mnt/tmp type ext3 (rw)

#lvextend /dev/vg0/testlv -L+10M

#resize2fs /dev/vg0/testlv

resize2fs 1.41.9 (22-Aug-2009) Filesystem at /dev/vg0/testlv is mounted on /mnt/tmp; on-line resizing required old desc_blocks = 1, new_desc_blocks = 1 Performing an on-line resize of /dev/vg0/testlv to 114688 (1k) blocks. The filesystem on /dev/vg0/testlv is now 114688 blocks long.
Also works for ext4.

Post a comment

A free account is needed to post. Write your comment here first: your text is kept in this browser while you sign up or log in, and is waiting for you when you come back.

Your message:
|||||
10
Markdown: **bold**, *italic*, [text](https://link), - lists, > quotes, $x^2$ for math. Formatting help

Sign up and post (it is free)  or  Log in and post