Moving directory to another partition (part 1)

Due to the fact that the primaire virtual disk (containing the Debian OS and currently the /var) of one of our customers servers is on a SSD pool and almost reaching its capacity (>75%) we need to add a second virtual disk and move the /var folder (HDD space costs less and is fast enough to serve websites and email).

First we started with creating the new virtual disk and adding it to the VM.
Secondly we partitioned it:
1. Use “fdisk -l” to get the disk name (in our case vdb)
2. cfdisk /dev/<diskname>
3. Select new
4. Press enter at the “Specify size in MB” to use the whole disk.
5. “mkfs.ext4 /dev/<diskname>”
6. “mkdir /var2”
7. Get the UUID of the disk with the command “blkid”.
8. “echo “UUID=<UUID> /var2 ext4 errors=remount-ro 0 1″ >> /etc/fstab”

Next we can copy the data from /var to /var2 (we use rsync to preserve permissions).
We are currently running the following command to make a first copy:
“rsync -av /var/ /var2”

The next step would be stopping all services (apache, mysql, dovecot etc.) but we will continue on this after the data has been copied (which will take a full night).

Populaire berichten

Geef een reactie

Het e-mailadres wordt niet gepubliceerd. Vereiste velden zijn gemarkeerd met *