1

I have a dedicated server in ovh on which I have

/dev/md3 1.8T /home 1,7T

and I have a partition that has only 20GB

/dev/root 20G 19G 3,7G 99% /

And the database stops working all the time because there is no place. Now I would like to reduce the partition home or / dev / md3 by eg 100GB, and add 100GB to the / dev / root partition as I can do it without corrupting the whole system? :( Of course, there is a centos system with DirectAdmin installed, no graphical environment, so only consoles are left.

This size was set by DA during the automatic installation by the OVH panel, and currently there are 120 domains with Wordpress on the server.

df result

Filesystem      1K-blocks     Used  Available Use% Mounted on
/dev/root        20026172 15027060    3958784  80% /
devtmpfs         16415192        0   16415192   0% /dev
tmpfs            16450184       28   16450156   1% /dev/shm
tmpfs            16450184  1681448   14768736  11% /run
tmpfs            16450184        0   16450184   0% /sys/fs/cgroup
/dev/md3       1902052420 13841064 1791569672   1% /home
tmpfs             3290040        0    3290040   0% /run/user/0

lsblk result

NAME    MAJ:MIN RM    SIZE RO TYPE  MOUNTPOINT
sdb       8:16   0    1.8T  0 disk
├─sdb4    8:20   0    511M  0 part  [SWAP]
├─sdb2    8:18   0   19.5G  0 part
│ └─md2   9:2    0   19.5G  0 raid1 /
├─sdb3    8:19   0    1.8T  0 part
│ └─md3   9:3    0    1.8T  0 raid1 /home
└─sdb1    8:17   0 1004.5K  0 part
sda       8:0    0    1.8T  0 disk
├─sda4    8:4    0    511M  0 part  [SWAP]
├─sda2    8:2    0   19.5G  0 part
│ └─md2   9:2    0   19.5G  0 raid1 /
├─sda3    8:3    0    1.4T  0 part
│ └─md3   9:3    0    1.8T  0 raid1 /home
└─sda1    8:1    0 1004.5K  0 part
11
  • 1
    Make a backup, then reinstall the system. Mar 1, 2019 at 21:05
  • 1
    If reinstalling is not an option, consider moving the database from /dev/root to /home, where you have plenty of disk space. Mar 1, 2019 at 21:13
  • Can I transfer these databases only in what way? Currently, I have to delete files every few days because I have full dev/root
    – PawelC
    Mar 1, 2019 at 21:16
  • @OlafDietsche I copied the database from / var / lib / mysql to / home unfortunately in centos I can not find the mysql file where I can change the path where the database is kept. w /etc/my.cnf is only bind-address
    – PawelC
    Mar 1, 2019 at 21:32
  • 1
    /var is on the same partition as /. Have you looked into your log space usage, and if needed looked at your log maintenance settings?
    – Ed Grimm
    Mar 2, 2019 at 1:49

2 Answers 2

2

If moving the database directory to /home is an option, you may follow these steps

  • Stop the mysql server
  • Copy the directory from /var/lib/mysql to /home/mysql
  • Change or add a line

    [mysqld]
    datadir = /home/mysql
    
  • Start the mysql server

4
  • I did as you wrote, he shows me --datadir=/home/mysql unfortunately after entering the page with Wordpress shows Error establishing a database connection
    – PawelC
    Mar 1, 2019 at 21:52
  • Only change the datadir, leave everything else as it is. Especially don't move the socket. Mar 1, 2019 at 21:56
  • Now all works fine :) I still have to move logs from /var/log to /home/log because there 3 files named messages + data have almost 2gb
    – PawelC
    Mar 1, 2019 at 22:05
  • In general, I wanted to increase the size of the disk, because as it was 100% full, it showed "error establishing database connection"
    – PawelC
    Mar 1, 2019 at 22:19
2

Given the tiny amount of data that is stored on the system (less than 30 GB) and the amount of effort you would need to

  • shrink the filesystem on md3
  • shrink md3 itself
  • shrink sda3 and sdb3
  • move sda3 and sdb3 to the end of the drive
  • grow sda2 and sdb2
  • grow md2
  • grow the filesystem on md2

I would strongly suggest you just take a backup, reinstall the system with different partitioning and restore from your backup.

You can save a lot of headache, effort and downtime this way.

I strongly suggest you set up the new partitioning scheme using LVM and assign only as much space to each filesystem as is required. Later on-line growing is really easy while on-line shrinking is usually impossible.

1
  • The problem is that the server administrator is none of me, so such operations would end in a tragedy: D
    – PawelC
    Mar 1, 2019 at 21:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.