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.
Hello. I was wondering if someone could help with a question about cloning a USB drive with Linux on it. We have a drive that is 4GB and has 3 partitions on it with ext2 file systems in them. The drive is used for loading the OS for a commercial machine.
We bought a Startech USB cloner/duplicator with the intent of cloning the drive to another 4GB drive however the sizes aren't the same. The source is 3920MB and the destination is 3782MB so the duplicator won't start the clone.
I don't know much about Linux. Is there a way to create these 3 partitions manually and resize/shrink the last partition to make it fit? Then we would copy the contents of each partition and make the drive bootable? Is this something that can be done?
I have some knowledge of doing this in diskpart and using windows tools like bcdedit to set the boot configuration but I don't know anything about how Linux does these things.
I don't know much about Linux. Is there a way to create these 3 partitions manually and resize/shrink the last partition to make it fit? Then we would copy the contents of each partition and make the drive bootable? Is this something that can be done?
Yes, that's quite easy to do. The best tool for partitioning is gparted. There's a CD image called SystemRescueCD which has this and many other useful tools on it. You can use gparted to create partitions of the sizes you want. The copying can be done with various tools; I would go with fsarchiver which is also on SystemRescueCD. Basically it will pack a filesystem up and you can then unpack it on the appropriate partition on the new drive.
If your computer has a UEFI, you set the bootloader up on the EFI system partition and register it using efibootmgr, which is a sort of Linux equivalent to bcedit. I think GRUB is the bootloader most commonly used for this sort of thing nowadays but a lot of flash images boot with syslinux.
Changing the partition sizes will be irrelevant - the cloner will presumably count sectors on the physical device. Bigger drive(s) is the answer - if you have to use (nominally) 4G go buy a bunch, and check the real size with say fdisk. Pick an appropriate one.
Thank you all very much for the help. I greatly appreciate it. I am trying to find a drive to match so I probably won't need to try to make this work with parted or other commands.
Just as a curiosity though, is it possible to resize the last partition to shrink it to the size available on the smaller drive and then copy boot configuration and files from the 3 partitions to the new drive and have the new drive work the same and behave as if it was cloned?
Just as a curiosity though, is it possible to resize the last partition to shrink it to the size available on the smaller drive and then copy boot configuration and files from the 3 partitions to the new drive and have the new drive work the same and behave as if it was cloned?
Yes - but the physical cloner is the better option if you can find a drive of at least the same number of sectors.
Shrink the filesystem, then the partition, then when happy simply dd the device over specifying a block count. Don't get cute - copy a size that is slightly bigger than the total allocated on the source device, but will fit into the target device. Doesn't have to be exactly the target size. Give yourself a few megabyte leeway if you can.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.