Wednesday, 15 November 2017

partitioning - VirtualBox - split partitioned VDI into separate VDIs


I'm very new to VirtualBox. I set up an Arch Linux VM and a Ubuntu VM (Ubuntu host), both sharing the same .vdi like so (I had in my mind a dual-boot situation):


VDI file (25GB)
|- /dev/sda1: 5GB (Arch Linux)
|- /dev/sda2: [Ubuntu]
|- /dev/sda5 (swap, 1GB)
|- /dev/sda6 Ubuntu /, 9GB
|- /dev/sda7 Ubuntu /home, 10GB

I've now realised that I don't want a dual-boot-type setup, I'd rather boot each machine independently (my initial thought was to share /home between Ubunto and Arch).


So, my question: Can I split /dev/sda1 and /dev/sda2 each to their own .vdi files so I can use them as completely separate machines? I'd rather not have to re-install either Arch (because it took me ages to work it out!) or Ubuntu (because I've already done a few GB of updates and don't want to redo them).


I haven't been able to find anything about this - most questions I see are about converting a .vdi to a partition on the host, or splitting a .vdi into multiple smaller files (that are not independent), or converting a partition on the host to a .vdi file.


cheers.



Answer



Based off @AnsgarWiecher's comment of not being aware of a way to split the file, I did the following:


In virtualbox:



  • select the VM

  • select 'Clone' and 'Full Clone' to create a new .vdi file (it is 25GB though, and contains the dual-boot setup).

  • Boot into this new machine into Arch, and delete the Ubuntu partitions.

  • Resize the .vdi to contain just the Arch partition(s)


This is the new arch-only machine.


Now I can boot up into the original (non-clone) dual-boot machine, and remove Arch from it similarly so that I end up with an Ubuntu-only machine.


No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...