Other Archiving a disk

What is the recommended way of archiving a disk? ie especially a disk which has a lot of free space. I'm thinking of a bootable Windows disk....
 
The first think I would do is shrinking it first by Windows means (Disk Manager).
Of course, you can also use ntfsresize from sysutils/fusefs-ntfs.

But wouldn't that just shrink the partition? I would like to be able to restore the disk from a compressed image. Not sure if Clonezilla can be configured to compress disk images... or maybe it does so automatically... Must check...
 
What is the recommended way of archiving a disk? ie especially a disk which has a lot of free space. I'm thinking of a bootable Windows disk....
Depends on a lot of aspects. What's on the disk?

How many partitions ("slices") exist? And what filesystem(s) were used for those?

If you want to dump a disk one on one you'd use dd. As you said yourself: this would also copy useless space. But to cover for that you'll need to know the filesystems involved.

For example: I'd use dump if I was dealing with a UFS based filesystem, most likely # zfs send <stuff> when ZFS got involved, and so on...

It depends...
 
I would like to be able to restore the disk from a compressed image.
Yes, so if it's the last partition, everything is simple, right? If not, you can archive partitions separately as well as the MBR (or less likely GPT).
As you said yourself: this would also copy useless space.
Here is what I do in reasonable situations: I create a file filled with zeros to occupy the available empty space, then I delete it. That way the image becomes very compressible.
 
What do you mean by "archiving"? Do you want a backup of the files on disk? Or do you want to be able to create a bit-identical copy of the disk, for booting (remember, booting requires more than just files in file systems, it also requires partitions, partition tables, boot blocks, and files in certain locations). How do you want to restore these backups? Is the disk shared with other OSes?

If the disk is not shared with other OSes, I would start by doing what aragats says (write very large files containing only zero, until the disk is nearly full), and then I would unmount the disk from Windows (shut Windows down), attach it to a FreeBSD machine (which might be the same physical computer, just booted into FreeBSD), and then simply use a compression program, reading directly from /dev/adaX (including all boot blocks and partition tables), and writing to a file in a FreeBSD file system (pick a file system with enough free space). Look at the man page for something like bzip2, how to select separate input and output files instead of compressing in place.
 
Back
Top