0

I did a standard install of Centos 6.5 in a 1TB SSD (MLC) not realizing that only 50G is allocated to / and approximately 816G to /home:

[gskidmor@mrserver ~]$ df -h
Filesystem                       Size  Used Avail Use% Mounted on
/dev/mapper/vg_mrserver-lv_root   50G   33G   14G  71% /
tmpfs                             64G     0   64G   0% /dev/shm
/dev/sdb1                        485M   39M  421M   9% /boot
/dev/mapper/vg_mrserver-lv_home  816G  227M  774G   1% /home

At the current rate of consumption, the DB files will use up most/all of the disk within 2 weeks.

So this seems like a trivial question, but I figured I would ask anyways - should I resize / and give it a majority of the space or move the location that mysql stores it's files to someplace in /home? I'm worried creating a user mysql with a home directory and login (I could use nologin in passwd) could pose a security risk

Michael Hampton
  • 244,070
  • 43
  • 506
  • 972
  • Just shrink /home and grow /. Easy enough. – Michael Hampton Sep 03 '14 at 17:10
  • since both partitions are in LVM, I'd go with shrinking `/home` and resizing `/` (root) or better yet add another `/var/lib/mysql` or just change `datadir` inside of your `my.cnf` and point it to `/home`. – alexus Sep 03 '14 at 20:20

2 Answers2

1

You can store your databases in any location as long as you tell MySQL where they are:

[mysqld]
.
.
datadir=/path/to/new/databases/directory
.

Stop mysqld first before moving them. Ensure owner, group and permissions are identical to the original. Also make sure the user/group mysql can read the path all the way from root (/) to the databases.

garethTheRed
  • 4,539
  • 14
  • 22
0

If you do not want mess around with epartition and filesystem reallocation, you can create a directory in /home, move all the files over there and then set a symbolic link from the old database directory (somewhere in /var usually) to the new location and you should be all set.

In any event, I'd try to isolate the database directory from the root partition.

mdpc
  • 11,856
  • 28
  • 53
  • 67