Install Ubuntu on a real hard drive via VirtualBox
For some reason, it may turn out that you need to install Ubuntu on a computer on which Windows is installed (in this case it was Windows Server 2003). Why is it specifically about Windows? Under Linux, there are other solutions, there is debootstrap and chroot, and on Windows there are fewer options for such a maneuver.
But the usual installation method (boot from LiveCD / LiveUSB, install, configure everything, reboot again) does not always work. Why not always? Because it may be that access to the computer is only remote (in this case it was an RDP server in Windows), and physical access only through another person, and rare (once a day). And then, no matter how much action is required from him, if you do it in the usual way - insert a flash drive / disk, boot, wait until you are offered to try using the distribution kit, select this option, then configure remote access (in Ubunt, even the SSH server is not installed by default - never, by the way, did not understand why, but fact), and only after that go about their business. And so the only thing that was required from a person was to change the boot order from hard disks in the BIOS.
By the way, theoretically, you can try to do even without this, if you unzip grldr from the grub4dos package to C: \ on Windows, create menu.lst in the same place (where you can boot from another hard drive using chainloader), and add it to C: \ Boot .ini item “C: \ grldr =“ GRUB ””, then select this item by default. Then just restart the computer, and it will reboot into Ubuntu, where at that time there will already be SSH. Just do not forget to add the timeout parameter to the menu.lst configuration file - otherwise the download will not be completed automatically (GRUB will wait for someone to press Enter).
In addition to remote installation, there is another important application of this method - imagine that you need to reduce the time that the server will not function from the user's point of view to a minimum. And you can do it. From the fact that you install Ubuntu in a virtual machine, the server will not be affected, and you can reboot the virtual machine after installation and make all the necessary changes, including creating users, installing and configuring SSH, possibly a web server, mail server, FTP and everything else you might need. And then you just restart your computer. And everything that worked on Windows now works on Ubuntu: the one and a half minutes that the computer will reboot are not at all as noticeable as the few hours during which you would gradually set it up and turn it on.
VirtualBox has a very useful feature. In addition to virtual hard disks, you can connect a real, real hard disk to a virtual machine.
To do this, create a special file for the hard disk in vmdk format.
This file takes about 1 kb, although you would think that it would take a size comparable to the hard drive itself. :)
Open cmd.exe and do the following.
cd “C: \ Program Files \ Oracle \ VirtualBox”
VBoxManage internalcommands createrawvmdk -filename c: \ disk.vmdk -rawdisk \\. \ PhysicalDrive0
Instead of PhysicalDrive0, for example, there may be PhysicalDrive1 depending on the serial number of the hard disk.
By the way, there is even the opportunity to use specific sections of the physical hard disk, you can read more about this in the VirtualBox documentation .
Once you have created a vmdk file, you can create a new virtual machine and connect this hard drive to it.
Open the VirtualBox GUI, click “New”, then enter the name of the virtual machine and select OS Type (Linux, Ubuntu). We select the amount of memory (it’s good when it is not less than the gigabyte, but we must proceed from how much memory the computer itself has and how much it is used). Then, in the Virtual Hard Disk section, select “Use existing hard disk”. Now you can click “Finish” and load a new virtual machine. She will use the selected physical disk of the computer. It remains to connect the Ubuntu ISO image to it and perform the installation (after which reboot the virtual machine and make all the necessary changes - in order to load the already configured system on the computer).
The hard drive is fully and completely connected - this means that through the virtual machine, the Ubuntu installation program has successfully created the partition table, recorded the MBR and placed all the necessary files.
This turned out the installation method. Now, if you change the operating system from Windows to Ubuntu on some server or, say, remotely on a friend's computer - at his request, of course :) - you can use this option.
But the usual installation method (boot from LiveCD / LiveUSB, install, configure everything, reboot again) does not always work. Why not always? Because it may be that access to the computer is only remote (in this case it was an RDP server in Windows), and physical access only through another person, and rare (once a day). And then, no matter how much action is required from him, if you do it in the usual way - insert a flash drive / disk, boot, wait until you are offered to try using the distribution kit, select this option, then configure remote access (in Ubunt, even the SSH server is not installed by default - never, by the way, did not understand why, but fact), and only after that go about their business. And so the only thing that was required from a person was to change the boot order from hard disks in the BIOS.
By the way, theoretically, you can try to do even without this, if you unzip grldr from the grub4dos package to C: \ on Windows, create menu.lst in the same place (where you can boot from another hard drive using chainloader), and add it to C: \ Boot .ini item “C: \ grldr =“ GRUB ””, then select this item by default. Then just restart the computer, and it will reboot into Ubuntu, where at that time there will already be SSH. Just do not forget to add the timeout parameter to the menu.lst configuration file - otherwise the download will not be completed automatically (GRUB will wait for someone to press Enter).
In addition to remote installation, there is another important application of this method - imagine that you need to reduce the time that the server will not function from the user's point of view to a minimum. And you can do it. From the fact that you install Ubuntu in a virtual machine, the server will not be affected, and you can reboot the virtual machine after installation and make all the necessary changes, including creating users, installing and configuring SSH, possibly a web server, mail server, FTP and everything else you might need. And then you just restart your computer. And everything that worked on Windows now works on Ubuntu: the one and a half minutes that the computer will reboot are not at all as noticeable as the few hours during which you would gradually set it up and turn it on.
And now about the installation itself
VirtualBox has a very useful feature. In addition to virtual hard disks, you can connect a real, real hard disk to a virtual machine.
To do this, create a special file for the hard disk in vmdk format.
This file takes about 1 kb, although you would think that it would take a size comparable to the hard drive itself. :)
Open cmd.exe and do the following.
cd “C: \ Program Files \ Oracle \ VirtualBox”
VBoxManage internalcommands createrawvmdk -filename c: \ disk.vmdk -rawdisk \\. \ PhysicalDrive0
Instead of PhysicalDrive0, for example, there may be PhysicalDrive1 depending on the serial number of the hard disk.
By the way, there is even the opportunity to use specific sections of the physical hard disk, you can read more about this in the VirtualBox documentation .
Once you have created a vmdk file, you can create a new virtual machine and connect this hard drive to it.
Open the VirtualBox GUI, click “New”, then enter the name of the virtual machine and select OS Type (Linux, Ubuntu). We select the amount of memory (it’s good when it is not less than the gigabyte, but we must proceed from how much memory the computer itself has and how much it is used). Then, in the Virtual Hard Disk section, select “Use existing hard disk”. Now you can click “Finish” and load a new virtual machine. She will use the selected physical disk of the computer. It remains to connect the Ubuntu ISO image to it and perform the installation (after which reboot the virtual machine and make all the necessary changes - in order to load the already configured system on the computer).
The hard drive is fully and completely connected - this means that through the virtual machine, the Ubuntu installation program has successfully created the partition table, recorded the MBR and placed all the necessary files.
This turned out the installation method. Now, if you change the operating system from Windows to Ubuntu on some server or, say, remotely on a friend's computer - at his request, of course :) - you can use this option.