Other Suggestions for archiving USB sticks

I have acquired a large number of USB sticks over the years and would like to archive them in order to recover them if necessary at some point after deleting their contents. Most of them have a lot of free space so simply DDing them would create a lot of wasted space.
Can someone suggest a way of creating a restorable image which ignores free space? Or is there a utility which can do this? Not sure if clonezilla can do this sort of thing, but that isn't available on FreeBSD.
 
Write the free space full of binary zeros and then compress the image.

Or store them uncompressed on compressed ZFS, that way you can also mount them directly. That is what I do with full-disk backups.
 
For simplicity dd will beat every other solutions, one command and it's done.
To reduce the size of the image gunzip can be used but it won't save as much space as you would expect I agree, but still it worth it.

I did a quick test with an old usb stick (32G) which has OPNsense on it :

$ lsblk da0
DEVICE MAJ:MIN SIZE TYPE LABEL MOUNT
da0 1:199 29G GPT - -
da0p1 1:200 33M efi msdosfs/EFISYS -
da0p2 1:201 64K freebsd-boot - -
da0p3 1:202 512K freebsd-swap - -
da0p4 1:203 1.5G freebsd-ufs ufs/OPNsense_Install -

$ doas dd if=/dev/da0 conv=sync bs=64K | gzip --stdout > ~/usb_stick_1_backup.gz
$ ls -lh ~/usb_stick_1_backup.gz | awk '{print $5}'
16G


Doing a raw backup image takes 29G while the compress one is 16G, not that bad, but yep that's far from the original used space which is less than 2G.

There is tool like rescuezilla which is a clonezilla GUI that you might like but in the end it depends a lot on what filesystem is on the usb stick, so it will work or may be not.
That's the reason why I prefer dd.
That being said if you know for sure that your filesystem is supported by the tool then go for it if you prefer that.
 
Actually I want a single solution for all my USB sticks without bothering inspecting them.

As you mention clonezilla, which I used in the past, I may consider using that, if I can work out how I set it up. It's a shame that such a useful utility is not available for FreeBSD. Apparently it is written in PERL but must use lots of Linuxisms making it impossible to port.
 
Back
Top