I have a completely configured Linux system installed on a 16GB USB drive. I have the same brand/type of USB drive 10 times and the exact same mainboard 10 times.
Now I want to copy the USB drive to the others so I can have 10 systems use the same image.
What I did was create an image of the USB drive using WinDiskImager32 and then I tried writing it back to the original USB drive. That worked because it's the same drive but as soon as I tried to write it to the other USB drives it failed because the image was too big for those drives. Even though they are all 16GB, in reality of course there are always minor differences.
Obviously this is not the correct way of doing this, so I'm wondering how do I correctly "clone" my original USB so that I can deploy it on the others?
(Note, the system is configured to deal with the fact that it's installed on a new computer, so that's not an issue here, just need to get an exact copy)
Based on WesleyDavid's answer I check the drive with gparted and remebered that I originally copied the image from a 8GB device using WinDiskImager32 so the partition is already small enough.
The problem is that WindDiskImager copies the entire drive, not just the partitions.
Now the 'dd' solution fixes that by only copying a partition but then how do I get both the ext2 and swap filesystem on the target usb?
Using dd to copy the entire device results in the full 16GB again which won't always fit on the other devices
Using dd as sugested by WesleyDavid works,
just had to use the count parameter of dd, as described here
Basically it means running "fdisk -u -l /dev/sdb" (replace sdb with your device)
> Disk /dev/sdb: 16.3 GB, 16257318912 bytes 64 heads, 32 sectors/track, > 15504 cylinders, total 31752576 sectors Units = sectors of 1 * 512 = > 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O > size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: > 0x000392d4 > > Device Boot Start End Blocks Id System > /dev/sdb1 * 2048 13672447 6835200 83 Linux > /dev/sdb2 13674494 15818751 1072129 5 Extended > /dev/sdb5 13674496 15818751 1072128 82 Linux swap
In my case the end of the last partition is at '15818751' so I used:
dd if=/dev/sdb of=/home/myusername/usbimage.img count=15818752
adding one more just to be safe. That gave me an image that I can install.