banner



How To Add More Disk To A Virtual Machine Virtualbox

Is your VirtualBox virtual auto starting to run out of disk space? No worries, because VirtualBox allows you lot to hands increase the disk size of your virtual machine. Just go along in mind that afterwards you all the same demand to increment the size of your partitions accordingly. This article volition help y'all along the style. It provides you with step-past-step instructions on how to increment the disk size of your VirtualBox virtual machine.

Background

Virtual machines provide a great playground for learning almost and testing out all sorts of Linux related things. Both for desktop and server purposes. Merely what do you do when your virtual auto runs out of deejay infinite? On real hardware yous would bandy the hd for a larger version. Just how practice you achieve this task for your VirtualBox virtual automobile?

Luckily, VirtualBox allows you to easily increase the size of your virtual disk. Nevertheless, that's not the terminate of the story. Your disk partitions still have the same size as before. So to complete the disk size increase of your VirtualBox virtual car, you lot nonetheless need to modify the size of the disk sectionalisation(s). This latter step is a fleck trickier. Fear not, because this article provides you with footstep-by-step instructions on how to increase the disk size of your VirtualBox virtual automobile.

If you don't yet have a virtual machine, you can follow this tutorial to create a minimal Debian server virtual machine in VirtualBox. This commodity takes the same Debian server virtual car as a starting point.

Virtual machine backup

Increasing the disk size of your VirtualBox virtual machine, including the partition resizing, is an invasive operation. For this reason nosotros'd better make a fill-in re-create of the virtual car. A virtual machine consists of plain files on you PC. Therefore merely copying these files already creates a backup of the unabridged virtual car.

My Debian server virtual machine resides at this location in my user'southward home directory:

/home/pragmalin/VirtualBox VMs/Debian Server/

The following two commands fill-in this virtual car to a directory called Debian Server Backup:

cd ~/"VirtualBox VMs"

cp -avr "Debian Server" "Debian Server Backup"

These directory names contains spaces and therefore I surrounded them with double quotes.

Terminal screenshot that shows the command for creating a backup of a VirtualBox virtual machine.

If something goes incorrect while performing the steps outlined in this article, you can simply delete the Debian Server directory and restore the backup. For restoring the backup, you can apply a similar cp command as above. You merely have to swap the Debian Server and Debian Server Backup command parameters around.

Increase the size of your VDI virtual disk in VirtualBox

Upon creation of a virtual machine, VirtualBox creates a VDI file. VDI represent virtual disk image. Remember of this VDI file every bit the hard disk of your virtual machine. To locate the name of your virtual machine'southward VDI file, select your virtual motorcar on VirtualBox'south main screen. You tin can and then run across the name of the VDI file in the "Storage" department. In my instance it is Debian Server.vdi and its current size equals twenty GB:

Screenshot of the VirtualBox main window with a virtual machine selected. It show you how to find the virtual disk image (VDI) name of the virtual machine.

For increasing the size of your VDI disk, go to the VirtualBox main screen. Next, click on the icon located at the right side of the Tools entry. Select Media from the pop-up carte du jour to open the media view. The media view lists all the hard disks fastened to your virtual machines.

Screenshot of VirtualBox which lists the media, including hard disks of all virtual machine. It explain how you can increase the VDI disk size of the virtual machine.

On the VirtualBox media view, select the VDI disk that you want to increment in size. In my example it is Debian Server.vdi which currently has a size of xx GB. Once selected, you lot simply motion the slider at the bottom of the screen to increase the disk size. In this example, I desire to increase the disk size from xx GB to 25 GB. Once yous selected the new disk size, confirm it by clicking the Apply button. Continue in mind though that you tin can only increase the disk size and not decrease it.

Let'southward verify that the deejay size of your VirtualBox virtual machine actually got increased. Go ahead and start your virtual car. Once ready, open the concluding if it has a desktop environs or log in via SSH if information technology is a server. List the information about the attached disks with command:

lsblk -p | grep "disk"

Terminal screenshot that shows the output of the lsblk command to list the disks known to the virtual machine. It is used to verify that the disk size increase was successful.

Every bit expected, the command output reports 25 GB for the disk size. This proves that we successfully increased the disk size of our VirtualBox virtual auto. All done, right? I'g afraid not. Run the following command to listing the partitions:

lsblk -p | grep "part"

Terminal screenshot of the lsblk command which this time lists the size of the partitions. Here it becomes clear that the VirtualBox virtual machine disk size was increase, but that the partitions still have the same size as before, so not taking advantage of the disk size increase.

After adding up the size of the individual partitions, we become to about twenty GB and non the desired 25 GB. So the virtual hard disk of our virtual motorcar was increased, but we still demand to increase the partitions. The side by side section describes how to achieve this.

Increase the size of your root file organisation partitioning

The previous terminal screenshot tells us that the virtual machine has a primary partition sda1 that holds the root file arrangement. Furthermore, the virtual machine has an extended partition sda2 that holds the swap segmentation sda5. For our virtual machine to reap the benefits of the larger disk size, we want to increment the partition with the root file system (sda1) from xviii GB to 23 GB. Unfortunately, you cannot change the partitions while the system is alive. To solve this conundrum, we will kicking our virtual car from a GParted Live ISO.

Download the GParted Live ISO

The GParted Live ISO contains a CD prototype with a live Linux system, which includes the GParted program. With the GParted program you lot can change your disk partitioning and format disks. Note that making a mistake in GParted tends to be permanent. To the point where you might loose information on your virtual machine. That's the reason why I recommended making a backup re-create of the virtual machine showtime before in this article. If you decided to skip the step where you back up your virtual machine, now would be a good time to reconsider this decision.

Before we can boot our virtual motorcar from the GParted Live ISO, we should showtime download it. Visit the download department of the GParted website. Once there, download the latest 64-bit stable release. At the time of this writing the latest stable release is one.1.0-5:

Web browser screenshot that shows you where to find the download link for the GParted Live ISO.

Later the download the file resides at the post-obit location on my PC:

/home/pragmalin/Downloads/gparted-live-i.i.0-5-amd64.iso

Attach the GParted Live ISO to the virtual motorcar

With the GParted Alive ISO downloaded, nosotros connect information technology to the CD-ROM drive of our virtual auto. Make sure your virtual motorcar is powered off at this bespeak. On the VirtualBox main screen, select your virtual machine and click the Settings push on the toolbar. When the Settings dialog appeared, go to the Storage section and select the Empty IDE controller. Once selected, click the blueish disk icon button on the right side of the dialog. From the carte du jour that dropped down, select the Choose a deejay file… choice. Now select the GParted Live ISO file you downloaded in the previous step. Complete the configuration by clicking the OK push on the Settings dialog. The Empty IDE controller should at present take changed to the proper name of the GParted Live ISO file:

Screenshot of the virtual machine settings in VirtualBox. Specifically the section with the storage. It illustrates how to attach the GParted Live ISO to the virtual optical drive.

Boot the virtual machine from the GParted Live ISO

With the GParted Live ISO continued to the virtual machine'southward optical bulldoze, the virtual machine volition boot from this Live CD paradigm instead of its virtual deejay. So become ahead and startup your virtual car. A few prompts appear during the boot procedure. Just hit Enter every time to accept the defaults. Eventually, you'll end with a basic desktop environment with the GParted program running:

Screenshot of what the virtual machine looks like after it booted from the GParted Live ISO. It basically shows the automatically opened GParted program.

Resize the partitions

In GParted you can meet a 5 GB chunk that is unallocated. This is expected because it represents the size with which we increased the disk in our VirtualBox virtual machine. The goal is to give this v GB unallocated disk chunk to /dev/sda1. And so once we are all set and done, /dev/sda1 should have a size of 23 GB instead of 18 GB. It would exist dainty if we could just drag and drop this unallocated disk space onto /dev/sda1.

Unfortunately, y'all cannot but motility a piece of the disk space like that. What nosotros have to do instead is move the extended sectionalization, including the bandy partition, all the manner to the right. This opens upwards 5 GB betwixt /dev/sda1 and /dev/sda2. Once it is directly on the correct side of /dev/sda1 we can increase the size of the /dev/sda1 to include this v GB. Now that we know the general idea, allow'due south get piece of work.

Step i – Add the unallocated infinite to the extended partition

Select the /dev/sda2 extended partitioning in GParted and select SegmentationResize/Move from the program menu. On the dialog that appeared, select None from the Align to drop downwardly menu. Adjacent, resize the partition by entering a value of 0 in the Free space following edit box. Alternatively, you can drag the right arrow all the way to the right, in the visual representation of the sectionalisation size. Click the Resize/Motion push to confirm the change.

GParted screenshot that shows how to add the unallocated space to the extended partition.

Stride ii – Move the swap partition to the right of the extended partition

The unallocated deejay space is now a part of the /dev/sda2 extended partitioning. As a adjacent step we movement the /dev/sda5 swap segmentation, which is inside the extended partition, all the way to the right. Select the /dev/sda5 swap partition in GParted and select DivisionResize/Move from the program menu. On the dialog that appeared, select None from the Align to drib down card. Next, elevate the swap partition all the way to the correct, in the visual representation of the division size. Alternatively, you can modify the numbers directly in the edit boxes. Basically the values in Gratis space preceding and Free infinite following need to be swapped. Click the Resize/Move push button to confirm the change. Annotation that you might get a warning that moving a partitioning might cause the operating organisation to fail to boot. You lot can ignore this warning, so just click OK on the warning dialog.

GParted screenshot that shows how to move the swap partition to the end of the extended partition.

Step three – Shrink the extended partition back to its original size

The unallocated infinite withal resides in the /dev/sda2 extended partition. To remove information technology from the extended division, we simply shrink the extended sectionalization back to its original size. Select the /dev/sda2 extended partition in GParted and select PartitionResize/Move from the program menu. On the dialog that appeared, select None from the Align to driblet down menu. Next, drag the left arrow equally far as you tin to the right. Then basically to the first of where the swap partition is at present located. Click the Resize/Move button to confirm the alter.

GParted screenshot that shows how to shrink the extended partition back to its original size.

Step four – Add together the unallocated space to the root file arrangement partition

Almost there. The unallocated space holds the correct position. Correct between the /dev/sda1 root file system partition the /dev/sda2 extended partition. Now we just demand to increase the size of the /dev/sda1 root file system to include the unallocated space. Select the /dev/sda1 root file system partition in GParted and select PartitionResize/Motion from the program bill of fare. On the dialog that appeared, select None from the Align to drop downward menu. Next, resize the partition by dragging the correct arrow all the way to the right, in the visual representation of the partition size. Click the Resize/Move button to confirm the change.

GParted screenshot that shows how to add the unallocated space to the root file system partition. This was the goal, because not the increased disk size of our VirtualBox virtual machine can actually be used by the root file system.

Step five – Utilize the sectionalization changes

Subsequently reorganizing of the partitions, we just demand to apply the changes. Note that at that place are some minor snippets of unallocated space in between the partitions. An unfortunate side outcome of the changes, but these are then tiny that we can ignore them. Go ahead and select EditApply All Operations from the plan menu. Click Apply on the confirmation dialog for this operation. Afterwards, the status bar should display 0 operations pending. Likewise note that the size of the /dev/sda1 root file system partition increased from 18 to 23 GB. Exactly what we wanted.

GParted screenshot that shows an overview of the changes that were made. These changes were needed to add the new disk space to the root file system partition. This way the VirtualBox virtual machine can actually use the new disk size after the increase operation.

Power downward the virtual motorcar

Since we completed increasing the deejay size of the root file organization partition in our VirtualBox virtual machine, it is fourth dimension to power down the GParted live organisation. Select GPartedQuit from the program carte du jour to close GParted. Back on the desktop you lot'll find a red icon labeled Exit. Double-click this icon and select Shutdown from the dialog the appeared. Click the OK push button on the same dialog to ostend. At the finish of the power downward process, it asks you lot to remove the live-medium and then press Enter. On a virtual machine we practice non have to physically remove the live-medium, and so simply press Enter to completely shutdown the virtual motorcar. Note that this automatically detaches the GParted Live ISO from the virtual machine.

Final testing

Alright, then we did quite some work and we should be all set up at present. Lets power upward the virtual machine and verify that our root file system partition increased in size. Once ready, open the terminal if information technology has a desktop environs or log in via SSH if information technology is a server. Enter this control to listing information about the attached disks and its partitions:

lsblk -p | grep "disk\|part"

Terminal screenshot that shows the command output of lsblk. It lists both the disk and partitions of the virtual machine. It shows that the disk size increased as well as the size of the root file system partition.

We successfully increased the disk size of our VirtualBox virtual machine from xx GB to 25 GB. This is old news, since nosotros already verified that in a previous section. The command output does offer new information about the root file system sectionalization (/dev/sda1). This division grew from 18 GB to 23 GB. This proves that we successfully added to five GB to the root file system partition.

Wrap upwards

Subsequently working your fashion through this tutorial, you learned the technique involved to increase the disk size of your VirtualBox virtual motorcar. The VirtualBox user interface offers a feature for the actual deejay size increase. You as well learned that increasing the deejay size of the virtual machine in VirtualBox is merely half the story. You still need to resize partitions to reap the benefits of the newly created disk infinite. Resizing partitions cannot be washed on a alive system, therefore you booted your virtual machine with the GParted Live ISO. With the assistance of GParted y'all could increase the size of the root file system partiton. Using GParted involves a learning curve and hopefully this tutorial sufficiently helped y'all with this function.

Ezoic

How To Add More Disk To A Virtual Machine Virtualbox,

Source: https://www.pragmaticlinux.com/2020/09/how-to-increase-the-disk-size-in-a-virtualbox-virtual-machine/

Posted by: kimballcang1972.blogspot.com

0 Response to "How To Add More Disk To A Virtual Machine Virtualbox"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel