1

Topic: Easily making compressed partition backups:

Hi, just a suggestion of a feature which I think could be very simply and quickly added to gparted...

I make compressed images of my various types of partitions using the following script (which I modified slightly from one I found on the net):-


dd if=/dev/hda1 bs=512 | gzip -c | split -b 100m - backups.img.gz.&

Then, to restore it to a partition:-

cat backups.img.gz.* | gzip dc | dd of=/dev/hda1&


This creates a consecutively named set of 100MB compressed files, which are automatically and perfectly rejoined when the files are copied back to a partition.

I find this advantageous in the following ways:

1. It's much smaller than the copied partition;
2. You don't need a special partition to put the backup in;
3. It can be stored on other filesystems;
4. It can be copied to cd's, dvd's or anything else at all;
5. It seems very stable;
6. It's quite quick;


It can be further optimized by first mounting the relevant filesystem, then filling any unused space with zero-filled files, eg:

mkdir TempZeros
   (do this inside a loop, till "no space left" type of error)
   dd if=/dev/zero of=TempZeros/File_001 bs=1000000 count=500
   dd if=/dev/zero of=TempZeros/File_002 bs=1000000 count=500
   etc...
   (loop ends here at error)
rm TempZeros (and whatever option removes contents, too)

If the empty space in the partiton is not zero'd this way, the compression will not work as well, and will take longer, as it has to compress everything which was on the partiton, even old, leftover deleted files. (but it will still work well, though...)


I envision that this could be added to gparted as a simple menu item, eg:-

1. You could select a partition to backup from the gparted main screen;
2. Then right-click it and choose "Make Compressed Backup" option;
3. Then from a list-box, select a destination partition (which would then be mounted, at /tmp/dest and a folder created in it like: <date>_<time>_backups;
4. A zeroing script could optionally be run at this point, first mounting the partiton to be copied, filling unused space with zeros, then unmounting it again.
5. The copying script would now be run;
6. Another script would then be run which made a copy of the MBR sectors and saved them to a file as well;
7. Lastly, the relevant line of output of "fdisk -l" would be redirected to a text-file and saved as well, so anyone looking at the backups later could determine the partition size, type, number etc., (and a restoring script could find out info from this file as well).


To restore partitions, you would right-click on a partition, then choose "Restore Compressed Backup", and then choose the partition (which would be mounted for you) and directory where the backups were stored.

Alternatively, you could include a script with the saved backups which would automate the backup process, giving some options along the way (like restoring to another suitable partition).


I hope this suggestion is appropriate, I have already mentioned some of these techniques/ideas before this, but thought I would go to the trouble of trying to put it down in a more complete way for the forum, as I thought it might be of some use perhaps?

All the best everyone, great program!  -rl

2

Re: Easily making compressed partition backups:

I'd like to support that feature request. I would be great to backup partitions/filesystems as files, eg. on fileservers (NFS, SMB, FTP) or DVDs. gparted would become a disk-cloning program, too (like norton ghost).

3

Re: Easily making compressed partition backups:

Thats a great idea wink

4

Re: Easily making compressed partition backups:

yep it is smile
It's somewhere an a huge TODO list which will get smaller as soon as i get more time and/or some people actually send patches smile

5

Re: Easily making compressed partition backups:

I agree thats a great (!!!) idea. And I think that many people will find it useful, so will I. Apps like Norton Ghost and Partition Magic are not cheap but they are very useful. Now we could have one free product with useful features which both of these commercial product have. Thank you for your great work!

6

Re: Easily making compressed partition backups:

I wanted to post this feature request too and discovered this thread.

I'm currently using gparted in systemrescuecd with "partimage". This tool can save & restore partitions and can be called from cli with arguments.

I'm not a developper but I think it would be possible to add 2 items on the contextual menu for partitions (save to image & restore from image), then popup a gtk file browser in order to select where the image is (or has to be) and finally run partimage with arguments respecting user input. This would leave the user with some easy steps to follow in a "dialog" menu.

Anyway, whatever the technical solution, this feature would really be great to have.

Regards,
Mikael

7

Re: Easily making compressed partition backups:

Well, Partimage is in the livecd. ATM it is not possible to make more ...

Larry
GParted-project Admin
Former GParted-LiveCD maintainer (2007)