virtualMachine

Add a new virtual disk

To create a new virtual disk and increase the disk space available on your virtual machine, follow these steps:

  • In the machine’s “Settings”, add a new SCSI disk drive and configure the disk size.

  • Start the virtual machine and log in.

  • At the console, run the following command to format the new disk:

    $ sudo mkfs.ext4 /dev/sdb
    
  • Create a new directory to mount the disk:

    $ sudo mkdir /mnt/disk
    
  • Mount the new disk:

    $ echo "/dev/sdb /mnt/disk ext4 defaults 0 0" | sudo tee -a /etc/fstab
    $ sudo mount -a
    

Check if the new disk is available with the command below:

$ df -h

If you have a directory containing a large amount of data, you can now move it to the new hard drive and create a symbolic link. Here’s an example of moving the Joomla data directory:

$ sudo mv /opt/bitnami/apps/joomla/data /mnt/disk/data
$ ln -s /mnt/disk/data /opt/bitnami/apps/joomla/data
Last modification September 5, 2018