From MEPIS Documentation Wiki

Jump to: navigation, search



Partimage is an ncurses-based console program used to backup and restore partitions on a hard drive. It can back up the contents of a partition to a file, and then later restore them from that file to the same or different partition. Partimage is not limited to backing up and restoring partitions only, entire hard disks can be imaged and restored if you have a second hard disk or a network with available space.

Partimage should only be used to backup or restore partitions or disks that are unmounted. This means that you will need to run it off a Live CD if you intend to back up your root partition. MEPIS 6.5 users have the application already on their LiveCD. MEPIS 7,8, and 8.5 users can install it from the repositories for use with partitions other than root, but for the root partition either use a MEPIS 6.5 LiveCD, or create a SystemRescueCD which contains a number of rescue tools including Partimage.

Graphic Procedure

Follow the following procedure:

  • If you are backing up your home or root partitions, boot from the LiveCD.
  • Open a terminal, become root, and enter the command:
  • The GUI that pops up is pretty self-explanatory, but screenshots can be seen here
  • For details, see documentation link below.

CLI Procedure

By default, each user account in MEPIS has its own Backup folder and if you initially installed Mepis with /home on a separate partition, you can create a backup image of your existing Mepis system without having to remember any commands. Make a new blank text file in your /home/yourname/Backup folder and give it a name like "backupmepis" then copy the code below into the text file, edit it if necessary to match your systems layout and save it and close it. Right click the file, choose Properties and under the Permissions tab, set it to executable and save the changes.

These example scripts will backup and restore the first partition on the primary master IDE hard drive. Change all instances of /dev/hda1 to /dev/sda1 if you want to backup the first partition of the first SATA drive. If you're not sure what you have, check with your /etc/fstab file, which looks something like this:

# Pluggable devices are handled by uDev, they are not in fstab
/dev/sda1 / ext3 defaults,noatime, 0 0
/dev/sda2 swap swap sw,pri=1 0 0
/dev/sda3 /home ext3 defaults,noatime, 0 0
none /proc proc defaults 0 0

The first line of your /etc/fstab file is usually the one with your Mepis / as in the example above where hda1 would need to be changed to sda1 for the following script to work.



su -c "umount /dev/hda1
dd if=/dev/hda of=./grub.mbr count=1 bs=512
sfdisk -d /dev/hda > ./p-table.sf
partimage -z1 -o -V 100 save /dev/hda1 ./mepis
mount -a"

When you next boot your system with the Mepis Live CD, locate and mount your /home partition and using konqueror, locate and open the Backup folder that contains the script then press the F4 button above your keyboard to open a konsole window.

Type a full stop, then a forward slash and the first letter of the name of the file you created and press your tab key to autocomplete the line and press enter to start the script. If you named the file backupmepis as in the example above, you would type ./b and press tab to autocomplete the line which should look something like demo@Backup$ ./backupmepis. There is no need to be root because the script will ask you for the root password

Press the F5 button on your keyboard, type in a description if you want to, press F5 two more times and watch the script do its magic. Typically, the image will be 40-60 % smaller than the installed size. When the script is finished, it will remount all partitions if required and return you to a prompt. Closing the konsole window and refreshing the konqueror view will reveal the image backup.


As above, edit this script to suit your system:


su -c "umount /dev/hda1
# dd if=./grub.mbr of=/dev/hda
# sfdisk /dev/hda < ./p-table.sf
partimage -b restore /dev/hda1 ./mepis.000
mount -a"

As above, make a new blank text file in your /home/yourname/Backup folder and name it something like restoremepis, copy the code above into the file, save it and make it executable. If you wanted to restore only grub or the partition table, you could remove the hashes from lines 3 and 4 and add a hash to line 5.

Restoring an image requires the same method to access the /home/yourname/Backup folder from a live CD, opening a konsole by pressing the F4 key above your keyboard and typing ./restoremepis but this time, the moment you press your enter key, the process starts and there can be no turning back. Typically, the process takes between 3-10 minutes to run depending on your hardware and how much software you have installed on your root partition. When the process is complete, you can restart your system and mepis will be fully restored.

Special notice - these scripts will not run if they are on a ntfs formatted partition that is being accessed by the Linux ntfs-3g driver, but copying and pasting everything below the #!/bin/sh into the konsole window will work just fine. To paste copied text into a konsole, copy the text as you normally would but use your middle mouse button to paste the text, then press your enter key.

Partimage can also be run over a network in a client-server fashion using the partimaged server. This requires a bit of setup on the server end, see the documentation linked below.


Personal tools