Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm new to LVM and have been very confused by this:

I am transfering a large file to a partition that I thought had about 1.5 terabytes of space on it. Near the end of the transfer, rsync exits with an error claiming that the partition is full. I investigate and find the following:

$ sudo lvm lvs
  LV        VG     Attr   LSize   Origin Snap%  Move Log Copy%  Convert
  home      system -wi-ao  97.66G                                      
  log       system -wi-ao  48.81G                                      
  log.audit system -wi-ao   9.75G                                      
  root      system -wi-ao 341.59G                                      
  swap      system -wi-ao   4.88G                                      
  temp      system -wi-ao  97.66G                                      
  var       system -wi-ao   1.46T  

This seems to imply that /var (the partition that I'm transfering to, has the amount of storage I expect. However, then I see:

$ sudo df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/system-root
                      331G  1.3G  313G   1% /
/dev/mapper/system-temp
                       95G  188M   90G   1% /tmp
/dev/mapper/system-var
                       95G   90G     0 100% /var
/dev/mapper/system-home
                       95G  188M   90G   1% /home
/dev/mapper/system-log
                       48G  264M   45G   1% /var/log
/dev/mapper/system-log.audit
                      9.5G  340M  8.7G   4% /var/log/audit
/dev/sda1              99M   25M   70M  26% /boot
tmpfs                 8.0G     0  8.0G   0% /dev/shm

I'm guessing this has something to do with the volume being resized at some point. While I have reliable backups, I'd rather not interrupt services for the time it will take to get the backup and restore. Thus, is there anyway to make the filesystem seen by the OS match the space available according to lvm without losing data?

share|improve this question
    
Just so everyone knows, I think I have the solution to this, but want to try it out before posting it as a solution and it will likely take a while. I didn't find a source online that inspired confidence, but since I have backups I figured I might as well just take a shot. If somebody else write a well-written answer that works, I will refrain from posting my own answer. –  Steven D Sep 27 '10 at 21:05

1 Answer 1

up vote 6 down vote accepted

If this is an ext3 filesystem, you can extend it to the LV size by running:

resize2fs /dev/system/var

If this anything else than ext3, use the appropriate tool, e.g. xfs_growfs /var if it's XFS.

This is absolutely nothing to be afraid of. I have extended hundreds of filesystems in more than 10 years on several operating systems and I have never seen the operation leading to a disruption of any kind.

share|improve this answer
    
s/ext3/ext2, 3 or 4/. –  glglgl Sep 21 '11 at 14:12
    
oh, it was a quite old answer :-) hope that doesn't matter... –  glglgl Sep 21 '11 at 14:12

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.