Use Gparted to resize the Ubuntu OS installation to a size small
enough to fit on your USB drive. You can resize it to 12GB.
Use DD or a GUI drive backup utility such as Clonezilla to backup
the 12GB drive to the USB stick. Your USB stick should now be
bootable as if it were your original hard drive.
For Virtualization converting the USB drive to VDI use
VBoxManager.
You can store the 12 GIG USB drive as an image DD or Ubuntu's GUI
Disk Manager.
The Steps in detail
You'll have to use a Live session (or a different boot drive to run Gparted. The drive can't be in used while performing the resize.
- Backup your Disk to the USB stick.
You can back it up with this commandline using DD:
$ dd if=[source drive/image] of=[destination drive or image] bs=4M status=progress
Source Drive - The USB stick (ie /dev/sdb, /dev/sdc, etc)
Destination drive or image:
You can also use the GUI method via Clonezilla to backup the harddrive to USB drive (or an image).
- Convert to a Virtual Disk
If you backed up the drive as an image, use this command to create a VirtualBox image:
$ VBoxManage convertdd input.img output.vdi
Use this command to create the VirtualBox image from the USB drive itself:
$ VBoxManage convertfromraw /dev/sdX MyImage.vdi --format VDI
(The /dev/sdX
will be /dev/sda
, /dev/sdb
, (or the appropriate device of your USB drive.))
You can transfer Device to Device using Clonezilla
The Clonezilla application has the option of transferring your USB drive (device) directly to your HardDrive (device).
Summary
After you have transferred the Smaller USB drive to the larger Hard Drive, you will have to use Gparted to resize the Drive/Partitions to regain the space available on the larger hard drive.