Note you will see the following differences which are all OK If you want to check that the copy has worked correctly then run You may also get a warning that some files/attrs were not transferred. You may get a warning about not being able to copy. You should just see the one file called lost+foundĪssuming you are not using an encrypted home partition then run the following: Run a df again first to make sure and don't use a drive if it's listed.Īfter formatting the drive it can be mounted to a temporary mount point This will destroy all data on the partition and will NOT ask for confirmation before formatting the drive. MAKE SURE YOU ARE RUNNING THIS AGAINST THE CORRECT PARTITION. You can now format it as a Linux (ext4) partition using You will now have a new partition with the device name previously but with a 1 on the end. Use NEW to create a new partition - accept the defaults of primary and use the entire disk size. Partition the drive using the following command making sure that you use the correct drive.Ĭheck that there are no partitions already defined and that the size in the top right matches the size of the drive you created. The physical drives are the ones without a digit on the end, which on my system are sda and sdb (sdb is the one that's in use and so sda must be our new disk drive). This may be different on your computer - MAKE SURE YOU CHECK!Īnd look what other drives exist. In this case it's at /dev/sdb1 and so we need to make sure we don't do anything to drive sdb as that's our main operating system and current home directory. We can fix this later.Īssuming that /etc/fstab uses the UUID (blkid command) of the disk drive then it should not matter if the disk allocation has changed for the drive.įrom a terminal run df to determine the drive used for your root hard disk SATA 1 instead of SATA 0) or reboot and press F12 to boot from the second hard disk. You can either go back to the settings and change the drive to a higher slot location (eg. Start the virtual machine - boot using the existing driveĭepending upon how the disk has been attached it may complain about not being a bootable drive. SATA 0 is normally /dev/sda - SATA 1 is normally /dev/sdb). A lower SATA port number will result in a lower drive allocation (eg. You can also change the drive slot allocation by click on the drive in question and looking at the attributes shown to the right.
#How to use virtualbox with a partition install
Choosing a later filename (alphabetical) may avoid having to install grub onto the new disk (the last step). It does not matter as we will be using a unique non-changing reference for each drive, but this will determine the exact commands that need to be run. I believe the name of the disk drive determines the order initial order in which it is listed and hence the drive letter allocated. I created one approximately 30GB in size. Running the cfdisk / mkfs commands outside of the virtual machine could damage your host computer.Ĭreate a second disk drive through the virtual machine managerĬhoose a dynamically allocated disk and choose a large size - it will only use the size required, but can then expand so hopefully you won't need to go through this again. If you are using Linux as the host computer for the virtual machine then make sure you enter the commands on the appropriate system. Do NOT copy and paste the commands I have used unless you are 100% sure that you have the same setup as mine. the drive letters mentioned below may not match your virtual machine in which you will need to change the drive reference in the commands or you will lose data. WARNING - if run incorrectly you could lose all your data. I have updated this after some more research into how VirtualBox handles drive allocations.įirst backup / clone your vm if not already done so.
#How to use virtualbox with a partition android
It's based on VMDK and Virtualbox does not have support for resizing a VMDK disk.Ī lot of the space was used in the home directory (in my case this was different versions of Android software development kit) I added a second virtual drive and migrated the home partition over to the new drive, similar to how I've done it with real physical disks on servers before. Normally I use a dynamic disk that allows resizing (typically setting it to be much larger than I expect to use), but in this case I am using a virtual disk provided for me. Recently I ran out of space when using a Virtualbox virtual machine.