Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
/dev/**/hdd1_vg-root
                      2.0G  1.4G  481M  75% /
/dev/**/hdd1_vg-var
                       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

1 Answer 1

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
   resizing.

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
1  
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

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.