Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

We have a centos machine and the mysql is not starting and is due to space if full. Below is the df-h results. What best can be done in this situation? Add more hard disk ?

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
share|improve this question
add comment

2 Answers

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.

share|improve this answer
    
is it fine to expand the root partition will it have impact on the /boot and /dev/shm partition? –  user132638 Sep 22 '12 at 6:12
    
/var is under '/' so no need to unmount and You already copied the data to /home/var in case of any problem you can move it back to /var with -p option. –  Toqeer Sep 22 '12 at 6:15
    
@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? –  user132638 Sep 22 '12 at 6:19
2  
It is best practice to give /var and /home separate partition. –  Toqeer Sep 22 '12 at 6:21
    
How big should var I guess should be much bigger then /home right? –  user132638 Sep 22 '12 at 7:13
show 3 more comments

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|improve this answer
    
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 Sep 22 '12 at 5:46
    
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 Sep 22 '12 at 6:13
    
@rkosegi - Vote it back if you removed your comment. –  Toqeer Sep 22 '12 at 6:27
add comment

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.