EXTENDING /var FILESYSTEM
-
Create a new Virtual Server with an additional drive or add a new drive after creation
-
Add a new drive at VM creation
-
Provide the required values. Click Create
-
The newly created drive is now listed
-
-
Log in into the VM and execute the command below to find the additional drive:
-
fdisk -l
-
Partition the disk using the command:
-
fdisk /dev/vdb
-
Use option ‘n’ to create the partition
-
Use ‘w’ command to save
-
Use the commands depicted in the screenshot below:
-
Press “Enter” to choose default values on sectors
-
-
-
Execute the command below to check the mounted disk:
-
lsblk
-
-
Modify the file system to ext4 using the command:
-
mkfs -t ext4 /dev/vdb1
-
-
Rename var directory using the command:
-
mv /var /var2
-
-
Create a new directory for var using the command:
-
mkdir /var
-
-
Mount created partition with /var using the command:
-
mount /dev/vdb1 /var
-
Verification: Execute the command:
-
df -h
-
-
-
Move files from the backup directory to /var directory:
-
mv /var2/* /var/
-
Ignore the above error since temporary files cannot be removed
-
-
Create a fstab entry to make this change permanent:
-
Open the file /etc/fstab
-
Add the entry below and save the file
/dev1/vdb1 /var ext4 defaults 0 0
-
Reboot the VM to verify the changes
-