5

I have a full system installed on my PC. (Arch Linux on a laptop)

I need to test, edit, tweak this system (bootloader too) in a safe way because it is my workstation.

Is there a way to easily** clone/replicate the current system into a VM (I usually use gnome-boxes but software used doesn't matter)


** easy means: time needed to convert physical installed into virtual is less than install a VM from scratch


EDIT: As I guess and @Terence state, I need to copy the entire disk somewhere. The source disk is a 256GB SSD but I do not have any other medium large enough in which clone it entirely.

Is there a way to clone only the mandatory partitions (in my case: boot/EFI and root) roughly 50GB and the bootloader, while leaving behind others (home and swap) for the remaining 200GB?

In this case I will clone them in my $HOME directly!

0

2 Answers 2

4

I recommend to dump the disk to a file on external drive (for write speed and space).

# /dev/sda is assumed your laptop drive
dd if=/dev/sda bs=1M of=/path/to/external_drive_mounted/laptop_dump.raw

Then create a disk for virtualbox:

VBoxManage internalcommands createrawvmdk -filename /path/to/file.vmdk \
    -rawdisk /path/to/external_drive_mounted/laptop_dump.raw

This disk only points to the raw dump.

You can now create a virtual machine with this disk and play around.

0

Boot live Linux...

Run GParted, shrink your Ext4 system. Create a new partition for the dump.


And then, here's an example as root:

dd if=/dev/sda | bzip2 > /some/path/sda-dd.bz2

This could give you some advantage in the means of additional space.

1
  • This is a great solution for backupping. What I mean is for cloning the system
    – mattia.b89
    Aug 8, 2019 at 15:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .