Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I fear I already know the answer to this question, but here goes.

I need to carve out a new partition on a running system. /var/ is mounted from an LVM volume (hdd1_vg-var) and has only 3% used disk space.

/ is mounted separately (hdd1_vg-root) and has about 80% used disk space.

Filesystem            Size  Used Avail Use% Mounted on
                      2.0G  1.4G  481M  75% /
                       33G  699M   31G   3% /var

Unfortunately I don't have any free extents to grow this partition organically - vgdisplay shows:

  Total PE              10000
  Alloc PE / Size       10000 / 39.06 GB
  Free  PE / Size       0 / 0

So seeing that I have all this free disk space on /var/, can I shrink /var/ without un-mounting it or is this just a pipe dream?

I am really hoping to be able to do this work on a running system - un-mounting would of course not be difficult but it would interfere with system functionality.

share|improve this question
Shrinking a mounted filesystem (assuming extX) is not possible. If you want to get kludgy, to use the space under /var elsewhewre, you can create directories under /var and then symlink to them. – Mark Wagner Oct 22 '13 at 17:36

As fas as I know, C6 doesn't support shrinking mounted file systems; the following is from man resize2fs:

   The resize2fs program will resize ext2, ext3, or ext4 file systems.  It
   can  be  used  to enlarge or shrink an unmounted file system located on
   device.  If the filesystem is mounted, it can be  used  to  expand  the
   size  of  the  mounted filesystem, assuming the kernel supports on-line

But you should be OK as long as you're prepared to have a little downtime. If the system is booted single-user, you should be fine to unmount /var, and it won't take long to shrink the FS and underlying LV.

share|improve this answer
Right - the 'little' downtime is what I'm concerned about. – javanix Oct 22 '13 at 14:57
Yes, your edit (published after my answer) makes that clear. I think you're out of luck, then; online resizing is expand-only. – MadHatter Oct 22 '13 at 14:58

Yes, you can shrink/move/grow an online root partition without any reboots (nor livecd, nor usbkey): consult this answer. It's very well written and easy to follow, although quite long and a little risky.

This allows to bypass limitation of resize2fs not being able to shrink ext4 partitions.

Of course, if you only want to grow your ext4 partition, you can stick to the conventional working resize2fs solutions.

The general solution I've lnked will work on any type of dedicated or VPS solution for instance.

TLDR; this solution implies to pivot_root to tmpfs so you can umount safely your root partition live and fiddle with it. Once done, you'll pivot_root back on your new root partition.

This allows pretty much any manipulation on the root file system (move it, change filesystem, changing it's physical device...).

I have personally used this, and it works very well on debian system also, but the guide was initially written in 2007 for redhat, the answer I've linked was updated for CentOS7. It's highly probable that it'll work on your CentOS6.

share|improve this answer

Your Answer


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.