Views: 11835
Last Modified: 06.02.2015

Because disk space is primarily occupied by site content and site backups located in /home/bitrix and also by the database located in /var/lib/mysql, these particular sections should be moved to separate disks.


Let us consider this task by moving the folder /home with site content and backups to a separate disk.

  • To this effect, we add a new disk of a required size in the list of equipment in the settings of the virtual machine. All actions specified below must be performed under the root administrator’s account:

  • Once the disk is added, the server may need to be reloaded for disk initialization. The new disk and the letter assigned to it may be seen by running the following command:
    fdisk -l

  • Run the utility fdisk for work with the disk /dev/sdb:
    fdisk /dev/sdb

    Create a new partition using the command n:

    • Primary partition – command p and Partition number (1-4): 1;
    • In this case, the first and last sectors are chosen by default; thus, a partition will be created using all of the free disk space:

  • Type the command w in order to save changes to the disk and exit fdisk.

  • Once the partition table is saved, we format a new partition and move data from /home to it:
    mkfs.ext4 /dev/sdb1
    mount /dev/sdb1 /mnt
    service httpd stop
    service nginx stop
    mv -f /home/* /mnt
    umount /mnt
    
  • Next, we determine UUID of the new disk and add an entry about it in /etc/fstab. Instead of UUID the name of the device /dev/sdb may also be used:
    blkid
    /dev/sda1: UUID="99066558-ba04-465c-9962-e827aa2928ec" TYPE="ext4" 
    /dev/sda2: UUID="8ea38ef9-1ee5-423b-a013-15fd603a678e" TYPE="swap" 
    /dev/sda3: UUID="08ec5c65-8fd8-47ac-a998-d81195c8f964" TYPE="ext4" 
    /dev/sdb1: UUID="b2e58731-b621-4bd5-909a-afe3bb5dd8a1" TYPE="ext4"
    

  • All that is left to do is mount a new disk and start up the services that were stopped before:
    mount /home
    service httpd start
    service nginx start
    

The disk adding procedure is the same for other virtualization environment or directly on a physical server.




Courses developed by Bitrix24