PDA

View Full Version : Backup Linux System



emmbec
11-23-2004, 11:27 AM
Hi, I wanted to know if you know of any good backup utility. I tryed using partimage, but when I run it it says:

CANNOT BACK UP PARTITION HDA5 BECAUSE ITS MOUNTED

That is my main partition, where knoppix is running. I want to know how to back up my system. If you knwo of another good utility, or how to make this one work I'd really apretiate it.

baldyeti
11-23-2004, 11:35 AM
You could use partimage from the CD - without mounting your partition. Or just use the classic unix tools (cpio,tar,dump..). "apropos backup" also mentions mondo & kbackup.

emmbec
11-23-2004, 12:34 PM
I used partimage like you sayed, and it work ok. Thanks for the tip...

sakiZ
01-12-2005, 07:23 PM
I tried doing a backup with partimage with the CD (Knoppix 3.7) and the program tells me I must be in root mode.

OK, so I try to get in to root mode (su) and then it asks me for a password.

Hmm, this is the CD I'm using. I didn't know that there was a password on the CD version.

What's the trick here?

sakiZ

UnderScore
01-12-2005, 07:50 PM
Try sudo. I haven't yet seen it fail on me. Or you can boot into text mode which will log you in as root by default. Boot cheat code: knoppix 2
I hope this helps.
James

Shadda
01-12-2005, 09:36 PM
The liveCD asked for a password???

That's a bit strange....

sakiZ
01-13-2005, 03:51 AM
OK, thanks fo the tips on Partimage, etc.

I got that going.

Once I was in the Partimage menu, and attempted a backup it wanted to create the image file in the same partition as my Knoppix installation.

Well, I really don't want that. I have a blank Linux partion on my alternate drive that I want to create the system image on. But I don't see that Partimage gives me a way to do that.


sakiZ

sakiZ
01-13-2005, 04:31 AM
Hi

I used the DD comand

dd if=/dev/hdb2 of=/dev/hda6

It cloned the partition to my Linux partion on my other drive!!

Better check the docs before you use this one folks!

sakiZ

bfree
01-13-2005, 09:55 AM
I used the DD comand

dd if=/dev/hdb2 of=/dev/hda6

It cloned the partition to my Linux partion on my other drive!!

Better check the docs before you use this one folks!

Yep it's dangerous! Not half as dangerous though if you are doing if=/dev/hdb2 of=/mnt/hda6/hdb2.img which will store the image in a file instead of cloning it to another partition. You can loop mount those images afterwards to extract files from them (mkdir ~/mnt ; mount -o loop /mnt/hda6/hdb2.img ~/mnt), and you can dd them into a partition to make a clone (dd if=/mnt/hda6/hdb2.img /dev/hdb2).

If you want to minimise the filesize of the img by compressing it you should also zero out the free space. Probably not a good idea to try this unless you are sure of your system (and preferably of your backup) EDIT I think some types of filesystems might not like it either, research before you do this /EDIT but you can do "dd if=/dev/zero of=/mnt/hdb2/zero" and it will write one file full of zeros until it runs out of space, then delete the file and do your dd but pipe it through gzip to get a compressed image "dd if=/dev/hdb2 | gzip > /mnt/hda6/hdb2.img.gz". Unfortunately you can't just mount the compressed images though.

Hope you didn't wipe stuff that mattered!

sakiZ
01-13-2005, 02:46 PM
<<Hope you didn't wipe stuff that mattered!>>

No. I had used Partition Magic in Windows XP to create a fresh blank partition to write to.

Thanks for your input on this though. I will investigate doing the dd thing to an image file.

sakiZ

sakiZ
01-13-2005, 03:15 PM
Ok, I'm looking at your dd to an image.

I want to try doing that to a different partition on my Windows XP drive.

I'm thinking if I totally defrag the partition first in XP and back it up first I should be OK to try it.

sakiZ

bfree
01-13-2005, 05:05 PM
Ok, I'm looking at your dd to an image.

I want to try doing that to a different partition on my Windows XP drive.

I'm thinking if I totally defrag the partition first in XP and back it up first I should be OK to try it.

If the partition you want to write the image on is an ntfs formatted partition then I wouldn't bother trying to do it under Linux, either you will have to use paragons ntfs drivers (which I gather are reasonable), or use captive-ntfs which is horribly horribly slow or use linux's normal ntfs tools which means you'ld probably have to figure out what size the file would be (exactly) first, then allocate a file that size in windows on the ntfs drive and finally go into Knoppix and do your dd (hoping it comes out the same size), this is because with normal ntfs write support on Linux you can only write to files without changing the filesize and it can't add/remove files or folders!

If it is a fat partition or some Linux type then it shouldn't be a problem (whether you defrag it or not, but it probably only makes sense to defrag it if it is a fat partition, the default from dos and Windows 9x).

sakiZ
01-14-2005, 02:10 AM
Hey Bfree,

Thanks to you I tried your "dd" trick and it worked!!!

I defragged my partition to recieve the image file, scanned it for errors and backed it up, all in Windows XP.

I booted into Knoppix and did the "dd" command you gave me to create the hdb2.img file.
So far so good.

Next I followed your second step and created the loop mount. Well, I'll be!!! There is my image file appearing as a mirrored clone in my root directory!!!! Amazing.

So to make a clone I do:

"dd if=/mnt/hda6/hdb2.img /dev/hdb2"

If this were to be a clone of my Knoppix set up on a NEW drive would the command then actually be:

"dd if=/mnt/hda6/hdb2.img /dev/had1" ???

Thanks so much for your help.

Windows could never do anything like this.

sakiZ

bfree
01-14-2005, 02:24 AM
So to make a clone I do:

"dd if=/mnt/hda6/hdb2.img /dev/hdb2"

If this were to be a clone of my Knoppix set up on a NEW drive would the command then actually be:

"dd if=/mnt/hda6/hdb2.img /dev/had1" ???

Not quite. To restore/clone the image into a partition do

dd if=/mnt/hda6/hdb2.img of=/dev/hdb2"
If you were putting it onto a new drive you would again use the of=. Aswell as that you would proably have to use a rescue disk to tweak the system (fix the bootloader and /etc/fstab) before you could boot it. If it's windows on the other hard I'm not sure what you can do apart from restore it to the same position on a new drive with the same partition table as the original device (you can backup the masterboot record and partition table of your drive with "dd if=/dev/hda of=hda-start bs=512 count=1" and restore it with the reverse) which I'm 99% certain will be ok.

Just to point out one last trick, you can dd an entire disk device, e.g. "dd if=/dev/hda of=hda.img" and "dd if=hda.img of=hdb" but mounting the images from within these requires you to use some tricks to give an offset argument to mount. Here's instructions (http://talk.trekweb.com/~jasonb/articles/linux_loopback.html#id2427999).