Configuring and Mounting a New Volume
Full-Access Members Only
Sorry, this lesson is only available to Server Academy Full-Access members. Become a Full-Access member now and get instant access to this and many more premium courses. Click the button below and get instant access now.
Instructions
Q&A (0)
Notes (0)
Resources (0)
Saving Progress...
Resources
There are no resources for this lesson.
Notes can be saved and accessed anywhere in the course. They also double as bookmarks so you can quickly review important lesson material.
In this lesson, you will learn the practical aspects of managing storage in a Linux environment, specifically focusing on how to add a new drive to a virtual machine (VM) in VirtualBox and then configure and mount this new volume on our "Ubuntu Server" VM. This is a crucial skill for anyone managing Linux servers, as it involves understanding how to expand storage capabilities and manage filesystems effectively.
Adding a New Drive to the VM in VirtualBox
To increase the storage capacity of your "Ubuntu Server" virtual machine (VM) in VirtualBox, you need to add a new virtual hard drive. Here's how to do it:
Ensure that your VM is powered off before attempting to complete the steps below. You can shutdown your VM with the `shutdown now` command
1. Start VirtualBox: Open VirtualBox and select the "Ubuntu Server" VM from your list of VMs.
2. Access VM Settings: Click on the "Settings" button while your VM is highlighted. This will open a new window where you can modify various settings of the VM.
3. Navigate to Storage Settings: In the settings window, click on the "Storage" tab. Here, you'll see your current storage setup, including any hard drives or optical drives attached to the VM.
4. Add a New Hard Drive: Look for the "Controller: SATA" or "Controller: IDE" section in the storage tree. Right-click on it and choose "Add Hard Disk".
In the new window, select "Create new disk". This will launch a wizard to guide you through the process of creating a new virtual hard disk.
5. Configure the New Hard Disk: The wizard will ask you to choose the hard disk file type (VDI, VMDK, or VHD), the storage details (dynamically allocated or fixed size), and the size of the disk. Choose the options that best fit your needs. For most purposes, a VDI format with dynamic allocation is sufficient. Set an appropriate size for your new disk, keeping in mind the available space on your host machine. I am going to use a 25GB size;
6. Complete the Setup: Follow the rest of the prompts in the wizard to create the disk. Once done, click the Choose button in the Hard Disk Selector window.
You will see your new virtual hard disk listed under the storage controller in the storage settings:
7. Start the VM: Close the settings window and start your "Ubuntu Server" VM. The VM will now have access to the new virtual hard disk you just added.
Next, we will move on to configuring this newly added volume within the Ubuntu Server environment.
Configuring the New Volume
Once the VM is up and running with the new drive added, we need to configure this new volume.
Identifying the New Drive: Open the terminal in your Ubuntu Server VM. Use the lsblk
command to list all block devices. The new drive will typically be listed as /dev/sdb
or similar, depending on your existing configuration.bash
lsblk
When I run that command on my server, I can see the disk listed as sdb:
paulh@ubuntu-server:~$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
loop0 7:0 0 111.9M 1 loop /snap/lxd/24322
loop1 7:1 0 63.4M 1 loop /snap/core20/1974
loop2 7:2 0 53.3M 1 loop /snap/snapd/19457
sda 8:0 0 80G 0 disk
├─sda1 8:1 0 1M 0 part
├─sda2 8:2 0 2G 0 part /boot
└─sda3 8:3 0 78G 0 part
└─ubuntu--vg-ubuntu--lv 253:0 0 39G 0 lvm /
sdb 8:16 0 25G 0 disk
sr0 11:0 1 1024M 0 rom
Creating a File System: Before using the new drive, you need to create a filesystem on it. Let's use the mkfs
command to create an ext4 filesystem (a common Linux filesystem type). Replace sdb
with your drive identifier if different.
Server Academy Members Only
Sorry, this lesson is only available to Server Academy Full Access members. Become a Full-Access Member now and you’ll get instant access to all of our courses.