How to clone Linux hard drive to smaller flash drive
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
How to clone Linux hard drive to smaller flash drive
Currently, I'm trying to clone a hard drive that has Linux installed to a 16GB flash drive. The hard drive is 233GB, but df -h shows that only 3.5G is in use. Can I use clonezilla to create an image using just the allocated amount of space and copy it to a flash drive, where I can deploy the image to other Linux laptops?
Yeah. I'm using Parted Magic so I'm using Clonezilla from there. I tried doing device-image and it gets part of the way done, then throws the error
split /home/partimag/lubuntu.img/lubuntu-vg-root.ext4.ptcl-img.gz.aa: Input/output error
Checking the disk space...
Failed to save partition /dev/lubuntu-vg/root.
Press Enter to continue
Distribution: Mainly Devuan, antiX, & Void, with Tiny Core, Fatdog, & BSD thrown in.
Posts: 5,493
Rep:
Some distros, such as antiX & MX Linux, come with the ability to do that, they call it a 'snapshot' (of your present system), & can create a bootable version to put onto a pendrive/SDHC card, for installing to other machines.
I too only remember failing at this. I also failed at creating a USB key with a cryptsetup encrypted harddrive.
You can dd a partition, but you'll have to shrink it first. I don't know why it did not work to (A) make a Ubuntu Live pendrive (B) delete the main partition (C) shrink my harddrive's main partition, and (D) dd the shrunken partition onto a bootable USB drive. If it worked, I would remember it.
Currently, I'm trying to clone a hard drive that has Linux installed to a 16GB flash drive. The hard drive is 233GB, but df -h shows that only 3.5G is in use. Can I use clonezilla to create an image using just the allocated amount of space and copy it to a flash drive, where I can deploy the image to other Linux laptops?
What filesystem type??
You could use dump/restore (or xfsdump/xfsrestore). man pages of these commands have good examples.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.