按下回车键跳到正文

[virtualbox]Enlarge(Resize) VirtualDisk & Attention

Contents
  1. Suggession(Not important)
  2. Why
  3. Begin

Suggession(Not important)

cause the npm has a bad experience on windows(directory nesting lead to long directory error), I had to use linux system.

However, whether the package manager of Debian or Red Hat, it CANNOT provide the latest software version. If use the source install from offical website, the network always be interrupted, I was very upset for this.

One day, a whiz(@anciety) recommended an operating system based on Arch Linux to me — “Manjaro”. Then I found a very satisfied Linux system (in any sense)

 

Why

I installed a lot of things recently (openvas nvts feed), The initial allocation of disk space is used up, so it need to extend.

This should be a very simple operation, but since I created a snapshot before, there was a TRAP that could not show the new space in Gparted, which will be mentioned below.

 

Begin

1. First of all, to confirm that you created a “Dynamically allocated differencing storage”, you can in the virtual machine “Settings -> Storage”, select the disk file under the controller to view.

2. Find and copy the path of this disk file, such as: “F:\GuestOS\manjaro\manjaro.vdi”

3. Find your VirtualBox installation directory, which has a “VBoxManage.exe” program

4. I assume that you are at least Win7 system, and in the VBox folder, hold down the Shift button and click the right mouse button to pop up the context, select “Open command window here”. (If you really xp, please manually run “cmd” and then “cd” to that directory. )

5. Replace the command “VBoxManage modifyhd <vdi file path> -resize <file size (MB)>, replace the command you want, for example, if I want to raise the disk space to 20G, it will be like that:

VBoxManage modifyhd “F:\GuestOS\manjaro\manjaro.vdi” –resize 20480

Note that the size of the unit can only be “mb”, you need to be considered manually, do not need “unit”, just write the number only.

PS: If it is not a vdi format file, you can use this command to convert:

VBoxManage clonehd <other format file> <vdi file saving path> –format VDI

6. Execute command, and soon the progress will be 100%, and then completed the expansion of the disk, but here have a TRAP, if you have established a snapshot, the current system state is based on your last snapshot, so you need to carry out the same expansion of the snapshot operation, such as:

VBoxManage modifyhd “F:\GuestOS\manjaro\snapshots\{xxxxxxxx-xxxx-xxxx-xxxx-xxxx}.vdi” –resize 20480

Replace the inside of the “xxx” for your filename.

This is really a big trap, a lot of articles that I searched in Baidu, did not mention what will happen if the we create a snapshot. The result is: vbox show virtual disk space is 20G, but in the system to view the unused space still show 8G .So I’m trying to search the answers, and finally I solve it using Google. I search the keywords: “vbox resize problem”, then found a lot of same problem from visualbox official website.

Reference:

https://www.virtualbox.org/ticket/9103

https://forums.virtualbox.org/viewtopic.php?f=35&t=50661

After the operation, you can allocate these spaces, the new unused space added to the partition you want to expand, the use of “gparted” is a good choice, graphical, convenient and quick.

7. Mount a live disc with “gparted” for the virtual machine, I am using ubuntu, mount and check the “live” radio button, and then start your guest os, wait for the bootloader to load, then Choose “Try Ubuntu” and go to Ubuntu live

8. Open the terminal and run this:

sudo gparted

9. Select the partition you want to expand, such as “/ dev / sda1”, right click on it, select “Resize / Move” in the context, and then slide the space above the right area to the maximum, then click “Resize / Move “, it should have a reminder to remind you that the operation may lead to failure, click” OK “, and then apply the settings to complete.

After rebooting, the partition size has been expanded ~

The reason for the absence of the picture is because my Manjaro is updated after the expansion spaces … … It seems to take a long time, so I can’t reboot to take screenshots for you… if you have any question, just leave a comment below. 🙂

From LzSkyline's Blog : https://en.lzskyline.com/archives/445

2 条评论

  1. essayforme
    essayforme 2018-04-01

    do an essay for me http://sertyumnt.com/

    Hey there, You have done a fantastic job. I will certainly digg it and personally suggest to my friends. I’m sure they will be benefited from this website.

Leave a Reply

Your email address will not be published. Required fields are marked *