Using LVM, how can I tell which logical volume is near full?

15,190

From the data you provided, the size of your logical volumes is as follows:

partition : size : filesystem size

/dev/nvaws/home : 60 : 60

/dev/nvaws/usr : 40 : 20

/dev/nvaws/db : 5: 5

this looks ok, although you can extend your /usr filesystem if you need, to fill the lv.

the area that is causing the errors is none of the logical volumes but your root partition, which is the / directory (raid device md0)

This is 5.7gb in size (see first line of output of df command), and is 94% full. The / partition contains kernel files for booting (in /boot), config files (in /etc) and various log files in /var.

You must extend this / partition or reduce the usage - You must either extend this partition, or run tools to discover if there is anything than can be safely removed. I would start with removing old kernel files no longer required since these can be rather large (use ubuntu tweak application to do this), and also check size of logfiles in /var by running du -ksh /var/*

You may have lots of package files lying around as a result of software centre downloads. Ubuntu tweak - package cleaner will also help with clearing the cache.

Share:
15,190

Related videos on Youtube

nathanvda
Author by

nathanvda

Updated on September 17, 2022

Comments

  • nathanvda
    nathanvda over 1 year

    I am getting errors that my disk is nearly full, but i am using three logical volumes, and would need to know which i need to extend. I still have 50GB unassigned.

    Up until now i always extend all logical volumes together, but now i wanted to really only extend the needed volume.

    [EDIT: output from the asked commands]

    11:58:27|nva@nvaws[~] > df
    Filesystem           1K-blocks      Used Available Use% Mounted on
    /dev/md0               5766196   5094104    379180  94% /
    none                   1800512       264   1800248   1% /dev
    none                   1806624       768   1805856   1% /dev/shm
    none                   1806624       112   1806512   1% /var/run
    none                   1806624         0   1806624   0% /var/lock
    /dev/mapper/nvaws-db   5160576   1971944   2926488  41% /var/lib/postgresql
    /dev/mapper/nvaws-usr
                          19223252   4957612  13289156  28% /usr
    /dev/mapper/nvaws-home
                          61929340  29253760  29534180  50% /home
    11:58:32|nva@nvaws[~] > 
    12:01:13|nva@nvaws[~] > sudo vgdisplay
      --- Volume group ---
      VG Name               nvaws
      System ID             
      Format                lvm2
      Metadata Areas        1
      Metadata Sequence No  8
      VG Access             read/write
      VG Status             resizable
      MAX LV                0
      Cur LV                3
      Open LV               3
      Max PV                0
      Cur PV                1
      Act PV                1
      VG Size               145.93 GiB
      PE Size               4.00 MiB
      Total PE              37359
      Alloc PE / Size       26880 / 105.00 GiB
      Free  PE / Size       10479 / 40.93 GiB
      VG UUID               BBudpK-uLAo-ttes-g2ll-8jyI-xh74-J7xN8n
    
    12:01:35|nva@nvaws[~] > sudo lvdisplay
      --- Logical volume ---
      LV Name                /dev/nvaws/home
      VG Name                nvaws
      LV UUID                bB5jZc-1jeP-Eptl-WKzi-20C1-1FCB-2EWm3p
      LV Write Access        read/write
      LV Status              available
      # open                 1
      LV Size                60.00 GiB
      Current LE             15360
      Segments               4
      Allocation             inherit
      Read ahead sectors     auto
      - currently set to     256
      Block device           252:0
    
      --- Logical volume ---
      LV Name                /dev/nvaws/usr
      VG Name                nvaws
      LV UUID                5XtAi2-Vwqo-ieHj-NrG5-jNbk-cE5z-35aHyj
      LV Write Access        read/write
      LV Status              available
      # open                 1
      LV Size                40.00 GiB
      Current LE             10240
      Segments               2
      Allocation             inherit
      Read ahead sectors     auto
      - currently set to     256
      Block device           252:1
    
      --- Logical volume ---
      LV Name                /dev/nvaws/db
      VG Name                nvaws
      LV UUID                ahxV6P-vpjY-aRAw-bhcZ-oPGZ-2y9x-zhjlp5
      LV Write Access        read/write
      LV Status              available
      # open                 1
      LV Size                5.00 GiB
      Current LE             1280
      Segments               1
      Allocation             inherit
      Read ahead sectors     auto
      - currently set to     256
      Block device           252:2
    
    12:01:50|nva@nvaws[~] > 
    12:02:03|nva@nvaws[~] > sudo pvdisplay
      --- Physical volume ---
      PV Name               /dev/md1
      VG Name               nvaws
      PV Size               145.93 GiB / not usable 960.00 KiB
      Allocatable           yes 
      PE Size               4.00 MiB
      Total PE              37359
      Free PE               10479
      Allocated PE          26880
      PV UUID               cTYM85-ad2e-60i4-Pze5-9GXO-T4PC-DR7g9r
    
    12:02:06|nva@nvaws[~] > 
    

    I hope you guys can make more of that than i can :)

    One remark: i extended the home logical volume yesterday, and added 10GB. It seemed the most likely candidate. SO i guess that will show itself.

    • Simon B
      Simon B over 13 years
      have you tried using system-config-lvm graphical LVM manager? installable from software centre.
    • nathanvda
      nathanvda over 13 years
      I had never heard of it. It does not seem to help me though. I can't see how the logical volumes are used (free space per volume). But i am using a raid as well, so in that case they advise not to use it.
    • Zoredache
      Zoredache over 13 years
      I am a bit confused. Why can't you just run df and see which volume is nearly full?
    • Simon B
      Simon B over 13 years
      can you provide more information: it is unsure where the 50gb is unassigned and what is full - disk or partition or logvol: can you provide output of df , and run the following commands as root, pvdisplay; lvdisplay; vgdisplay. also clarify the raid situation - if software raid then provide output of cat /proc/mdstat
    • XTL
      XTL over 11 years
      Volumes don't get full. Filesystems get full. Volume groups may also get full. LVM doesn't concern itself with filesystems, mostly. Use df to see filesystem usage and vgs to see vg usage.