I'm searching for a tool to backup a whole ext4 partition to an image. I tried the latest version of mondo, which is not working. What are good alternatives?
Reportedly made by the same guy who authored partimage.
It sports a lot of improvements including:
- ext4 support
- ntfs support
- file-level instead of block-level
- compression using multiple cores
Basically, after a partition is saved/compressed it can be restored to different size partitions, and partitions of different formats (so you can use it to convert a partition's format too), and if part of the backup gets corrupted it doesn't destroy the whole image (like it would on a block-level backup.
The only downside (if you consider it a downside) is, it's only a command line app at the moment (but it should get a gui eventually).
Just reverse the options above. From what I understand (in the documentation), it looks like the id=0 is necessary because an image can contain multiple partitions. For more directions on usage (such as saving multiple partitions) checkout the QuickStart guide.
SideNote:
As it turns out, I'm actually writing this (as entertainment) from a Linux Mint LiveCD while I'm cloning a newly updated windows factory install clone. I scoured the net earlier looking for a better partition cloning alternative because I want to finally trash this Ghose '03 disc that I've been using for years. I'll drop a note to let you know how it went after I finish the restore.
Update:
Just finished the backup with no errors. It took a little while because I didn't know about the options to make it multi-threaded when I started. The compression was set to the default value (equivalent to gzip -6), the partition was 4.48GB on disk (highly trimmed/updated XP + Chrome) and the output file weighs in at 2.3GB. No complaints here.
Modern versions of e2image (1.42.7 or later) allow efficient cloning/backing up of Ext2/3/4 partitions from the command line.
e2image -ar /dev/sdaX ~/sdaX.img
-a ensures that file data, and not just the filesystem structure, is copied.
-r ensures that the data is stored in a raw image format (like you would get with dd), as opposed to QEMU's QCOW2 format.
The resulting image will be efficient in terms of disk space usage, because:
e2image will not copy blocks that are not in use by existing files
when outputting to an image file, it will store it as a sparse file, so that large blocks of zeroes will not take up any space on the disk.
Care still needs to be taken when copying sparse files, to ensure that the zeroes aren't written out when copied.
One way to avoid this is to store the image file inside a squashfs image. This is a read-only, mountable filesystem that compresses the data inside, but still allows the image file within to be seekable and mountable.
Try Clonezilla. It runs in a liveCD environment, and supports any sort of partition (including ext4), to a variety of stores (NFS, SMB, SSH, local filesystems).
I use it all the time to image workstations in our labs.
Why do you want to create an image? In most cases a file based backup (like a tar ball) gives you much more flexibility when restoring it, e.g. you can restore it on a different file system or even multiple file systems.
Take a look at fsarchiver
It can be found on the latest SystemRescueCD
Reportedly made by the same guy who authored partimage.
It sports a lot of improvements including: - ext4 support - ntfs support - file-level instead of block-level - compression using multiple cores
Basically, after a partition is saved/compressed it can be restored to different size partitions, and partitions of different formats (so you can use it to convert a partition's format too), and if part of the backup gets corrupted it doesn't destroy the whole image (like it would on a block-level backup.
The only downside (if you consider it a downside) is, it's only a command line app at the moment (but it should get a gui eventually).
The command line entries are really simple.
To save a partition:
Where '/mnt/backup/gentoo-rootfs.fsa' is the path being saved to and '/dev/sda1' is the partition being cloned.
To restore a partition:
Just reverse the options above. From what I understand (in the documentation), it looks like the id=0 is necessary because an image can contain multiple partitions. For more directions on usage (such as saving multiple partitions) checkout the QuickStart guide.
SideNote:
As it turns out, I'm actually writing this (as entertainment) from a Linux Mint LiveCD while I'm cloning a newly updated windows factory install clone. I scoured the net earlier looking for a better partition cloning alternative because I want to finally trash this Ghose '03 disc that I've been using for years. I'll drop a note to let you know how it went after I finish the restore.
Update:
Just finished the backup with no errors. It took a little while because I didn't know about the options to make it multi-threaded when I started. The compression was set to the default value (equivalent to gzip -6), the partition was 4.48GB on disk (highly trimmed/updated XP + Chrome) and the output file weighs in at 2.3GB. No complaints here.
Modern versions of e2image (1.42.7 or later) allow efficient cloning/backing up of Ext2/3/4 partitions from the command line.
-a
ensures that file data, and not just the filesystem structure, is copied.-r
ensures that the data is stored in a raw image format (like you would get withdd
), as opposed to QEMU's QCOW2 format.The resulting image will be efficient in terms of disk space usage, because:
Care still needs to be taken when copying sparse files, to ensure that the zeroes aren't written out when copied.
One way to avoid this is to store the image file inside a squashfs image. This is a read-only, mountable filesystem that compresses the data inside, but still allows the image file within to be seekable and mountable.
Try Clonezilla. It runs in a liveCD environment, and supports any sort of partition (including ext4), to a variety of stores (NFS, SMB, SSH, local filesystems).
I use it all the time to image workstations in our labs.
dump
andrestore
for ext4 (sudo apt-get install dump
) were just designed for that matter. Check this if you are curious:https://unix.stackexchange.com/a/41445
I like dd
and
to get it back
'Disks' (
gnome-disk-utility
) is default in Ubuntu these days.Why do you want to create an image? In most cases a file based backup (like a tar ball) gives you much more flexibility when restoring it, e.g. you can restore it on a different file system or even multiple file systems.
In addition to the filebased strategy: try the command rsync to backup your data.
A program similar to this is called Déjà Dup: https://launchpad.net/deja-dup