linux - lv root drive full, how to extend partition? (centos)

08
2014-07
  • user3265051

    my lv_root drive is full, i believe its 50gigs, i could not find an option to extend it when i installed centos..

    i have installed a second drive where I have my /var/www which mounted fine

    How can I increase/dev/mapper/vg_mycentos-lv_root parition without crashing my server? I cany do any more backups because i have no other disks left to back up (i live in very poor country) thank you in advance, i searched the issue a lot on here and each setup seems different and i dont want to crash the server deleting stuff Im not suppose to.

    below is df results:

    enter code here [root@mycentos ~]# df

    Filesystem                     1K-blocks      Used Available Use% Mounted on
    /dev/mapper/vg_mycentos-lv_root  51606140  51589756         0 100% /
    tmpfs                            1943564        68   1943496   1% /dev/shm
    /dev/sda1                         495844    125974    344270  27% /boot
    /dev/mapper/vg_mycentos-lv_home 905319440  80408528 778923280  10% /home
    /dev/sdb1                      961432232 221911100 690683124  25% /var/www
    
  • Answers
  • davidgo

    One way you could do this (assuming you don't have any unused space) would be to shrink /home and allocated it to /

    Shrinking a logical volume is harder then growing it (because of the filesystem), so you would want to back up first. You may be able to get away with the command "lvreduce --resizefs --size -100G /dev/mapper/vg_mycentos-lv_home to "free up" 100 gigs of space for the lvm. If this works, you can then grow the root lvm as follows:

    lvextend -L+100G /dev/mapper/vg_mycentos-lv_root to extend the LV by 100 gigs, then resize4fs /dev/mapper/vg_mycentos-lv_root to grow the filesystem (this can be done online. Note that some OS's use resize2fs to resize ext4 partitions, so you might need to use that instead. This all assumes you are using EXT4 volumes - a reasonable, but not guaranteed assumption.

    If you need to use /dev/sdb - you are going to need to:

    1. Copy /var/www to (for example) /home/var/www
    2. unmount /var/www
    3. Allocate /dev/sdb1 to the lvm (Something like pvcreate /dev/sdb1)
    4. Allocate the resource to the volume group (vgextend vg_mycentos /dev/sdb1)
    5. Use lvextend and resize2fs as above to grow the root partition.
    6. Move /home/var/www to /var/www (which is now in the LVM root partition)

    You could - if you really wanted to - create another partition for /var/www and mount that using fstab rather then go through step 6.


  • Related Question

    Fedora Linux Disk Usage Analyzer falsely reports root at 100% full
  • jlego

    I've got a box setup with Fedora 16 that I'm currently using for a small home server.

    I was having some issues with samba sharing when I ran the disk usage analyzer and found that while I have a total of 5.9TB of total space (including external media disks) and only 853GB are being used, the root folder is still being reported as 100% full. It shows that the external media is taking up the majority of space.

    disk usage analyzer falsely reports root as 100% full fedora linux

    I'm trying use the 3TB WD My Book for backups using Deja Dup, but anytime I try a backup, it throws and error saying I do not have enough disk space, which is not true, as less than 400GB worth of files are being backed up and the disk properties window reports that there are 2.8TB of space still free on the drive, which seems to contradict the disk usage analyzer's calculation of that drive being 60% full.

    enter image description here

    I've recently moved a lot of files around between the external and internal drives in order to reformat them and organize them into proper samba shares. I've emptied the trash and deleted trash folders off of the external drives. I've also run yum clean all. I've also got another problem where an iMac on the network can connect to the shares but cannot open them with an error that the files are in use by another user on the network, and I'm wondering if this problem with the disk usage is related or even causing that problem.

    I've looked around on google and a somewhat common culprit identified as causing this problem has to do with inodes, but I'm not sure what that is or how to fix it.

    This Question may be similar to my problem, but he does not elaborate on his answer very well.

    Output of the df -h command as requested:

    Filesystem                            Size  Used Avail Use% Mounted on
    rootfs                                 50G  4.9G   45G  10% /
    devtmpfs                              1.6G     0  1.6G   0% /dev
    tmpfs                                 1.7G  560K  1.7G   1% /dev/shm
    /dev/mapper/vg_tangentserver-lv_root   50G  4.9G   45G  10% /
    tmpfs                                 1.7G   42M  1.6G   3% /run
    tmpfs                                 1.7G     0  1.7G   0% /sys/fs/cgroup
    tmpfs                                 1.7G     0  1.7G   0% /media
    /dev/sdd2                             497M   95M  378M  20% /boot
    /dev/mapper/vg_tangentserver-lv_home  243G  229G  1.6G 100% /home
    /dev/sdb1                             466G   27M  466G   1% /media/VERBATIM
    /dev/sdc1                             917G   88G  783G  11% /media/SEAGATE
    /dev/sde1                             2.8T  391G  2.4T  14% /media/WD My Book
    /dev/sdk1                             917G  136G  736G  16% /media/LACIE
    /dev/sda1                             147G  147M  140G   1% /media/MAXTOR
    

  • Related Answers
    Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.