/dev/mapper/VolGroup-lv_root has no more space left?

45,535

Solution 1

The easiest and fastest option is to create a directory in /home and move all data of /var to that directory and create soft link of /var to /home/var. The steps will be as follows.

  1. mkdir /home/var

  2. stop all the services. For example /etc/init.d/mysqld stop

  3. cp -pr /var/* /home/var

  4. rm -rf /var

  5. ln -s /home/var /var

  6. start the services again.

Note: May you can only move mysql data which is on /var/lib/mysql and create softlink to that.

Solution 2

I would suggest, as the first first, to check the size of /var/log. Possibly archive older logs. They can clog up you root partition without you noticing, and most older logs might not be necessary.

Solution 3

You can :

  1. Add hard disk

  2. Move mysql DB files to other FS (in your case you have just /home FS left )

  3. You can resize your LVM volume to make /home smaller and / bigger (be sure to have backup of course :) )

This option is most straight forward, but LVM strongly recommend to backup your data before resizing

http://www.ibm.com/developerworks/linux/library/l-resizing-partitions-2/index.html

UPDATE (based on comment)

if I add hard disk what must I adjust on my mysql setting to expand the data to the hard disk? If option to mean I have to move mysql over what steps need to be taken for that?

Quite easy:

  1. Stop mysql
  2. Open /etc/my.cnf and find datadir= - here are your mysql datafiles
  3. Copy/Move them over to your new desired location
  4. Update datadir= with your new path
  5. Start Mysql
  6. Take a beer or whatever you want, cause you are done

How tough to expand the /root?

Read the link above which I already posted.Step by step guide is included there with comprehensive explanation.

Normally what the home partition is to store? Any important files?

It contain user files and setting.Eg your desktop etc.

For system healt /home is not important and can be remounted anytime.

Share:
45,535

Related videos on Youtube

user132638
Author by

user132638

Updated on September 18, 2022

Comments

  • user132638
    user132638 over 1 year

    We have a CentOS machine and the MySQL is not starting due to disk space being full.

    Below is the df -h results.

    Filesystem            Size  Used Avail Use% Mounted on
    /dev/mapper/VolGroup-lv_root
                           47G   45G     0 100% /
    tmpfs                 3.9G     0  3.9G   0% /dev/shm
    /dev/xvda1            485M   33M  428M   7% /boot
    /dev/mapper/VolGroup-lv_home
                           44G  180M   42G   1% /home
    

    What can be done in this situation? Add more hard disk?

    • Petter H
      Petter H almost 4 years
      u use lvm so check vgs if there is anyunalloated space. chance is that you dont have to migrate anything. u can attach a second disk, add that on eto the volume group and then grow the filesystem too, or resize the disk in the pool already.
  • user132638
    user132638 over 11 years
    if I add hard disk what must I adjust on my mysql setting to expand the data to the hard disk? If option to mean I have to move mysql over what steps need to be taken for that? How tough to expand the /root? Normally what the home partition is to store? Any important files?
  • user132638
    user132638 over 11 years
    is it fine to expand the root partition will it have impact on the /boot and /dev/shm partition?
  • user132638
    user132638 over 11 years
    by adding a brand new hard disk what partition label it will show in the partition list and where to move then ? Thank you.
  • user132638
    user132638 over 11 years
    @dear all so what is the right n best option is it best when we do a new installation to give var a separate partition?
  • Toqeer
    Toqeer over 11 years
    It is best practice to give /var and /home separate partition.
  • user132638
    user132638 over 11 years
    How big should var I guess should be much bigger then /home right?
  • Toqeer
    Toqeer over 11 years
    yes it should be bigger then /home, a default installation of mysql and httpd store all data in /var, also the logs store on /var so its better to keep it big
  • user132638
    user132638 over 11 years
    In case we have a 200gb hd what do you recommend for var is 150gb ok ?
  • Toqeer
    Toqeer over 11 years
    Yes 150GB is fine, if you are not going have special data for /home then keep that also under the / partition