1. What is Partimage?
"Partimage is a Linux/UNIX utility which saves partitions in many
formats to an image file.
The image file can be compressed in the GZIP/BZIP2 formats to save
disk space, and split into multiple files to be copied on removable
floppies (ZIP for example)
The partition can be saved across the network since version 0.6.0"
Partimage authors are Francois Dupoux and Franck Ladurelle
Partimage is freely distributed under the GPL 2 (GNU
General Public License)
Here is the Partimage home page
3. What are the limitations?
NTFS isnt fully supported. (I call that a benefit :-)
)
Here is a link to the Partimage FAQS
4. What software do I need?
All that you need are two floppies
1. The Partimage Boot Disk
2. The Partimage Root Disk
Everything is included on these disks
To use Partimage over the network, you must create your own Partimage
Boot disk that includes support for your NIC. See
here
5. How do I download and create the Partimage
Boot and Root disks?
You can download the raw images for these disks here
Look for "Boot & Root disks for Partition Image"
After downloading you will need to copy the raw images to a floppy
Under Linux:
6. What should I do to my Source drive
before backing up
It would be wise to clean out any junk you dont need
It would also be wise to run a file system check on your partitions
Here is an example under Linux
Boot your Linux Box with the bootable CDROM that comes with your
distribution
Type e2fsck
-f /dev/hda1 File
system check /dev/hda1 -f forces checking. Use -y to assume yes
to
all questions
Repeat e2fsck -f
/dev/hda6 Or whatever your other partitions are. You
cannot e2fsck swap or extended
Make sure the e2fsck version isnt too old.
I tried running e2fsck from the Boot/Root disk (V1.19 13 July 2000) on
my Ext3 partitions and it killed them
The e2fsck from my Mandrake 8.2 CD is V1.26 3 Feb 2002. I'm
pretty sure this had something to do with it.
You should also consider zeroing out any drives, slices or
partitions as well.
More info here
You will need a hard disk to store your backups
If you want to prepare one with a MS FAT partition go ahead.
I dont do the Microsoft thing anymore so you will have to find out how somewhere elseI will assume you want to prepare a backup disk with a Linux partition
Its really easy, here is howCreate and format the Linux partition
You are going to need to use utilities like FDISK to create the Linux partition
You are also going to need to use tools like MKFS to format the Linux Partition
You can get access to these utilities several ways.
1. Bootable Linux CDROM
2. Toms Root Boot Disk
1. Bootable Linux CDROM
If your computer supports bootable CDROM's, put your Linux CDROM into your drive and boot it up
I used the Mandrake 8.2 CD and hit F1 for more options and type rescue at the prompt
Hopefully your Linux distribution has this sorta rescue option
If you are stuck, there are many floppy and CD based Linux rescue disks with these and many other tools. Here are some links
Choose go to console from the list of options
Type fdisk/dev/hda (I am assuming your backup disk is Primary Master)
Type p To show the existing partition structure. (Make your decision now as to what partitions you want to keep or remove)
Type d To delete any partitions. (To delete any existing partitions you no longer need)
Type n To start creating a new partition
Type p To select a primary partition
Type 1 To select primary partition number 1
Type 1 To enter the starting cylinder (Enter defaults to 1)
Type x To enter the size in MB, KB or cylinder (Enter default to last cylinder)
Type p To confirm your settings
Type w To write the partition table to diskFormatting the partition with parted
Type parted This starts the partition editor parted.
Enter mkfs 1 ext2 This tells parted to format minor number 1 (in my case, the partition /dev/hda1) using ext2Your Linux backup disk is ready
2. Toms Root Boot Disk
Tom Oehser is the creator of TOMSRTBT "The most GNU/Linux on 1 floppy disk."
This bootable disk contains the tools we need (And so much more)
Download and create this 1.72MB floppy on a Linux or Window$ box
Ensure your hard disk is connected and boot with TOMSRTBT disk
Follow the on-screen instructions.Using FDISK to create a primary partition taking up the entire hard disk
Type fdisk/dev/hda (I am assuming your backup disk is Primary Master)
Type p To show the existing partition structure. (Make your decision now as to what partitions you want to keep or remove)
Type d To delete any partitions. (To delete any existing partitions you no longer need)
Type p To select a primary partition
Type 1 To select primary partition number 1
Type 1 To enter the starting cylinder (Enter defaults to 1)
Type x To enter the size in MB, KB or cylinder (Enter default to last cylinder)
Type p To confirm your settings
Type w To write the partition table to diskUsing MKE2FS to format this new partition
Type mke2fs /dev/hda1 Uses MKE2FS defaults to create the file system on /dev/hda1Your Linux backup disk is ready
9. I want to use Partimage to backup my
partitions to a locally connected drive
Put your Linux hard disk you want to backup (Source) on Primary Master
Put your destination disk (backup) on Primary Slave
Boot with the Partimage Boot disk and when asked, the Root disk
Type mount -t ext2 /dev/hdb1
/mnt Mount your backup hard disk
If you are unsure of the /dev/hd number, start partimage to see what
values are there. Then exit partimage and start again
Type partimage
Start the partimage application
Use the up down arrow keys and the space
bar to select your options
Use F5 to go to the next screen, Exit is F6
Use the tab key to move to the next fields
Use the Up/Down arrow keys to select the partition you want to backup
Use the Tab key to move to "Image file to create/use"
Type /mnt/name_of _backup
(name_of_backup is the name you choose for the backup. I suggest
including the device name ie linux_hda1)
I also suggest including the extension with the file name.
(IE linux_hda1.gz or linux_hda1.bz2)
Use the tab key again and ensure "Save partition into a new image file
is checked"
Hit F5 to move to the next screen
Select the compression you wish to use. I personally prefer
gzip. I find bz2 takes too long and isnt much smaller
Check or uncheck your other options if you want
You can choose to split the image into smaller chunks if you want (For
floppies, ZIP drives, CD's ...)
Lastly you can choose what happens after the backup is done.
Hit F5 to move through the next screens
Your backup has begun.
Repeat this same process for any other Partitions you want to backup
You may be in one of several situations
1. Your Linux box is slightly pooched, the partitions are still there and you want to restore from backup 1 or more partitions
2. Your Linux box is more than slightly pooched and you want to re-build your Linux box from scratch using your backups
1. Your Linux box is slightly pooched, the partitions are still there and you want to restore from backup 1 or more partitions
Not a problem, you will not have to create partitions or file systems
All you should need to do is mount your backup disk and run Partimage
Put your Linux hard disk you want to restore on Primary Master
Put your destination disk (backup) on Primary Slave
Boot with the Partimage Boot disk and when asked, the Root disk
Type mount -t ext2 /dev/hdb1 /mnt Mount your backup hard disk
If you are unsure of the /dev/hd number, start partimage to see what values are there. Then exit partimage and start again
Type partimage Start the partimage applicationUse the up down arrow keys and the space bar to select your options
Use F5 to go to the next screen, Exit is F6
Use the tab key to move to the next fieldsUse the Up/Down arrow keys to select the partition you want to backup
Use the Tab key to move to "Image file to create/use"
Type /mnt/name_of _backup (name_of_backup is the name you chose for the backup)
Use the tab key again and ensure "Restore partition from a new image file is checked"
Hit F5 to move to the next screen
Repeat this same process for any other Partitions you want to restoreReboot your machine and cross your fingers
If it doesn't boot, you may need to reinstall your MBR or Boot loader. See here2. Your Linux box is more than slightly pooched and you want to re-build your Linux box from scratch using your backups
Hopefully you can boot your machine with your Linux CD. I used Mandrake 8.2 CD1 (You can use TOMSRTBT as well)
Boot your box with the Linux CDROM. (Hit F1 type Rescue)
Type fdisk /dev/hda (Type lsparts if your hard disk differs from this)
Type p To check your hard disk to ensure if it is clean.
Type d To delete any partitions if necessary
Type n To add new partitionsYou may want to create 1 primary partition, 1 Extended partition, and two logical partitions
The starting cylinder is automatically selected for you. You can specify the end of the partition in MB (+xxxM) is so desired
You will have to use t (Change partition's system id) to create the swap partition
I cant go into too much detail here sorry. Here is more information if you need some
The only partition you need to to format or create a file system is the swap partition. The partitions will be created when restoring.
My swap partition is /dev/hda5
Type mkswap -c -v1 /dev/hda5 Checks and sets up a version 1 swap space on /dev/hda5. Search for the mkswap man pages hereYour hard disk is ready to go now
Go up to step 1 now to continue
We will need two computers here.
The Partimage Server Stores the Partition backup files
The Partimage Client The computer that is backed up or restoredThe Partimage Server
The Partimage Server must have a mounted partition to act as the partition storage area
It does not matter if it is a MSDOS Fat partition or a Linux Ext2 whatever
Here is a procedure to create a Linux partition
Boot your backup machine with the Boot and Root disks
Give your NIC an IP address. ifconfig device ip_address (IE ifconfig eth0 192.168.10.36)
If you need help with the ifconfig command try here firstIf you get errors like "SIOCSIFADDR: No such device" this probably means your partimage disks does not have your NIC modules includedPing the client or a known live IP address to confirm connectivity
To use Partimage over the network, you must create your own Partimage Boot disk that includes support for your NIC. See here
Use HDPARM to optimize your IDE performance
Now you must mount your partition storage area
Type mount -t ext2 /dev/hda5 /mnt (This mounts the ext2 partition /dev/hda5 onto /mnt )
If you dont know what /dev/hda number to use, start partimage to see what drives are present and the letters associated. Then exit the programType partimaged -D Starts the partimaged Daemon in Daemon mode and not in the foreground
Now you should be ready to connect with the Partimage ClientThe Partimage ClientIf you didn't start the Daemon in Daemon mode your terminal will appear locked on the Partimaged screen
If you want another terminal window, hold together ALT-F2, ALT-F3 or ALT-F4
You can now use ps ef to show the running processes and use kill to shutdown the Daemon if you want
(I would not suggest killing the partimaged daemon during a crucial partition transfer if you have a fondness for your data :-) )Please note that for this example we are not using any security (SSL) or any login
Boot your machine to be backup up with the Boot and Root disks
Give your NIC an IP address. ifconfig device ip_address (IE ifconfig eth0 192.168.10.36)
Use HDPARM to optimize your IDE performance
Type partimage Starts the applicationUse the up down arrow keys and the space bar to select your options
Use F5 to go to the next screen, Exit is F6
Use the tab key to move to the next fieldsHighlight the partition you want to save or restore
Enter the path to the source (IE /mnt/hda1.gz)
Select Save partition/Restore partition into/from an image file
Select connect to server and enter the IP address of the Partimage server
If you selected everything correctly the next screen should come up (when you hit F5) without errors
Confirm your settings and cross your fingers
Repeat the process for any other partitions you may haveReboot your machine and again, cross your fingers
If it doesn't boot, you may need to reinstall your MBR or Boot loader. See here
I need to re-install the MBR or Boot loader
Method 1
You can use Partimages "Restore an MBR from the image file"
You can choose the entire MBR, only the boot loader or only the partition table
If the source and destination drives are the same, it should be safe to choose the whole MBR
If however they are not the same, I suggest "Only the boot loader" You will have warnings but It worked fine hereMethod 2
Reboot your box with the Linux bootable CD
Mandrake 8.2 for example has an excellent rescue mode
Boot with CD, Hit F1, type rescue, Choose reinstall Boot loader.
If however, your disks are of difference types or sizes, it may be wiser (As we did above) to manually create the partitions for the new disk
Either way, here are the Backup and Restore commands for the MBR and Extended table.
Be really careful with your device number (dev/hda) when restoring
Backup the Primary partition table
Start a terminal and su to root
Type dd if=/dev/hda of=backup-hda.mbr count=1 bs=512
This will create a small (512 bytes) file
This file is a copy of the MBR. Move it somewhere safe. (Do it now or forever wish you did)
Backup the Extended partition table
Start a terminal and su to root
Type sfdisk -d /dev/hda > backup-hda.sf (Dump the partitions of a device in a format useful as input to sfdisk)
This will create a small (344 bytes) file
This file is a copy of the Extended partitions. Move it somewhere safe. (Do it now or forever wish you did)
Restoring the Primary partition table
Start a terminal and su to root
Type dd if=backup-hda.mbr of=/dev/hda
This will write the file backup-hda.mbr to the MBR of /dev/hda
Be very, very carefull that you ensure you have the correct device name.
Restoring the Extended partition table13. I need to create a new Boot disk with support for my NIC
Start a terminal and su to root
Type sfdisk /dev/hda < backup-hda.sf
Be very, very carefull that you ensure you have the correct device name
If this is a bit overwhelming or confusing for you, I have a raw
image that includes the modules for 3coms 3c509/3c529 "Etherlink III",
3c590/3c900 "Vortex/Boomerang" and NE2000/NE1000 NICS
In our lab these cards are pretty popular. It seems to work
well. If you have these NICs, feel free to download
it here (940KB)
Your Partimage Boot disk should be ready. Boot it and try it
out
During the booting of the Partimage Boot disk you should see details
about NIC module in the log
You can type dmesg to repeat these Daemon messages
The real test for NIC functionality is to give it an IP address and try
to ping a known working IP
Type ifconfig eth0
192.168.10.1 Change
the IP for your network
Type ping 192.168.10.50
Ping an IP on your network. A good ping will say x.x.x.x is alive!
If you need help with the ifconfig command try here first
16. I need some more help with ifconfig
and other BusyBox commands
The ifconfig command included with partimage and many other
miniaturized linux distributions comes from the BusyBox tool set.
A reference for all the included BusyBox commands can be found here
In the past, when you typed ifconfig you got all kinds of great
feedback about your NIC's
It is perfectly normal to now see this when you type ifconfig "ifconfig: ifconfig was not compiled with
interface status display support"
(Note to self: Try to fix the ifconfig thingy)
If you type ifconfig eth0 192.168.10.35, I believe the subnet mask
defaults to a Classfull 255.255.255.0
I'm honestly not entirely sure how to specify a IP address without a
Classfull subnet mask
I have tried these
ifconfig eth0 192.168.10.35/16
ifconfig eth0 netmask 255.255.0.0
The command is accepted but I cant seem to figure out how to test if it
worked. Pinging still works ... Can you help?
If this Classfull subnet mask stuff is too confusing, you probably dont have to worry about it
If you need more TCP/IP documentation, 3COM has a great PDF called
Understanding IP Addressing. Check it out here
17. I'd like to see some links to Linux
documentation, Kernels, Modules and Distributions.
Here is a page that may help
18. I need help with the mkisofs command
Here is a page that may help
19. I'd like to add my modified Partimage
boot disk to the Partimage Bootable CD-ROM image.
Here is a page that may help
23. How can I change the partimaged maximum client connection number?
I borrowed this information from partimage-users@lists.sourceforge.net
There is the "symbol" MAX_CLIENTS defined in the /src/server/partimaged.h file
This constant limits the maximum number of allowed clients and is set to 15.
I have set it to 50 and enclosed the patch to the 0.6.2 below.
You just have to apply the patch and compile the sources again.
One could also add an command line switch to change the maximum number of allowed clients dynamically.
> ------------- snip ----------------
>
> --- partimaged.h 2002-10-24 22:36:42.000000000 +0200
> +++ partimaged.h.new 2003-04-03 09:38:30.000000000 +0200
> @@ -22,7 +22,7 @@
> #include "pathnames.h"
>
> #define BUFFER_LEN BUFFER_SIZE
> -#define MAX_CLIENTS 15
> +#define MAX_CLIENTS 50
> #define SERVER_LISTEN_PORT 4025
>
> extern bool g_bBeDaemon;
>
>
> ------------- snip ----------------
24. I'd like to use the fully batch mode (-BX) what is the correct context?
I borrowed this comment from DW, a guest on the partimage forum. Thanks DW
"I don't think that the value for the -B option does anything, but it does need to be there.
In other words you need to use -B=something , but partimage does not seem to care what "something" is."
Here's a line that works for me
partimage save -z1 -m -b -B=foo -f3 -d -o -s192.168.10.183 /dev/hda1 /backup.gz
25. I'd like to use the fully batch mode (-BX) and I am getting a delay with the partimage client
I met a friend by the name of Grzegorz who asked me about this via email
After typing something like this
partimage save -z1 -m -b -B=foo -f3 -d -o -s192.168.10.183 /dev/hda1 /backup.gz
He discovered partimage takes several minutes to start.
The partimage client will pause at "partimage: status: initializing the operation. Please wait"
Using the GUI with the same parameters, the initialization takes a few seconds.
I noticed fully-batch-mode.patch in the partimage-0.6.4-1 sources patch directory.
This patch had already been applied to these sources so I figured it would be fun to try a compile
Well the resultant binaries worked flawlessly and with no delay time.
(Grzegorz was really happy)
Here they are if you want to give them a try
26. Partimage 0.6.4 can't restore MBR if image is bzip2 compressed. I need help
Jheyu sent me an email regarding this. Thanks Jheyu
According to partimage 0.6.4 partimage-0.6.4/BUGS
"partimage can't restore MBR if image is bzip2 compressed"
Patch file partimage-0.6.4/patches/error_less.diff now adds this to the partimage screen as you are creating a bz2 image
"Because of a bug, you won't be able to restore MBR from any bzip2 compressed image unless you manualy run bzip2 -d on them"
On 11/08/2004 I tried this an I could not get past this error. "Can't read block zero from image"
My only solution was to decompress my bzip2 image and recompress it with gzip
From there I was able to restore an MBR
27. What are the known bugs for partimage 0.6.4?
* when using compression, the volumes sizes are a little bigger than the need
size (FIXED for gzip compression)(FIXED but files are far too small)
* some avail space problems
* if the link between server and a client fails for any reason, client
and/or server *may* die.
* partimage imginfo imagefile fails on wrong permissions but with wrong message
'can't find compression level' instead of 'permission denied'
* partimage doesn't rightly detect end of space so corrupts images maid with
compression. Image seems correct but restoring fails with 'invalid magic'.
This doesn't affect non compressed images nor multivolume images based on
size spliting.
* partimage can't restore MBR is image is bzip2 compressed
If you find an error or wish to comment please let me know