Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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

On my CentOS 5 server, fdisk -l outputs:

Disk /dev/xvda: 100.0 GB, 100000595968 bytes
255 heads, 63 sectors/track, 12157 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot      Start         End      Blocks   Id  System
/dev/xvda1               1         487     3911796   83  Linux
/dev/xvda2             488         731     1959930   82  Linux swap / Solaris
/dev/xvda3             732       12157    91779345   8e  Linux LVM

and df -h outputs:

Filesystem            Size  Used Avail Use% Mounted on
/dev/xvda1            3.7G  1.4G  2.4G  37% /
/dev/mapper/vg00-usr  4.0G  4.0G   20K 100% /usr
/dev/mapper/vg00-var  4.0G  440M  3.6G  11% /var
/dev/mapper/vg00-home 4.0G  269M  3.8G   7% /home
none                  512M  1.4M  511M   1% /tmp
tmpfs                 512M     0  512M   0% /usr/local/psa/handlers/before-local
tmpfs                 512M     0  512M   0% /usr/local/psa/handlers/before-queue
tmpfs                 512M     0  512M   0% /usr/local/psa/handlers/before-remote
tmpfs                 512M   16K  512M   1% /usr/local/psa/handlers/info
tmpfs                 512M     0  512M   0% /usr/local/psa/handlers/before-local
tmpfs                 512M     0  512M   0% /usr/local/psa/handlers/before-queue
tmpfs                 512M     0  512M   0% /usr/local/psa/handlers/before-remote
tmpfs                 512M   16K  512M   1% /usr/local/psa/handlers/info
tmpfs                 512M     0  512M   0% /usr/local/psa/handlers/spool

My /usr drive doesn't have any free space, but fdisk shows 100GB of unused space. Can I use that space to increase the capacity of the /usr directory? How? And how can I remove unwanted files from /usr?

share|improve this question

migrated from stackoverflow.com Sep 13 '11 at 10:16

This question came from our site for professional and enthusiast programmers.

fdisk is saying your disk is 100gb in size, not 100gb is free. Is this machine a virtual machine guest ? xvda tends to suggest it is. If so you can add anouther xen disk volume to the machine – Sirex Sep 13 '11 at 12:28
on re-reading, i may have misunderstood "space" to imply "free space". -- what does lvs and pvs give ? you should be able to expand the /dev/mapper/vg00-usr logical volume if you have some space space with lvextend – Sirex Sep 13 '11 at 12:31
up vote 4 down vote accepted

First of all you need to see if you have any available pe's in your volume group (in this case vg00). Check the output of

vgdisplay vg00

Then, assuming you have some PE (Physical Extent)s free, you can extend the /usr volume,

lvextend -L +<x-amount>G /dev/vg00/usr

after that you need to resize your filesystem to reflect the new size of this "partition":

resize2fs /dev/vg00/usr

assuming it is ext{3,4}.

If you have no PE's available, you could consider either to shrink another volume in the same group (like home in this case), or add another PV. Regardless, note that the fact you have a partition that's 100GB in size does not mean you have access to 100GB. Since it is a physical volume used for LVM it only means you have 100GB worth of PE's.

share|improve this answer
thanks for the help. Thats it! – Astha Sep 14 '11 at 6:54
Great answer :) However, you may need to use resize4fs instead of resize2fs if your partition filesystem is ext4 (check in /etc/fstab file if necessary), otherwise you may get an error Filesystem has unsupported feature(s) while trying to open x/y/z, see systemadmin.es/2010/09/… – Frosty Z Nov 20 '12 at 14:04

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.