This page (revision-18) was last changed on 23-Apr-2022 17:06 by Harry Metske

This page was created on 23-Apr-2022 17:05 by Harry Metske

Only authorized users are allowed to rename pages.

Only authorized users are allowed to delete pages.

Page revision history

Version Date Modified Size Author Changes ... Change note
18 23-Apr-2022 17:06 17 KB Harry Metske to previous restored previous version
17 23-Apr-2022 17:05 17 KB 24.55.37.52 to previous | to last
16 23-Apr-2022 17:05 17 KB Harry Metske to previous | to last typo
15 23-Apr-2022 17:05 17 KB Harry Metske to previous | to last
14 23-Apr-2022 17:05 17 KB Harry Metske to previous | to last
13 23-Apr-2022 17:05 15 KB Harry Metske to previous | to last
12 23-Apr-2022 17:05 16 KB Harry Metske to previous | to last
11 23-Apr-2022 17:05 15 KB Harry Metske to previous | to last
10 23-Apr-2022 17:05 13 KB Harry Metske to previous | to last
9 23-Apr-2022 17:05 10 KB Harry Metske to previous | to last
8 23-Apr-2022 17:05 10 KB Harry Metske to previous | to last
7 23-Apr-2022 17:05 10 KB Harry Metske to previous | to last
6 23-Apr-2022 17:05 8 KB Harry Metske to previous | to last
5 23-Apr-2022 17:05 6 KB Harry Metske to previous | to last
4 23-Apr-2022 17:05 6 KB Harry Metske to previous | to last
3 23-Apr-2022 17:05 1 KB Harry Metske to previous | to last
2 23-Apr-2022 17:05 1 KB Harry Metske to previous | to last
1 23-Apr-2022 17:05 1 KB Harry Metske to last

Page References

Incoming links Outgoing links

Version management

Difference between version and

At line 15 removed 3 lines
I first had a look at the [http://openvz.org] site, but concluded that running a recent Ubuntu server is not a "default route".\\
Since my hardware also
At line 20 removed 2 lines
vbox clonehd ?
At line 24 removed 2 lines
vbox modifyhd resize ?...
At line 28 removed 2 lines
vrde stuff with extension packs....
At line 32 removed 2 lines
VBoxHeadless...
At line 36 removed 2 lines
2 is minimal required...
At line 40 removed 2 lines
stats , NATing, live migration ?
At line 61 changed one line
! Creating a VM
! Creating and modifying a VM
At line 156 added 8 lines
I use the --delete option to really get rid of everything including harddisks, saved states and log files, simply I don't want to find anything of it anymore. (I reran the {{createvm}} subcommand again after deleting is.)
Now we are happy with most of the default, but a few changes would be nice, so we go to the subcommand {{modifyvm}} :\\
%%(background-color : #d3ee03 ) VBoxManage modifyvm Ubuntu2 --memory=256 --hwvirtex=off --hwvirtexexcl=off --vtxvpid=off --boot1=dvd --boot2=disk --boot3=none --nic1=bridged --bridgeadapter1=wlan0 --nicpromisc1=allow-all --vrde=on --vrdeport=13389 %%
At line 173 changed one line
%%(background-color : #d3ee03 )
VBoxManage modifyvm Ubuntu2 --memory=256 --hwvirtex=off --hwvirtexexcl=off --vtxvpid=off --boot1=dvd --boot2=disk --boot3=none --nic1=bridged --bridgeadapter1=wlan0 --nicpromisc1=allow-all --vrde=on --vrdeport=13389
At line 177 removed one line
I use the --delete option to really get rid of everything including harddisks, saved states and log files, simply I don't want to find anything of it anymore. (I reran the {{createvm}} subcommand again after deleting is.)
At line 171 added one line
The {{modifyvm}} subcommand gives no output if it succeeds, if you want to see the result, issue the {{showvminfo}} command again.
At line 180 removed 2 lines
Now we are happy with most of the default, but a few changes would be nice, so we go to the subcommand {{modifyvm}} :\\
%%(background-color : #d3ee03 ) VBoxManage modifyvm --name Ubuntu2 %%
At line 174 added 14 lines
! Creating and attaching storage devices
Now before we can boot the thing, we need a bootable ISO image, and a harddisk that can be used for installation.
I downloaded an Ubuntu 11.10 ISO in {{/home/metskem/iso/ubuntu-11.10-server-i386.iso}}.
First we have to define 2 controllers :
%%(background-color : #d3ee03 ) VBoxManage storagectl Ubuntu2 --name='IDE Controller' --add=ide --controller=PIIX4 --bootable=on %% \\
%%(background-color : #d3ee03 ) VBoxManage storagectl Ubuntu2 --name='SATA Controller' --add=sata --controller=IntelAhci --bootable=on
%%
The result with {{showvminfo}} :
At line 184 changed one line
!! Backup up
{{{
metskem@gneisenau ~ $ VBoxManage showvminfo Ubuntu2|grep Storage
Storage Controller Name (0): IDE Controller
Storage Controller Type (0): PIIX4
Storage Controller Instance Number (0): 0
Storage Controller Max Port Count (0): 2
Storage Controller Port Count (0): 2
Storage Controller Bootable (0): on
Storage Controller Name (1): SATA Controller
Storage Controller Type (1): IntelAhci
Storage Controller Instance Number (1): 0
Storage Controller Max Port Count (1): 30
Storage Controller Port Count (1): 30
Storage Controller Bootable (1): on
}}}
%%
At line 186 changed one line
!! Resizing HD
Now let us attach the ISO image as a DVD drive with the {{storageattach}} subcommand:\\
%%(background-color : #d3ee03 ) VBoxManage storageattach Ubuntu2 --storagectl='IDE Controller' --port=1 --device=1 --type=dvddrive --medium=/home/metskem/iso/ubuntu-11.10-server-i386.iso %%
At line 209 added 201 lines
And also this can be listed, this time with the {{list}} subcommand: \\
%%(background-color : #d3ee03 ) VBoxManage list dvds %%
%%small
{{{
metskem@gneisenau ~ $ VBoxManage list dvds
UUID: 32feb261-654c-4562-8115-7b25e5aff798
Format: RAW
Location: /home/metskem/iso/ubuntu-11.10-server-i386.iso
State: created
Type: readonly
Usage: Ubuntu2 (UUID: df6e7d7d-3e48-43f9-8358-126a89428fe3)
}}}
%%
And now the hard disk, but we first have to create a hard disk, that can be done with the {{createhd}} subcommand: \\
%%(background-color : #d3ee03 ) VBoxManage createhd --filename '/home/metskem/VirtualBox VMs/Ubuntu2/Ubuntu2Disk.vdi' --size=5000 %%
%%small
{{{
metskem@gneisenau ~ $ VBoxManage createhd --filename '/home/metskem/VirtualBox VMs/Ubuntu2/Ubuntu2Disk.vdi' --size=5000
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Disk image created. UUID: daeb6941-e194-47ab-99a3-af74700b7e99
}}}
%%
Watch out, this hdd is not yet "registered" with VirtualBox, you first have to attach it to a VM with the {{storageattach}} subcommand:\\
%%(background-color : #d3ee03 ) VBoxManage storageattach Ubuntu2 --storagectl='SATA Controller' --port=1 --device=0 --type=hdd --medium='/home/metskem/VirtualBox VMs/Ubuntu2/Ubuntu2Disk.vdi' %%
This command gives no output if it succeeds. You can now list the available hdds with the {{list}} subcommand:
%%small
{{{
metskem@gneisenau ~ $ VBoxManage list hdds
UUID: daeb6941-e194-47ab-99a3-af74700b7e99
Parent UUID: base
Format: VDI
Location: /home/metskem/VirtualBox VMs/Ubuntu2/Ubuntu2Disk.vdi
State: created
Type: normal
Usage: Ubuntu2 (UUID: df6e7d7d-3e48-43f9-8358-126a89428fe3)
}}}
%%
! Starting the thing
Now everything looks ready for the first boot, so use the {{startvm}} subcommand to boot : \\
%%(background-color : #d3ee03 )VBoxManage startvm Ubuntu2 --type=headless %%
%%small
{{{
metskem@gneisenau ~ $ VBoxManage startvm Ubuntu2 --type=headless
Waiting for VM "Ubuntu2" to power on...
VM "Ubuntu2" has been successfully started.
}}}
%%
Now to get the console, you have to use an RDP client (I used vinagre), and connect to localhost:13389, you should see a console with an Ubuntu LiveCD booting. %%small (I had the issue that my screen was larger than the window...but this was a normal Ubuntu install and I accepted all defaults) %%
! Removing the DVD drive
After the installation has succeeded, we have to remove the DVD drive, so it will boot from hdd next time the VM starts.
This can be done with the {{modifyvm}} command again:\\
%%(background-color : #d3ee03 )VBoxManage modifyvm Ubuntu2 --boot1=disk --boot2=dvd --boot3=none %%
! Backing up the VM
My first idea was to simply {{clonevm}} the VM, but you cannot clone a running VM, so you would first have to stop the VM in order to clone it, not what we want.\\
It appears that you can make a snapshot while the machine is running and {{clonevm}} that snapshot. So:\\
%%(background-color : #d3ee03 ) VBoxManage snapshot Ubuntu2 take snapshot1 %% \\
%%warning But here we run into a serious [VirtualBox bug|https://www.virtualbox.org/ticket/9255], and the running VM is now in a state {{ GURU MEDITATION }} %%
But an easy workaround is to use the (not explained) --pause parameter:\\
So after powering down the VM %%(background-color : #d3ee03 )( VBoxManage controlvm Ubuntu2 poweroff %% ), and starting it again, we : \\
%%(background-color : #d3ee03 ) VBoxManage snapshot Ubuntu2 take snapshot1 --pause %% \\
%%small
{{{
metskem@gneisenau ~ $ VBoxManage snapshot Ubuntu2 take snapshot1 --pause
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
}}}
%%
And you can see when you list the %%(background-color : #d3ee03 ) VM VBoxManage list --long runningvms %% :
%%small
{{{
metskem@gneisenau ~ $ VBoxManage list --long runningvms
Name: Ubuntu2
Guest OS: Other Linux
UUID: df6e7d7d-3e48-43f9-8358-126a89428fe3
Config file: /home/metskem/VirtualBox VMs/Ubuntu2/Ubuntu2.vbox
Snapshot folder: /home/metskem/VirtualBox VMs/Ubuntu2/Snapshots
Log folder: /home/metskem/VirtualBox VMs/Ubuntu2/Logs
Hardware UUID: df6e7d7d-3e48-43f9-8358-126a89428fe3
Memory size: 256MB
Page Fusion: off
VRAM size: 8MB
CPU exec cap: 100%
HPET: off
.......<cut>...........
Guest:
Configured memory balloon size: 0 MB
Snapshots:
Name: snapshot1 (UUID: 57ac3601-49b4-4d92-b9df-a8fba4035285) *
}}}
%%
Now we can take a clone of this snapshot :\\
%%(background-color : #d3ee03 )VBoxManage clonevm Ubuntu2 --options keepdisknames --name Ubuntu3 --basefolder '/home/metskem/VirtualBox VMs/Ubuntu3' --register %%
This takes a couple of minutes to complete :
%%small
{{{
metskem@gneisenau ~ $ VBoxManage clonevm Ubuntu2 --snapshot snapshot1 --options keepdisknames --name Ubuntu3 --basefolder '/home/metskem/VirtualBox VMs/Ubuntu3' --register
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Machine has been successfully cloned as "Ubuntu3"
}}}
%%
And we should also change the vrdeport to prevent conflicts with the other VM :
%%(background-color : #d3ee03 )VBoxManage modifyvm Ubuntu2 --vrdeport=2338 %%
Listing what's on the file system shows :
%%small
{{{
metskem@gneisenau ~ $ find /home/metskem/VirtualBox\ VMs/
/home/metskem/VirtualBox VMs/
/home/metskem/VirtualBox VMs/Ubuntu2
/home/metskem/VirtualBox VMs/Ubuntu2/Ubuntu2.vbox
/home/metskem/VirtualBox VMs/Ubuntu2/Ubuntu2.vbox-prev
/home/metskem/VirtualBox VMs/Ubuntu2/Ubuntu2Disk.vdi
/home/metskem/VirtualBox VMs/Ubuntu2/Logs
/home/metskem/VirtualBox VMs/Ubuntu2/Logs/VBox.log.2
/home/metskem/VirtualBox VMs/Ubuntu2/Logs/VBox.log
/home/metskem/VirtualBox VMs/Ubuntu2/Logs/VBox.log.1
/home/metskem/VirtualBox VMs/Ubuntu2/Snapshots
/home/metskem/VirtualBox VMs/Ubuntu2/Snapshots/{f2164651-5e1f-41a1-91e4-b29a6ca48786}.vdi
/home/metskem/VirtualBox VMs/Ubuntu2/Snapshots/{07ea6270-23e6-450a-8c7a-2f00821967fb}.vdi
/home/metskem/VirtualBox VMs/Ubuntu2/Snapshots/2012-01-02T17-59-06-647401000Z.sav
/home/metskem/VirtualBox VMs/Ubuntu3
/home/metskem/VirtualBox VMs/Ubuntu3/Ubuntu3
/home/metskem/VirtualBox VMs/Ubuntu3/Ubuntu3/Ubuntu3.vbox
/home/metskem/VirtualBox VMs/Ubuntu3/Ubuntu3/Ubuntu2Disk.vdi
/home/metskem/VirtualBox VMs/Ubuntu3/Ubuntu3/Logs
/home/metskem/VirtualBox VMs/Ubuntu3/Ubuntu3/Logs/VBox.log
/home/metskem/VirtualBox VMs/Ubuntu3/Ubuntu3/Snapshots
/home/metskem/VirtualBox VMs/Ubuntu3/Ubuntu3/Snapshots/2012-01-02T17-59-06-647401000Z.sav
}}}
%%
So, it's not a good idea to name the vdi after the VM it is attached to.
Also, you may see that the network of the cloned VM is not coming up , in that case you have to "rename" the NIC by editing /etc/network/interfaces (etho ==> eth1)
! Resizing HD
The {{modifyhd}} subcommand allows you to resize a harddisk :\\
%%(background-color : #d3ee03 )VBoxManage modifyhd f1533722-250b-4bdc-8736-964bc6cbcfd7 --compact --resize 10000 %%
%%small
{{{
metskem@gneisenau ~ $ VBoxManage modifyhd f1533722-250b-4bdc-8736-964bc6cbcfd7 --compact --resize 10000
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
}}}
%%
After starting the VM and logging in, you can see the size of the disk has increased:\\
%%small
{{{
root@ubuntu:~# fdisk -l
Disk /dev/sda: 15.7 GB, 15728640000 bytes
255 heads, 63 sectors/track, 1912 cylinders, total 30720000 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0008fd7a
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 499711 248832 83 Linux
/dev/sda2 501758 10237951 4868097 5 Extended
/dev/sda5 501760 10237951 4868096 8e Linux LVM
........
}}}
%%
At line 413 added one line
Teleporting (Live Migration) cannot be used since this requires shared storage (which I don't have).
At line 415 added 23 lines
%%small
{{{
VBoxManage createvm --name Ubuntu2 --ostype Linux --register
VBoxManage showvminfo Ubuntu2
VBoxManage unregistervm Ubuntu2 --delete
VBoxManage modifyvm Ubuntu2 --memory=256 --hwvirtex=off --hwvirtexexcl=off --vtxvpid=off --boot1=dvd --boot2=disk --boot3=none --nic1=bridged --bridgeadapter1=wlan0 --nicpromisc1=allow-all --vrde=on --vrdeport=13389
VBoxManage storagectl Ubuntu2 --name='IDE Controller' --add=ide --controller=PIIX4 --bootable=on
VBoxManage storagectl Ubuntu2 --name='SATA Controller' --add=sata --controller=IntelAhci --bootable=on
VBoxManage storageattach Ubuntu2 --storagectl='IDE Controller' --port=1 --device=1 --type=dvddrive --medium=/home/metskem/iso/ubuntu-11.10-server-i386.iso
VBoxManage list dvds
VBoxManage createhd --filename '/home/metskem/VirtualBox VMs/Ubuntu2/Ubuntu2Disk.vdi' --size=5000
VBoxManage storageattach Ubuntu2 --storagectl='SATA Controller' --port=1 --device=0 --type=hdd --medium='/home/metskem/VirtualBox VMs/Ubuntu2/Ubuntu2Disk.vdi'
VBoxManage startvm Ubuntu2 --type=headless
VBoxManage modifyvm Ubuntu2 --boot1=disk --boot2=dvd --boot3=none
VBoxManage snapshot Ubuntu2 take snapshot1 --pause
VBoxManage list --long runningvms
VBoxManage clonevm Ubuntu2 --options keepdisknames --name Ubuntu3 --basefolder '/home/metskem/VirtualBox VMs/Ubuntu3' --register
VBoxManage modifyvm Ubuntu2 --vrdeport=2338
VBoxManage modifyhd f1533722-250b-4bdc-8736-964bc6cbcfd7 --compact --resize 10000
}}}
%%