LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 12-25-2004, 03:36 PM   #1
tcv
Member
 
Registered: Apr 2003
Location: Billerica, MA
Posts: 114

Rep: Reputation: 15
Backup images


Hi,

I understand there is a utility with almost every version of Linux that will allow one to do Ghost-like images of drives? Is that true?

What is it? And how do I find out more?


Cheers,

Mike...
 
Old 12-25-2004, 05:15 PM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,537

Rep: Reputation: 149Reputation: 149
Check if dd is what you want. To get its manual page (with syntax, description etc) run 'man dd'.
 
Old 12-25-2004, 06:49 PM   #3
tcv
Member
 
Registered: Apr 2003
Location: Billerica, MA
Posts: 114

Original Poster
Rep: Reputation: 15
Well, I ran that on my OS X system and I did not understand a word. I swear.

It says:

"dd - convert and copy a file"

Now, OS X is BSD. Does that make a difference?

m
 
Old 12-25-2004, 10:26 PM   #4
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian Squeeze
Posts: 5,783

Rep: Reputation: 311Reputation: 311Reputation: 311Reputation: 311
dd can do it, but, depending on cpu speed, it could take a looooonnnngggg time. If you interrupt dd, it could damage your OS and make it non-bootable.
Investigate DAR. Use it to make a full backup of your OS, then restore it to a new partition.
There is also partimage. The drawback is that the partitions must be the same size, or partimage will balk.
Dar doesn't care about partition sizes. It can make a compressed backup (each file compressed individually, contrary to tar). It even gives you the option to include a static version of itself with to backup, to ease the restoration process.
 
Old 12-25-2004, 11:04 PM   #5
Gato Azul
Member
 
Registered: Sep 2003
Location: /dev/null
Distribution: CentOS, Ubuntu
Posts: 128

Rep: Reputation: 16
Mondo Rescue

I'm not sure if this is what you're looking for or not, but Mondo Rescue is a free backup program for Linux. There's also Partimage which can backup partitions and compress them. Partimage can be found on the System Rescue CD, a bootable CD with lots of nifty utilities for rescuing/restoring/etc. systems (as per the name). Hope that helps!
 
Old 12-26-2004, 01:00 PM   #6
tcv
Member
 
Registered: Apr 2003
Location: Billerica, MA
Posts: 114

Original Poster
Rep: Reputation: 15
Here's what I am trying to do:

I am a roving technician. I primarily service Windows systems. I would love to be able to take a laptop with me in which I can:

1. Hook up the hard drive to be backed up to the laptop via a USB enclosure.

2. Boot up into Linux (preferably a Live CD, but with help I'd be willing to set up Linux on a partition. Right now the laptop is WinXP Pro.)

3. Back up the USB-connected drive to an image on the primary hd. The image would contain the entire HD including partition and MBR info.

I had thought I could do this via dd, but I understand that might not be the best. Of course, the WINDOWS solution, is Ghost, but that requires a purchase for every customer. I'm hoping to not have to do that.

Hope this makes sense.
 
Old 12-26-2004, 01:31 PM   #7
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 56
I haven't tried this with a usb drive yet but if it can be done with usb drive, this is how you might proceed... Boot up with a linux livecd such as systemrescue cd. You will need a partition on your laptop which can be written to ( vfat or ext3 ) .

You can use dd or sfdisk to save and restore the MBR including the partition table. That means you don't have to worry about getting the partition sizes right.
For example ....
laptop system is loaded on /dev/hda1 and is type vfat
usb drive partition is detected as /dev/sda1

Mount the partition where the images are going to be saved to.
mount /dev/hda1 /mnt/images -t vfat

Save the ENTIRE PARTITION TABLE to a file using sfdisk.
sfdisk d /dev/sda > /mnt/images/partfile

If you have an Extended partition, sfdisk may give you an error when you try to restore. In this case, it's better to use dd to backup and restore the partition table.
dd if=/dev/sda of=/mnt/images/partfile bs=512 count=1

Run the command: partimage
save the partition /dev/sda1 to an image on /mnt/images/win

To restore the image which automatically gets an extension added to the file name.
So in this case , it would be win.000
Bootup with the livecd and mount the partition where the image is stored ...
mount /dev/hda1 /mnt/images -t vfat

#Erase the old boot sector
dd if=/dev/zero if=/dev/sda bs=512 count=1

Restore the partition table from file using sfdisk
sfdisk /dev/sda < /mnt/images/partfile
or if using dd
dd if=/mnt/images/partfile of=/dev/sda bs=512 count=1

Run the command: partimage
restore to the partition /dev/sda1 from your image on /mnt/images/win.000
 
Old 12-26-2004, 02:03 PM   #8
tcv
Member
 
Registered: Apr 2003
Location: Billerica, MA
Posts: 114

Original Poster
Rep: Reputation: 15
Wow. Not too bad, but I see I can't use one utility to save everything -- mbr, content, partinfo -- like Ghost, right?

Are all those utilities you mentioned common to every distro? I was thinking about using Knoppix, but it seems that's a little heavy for what I need. I just need something that can detect USB drivers and drops to a command prompt.

m
 
Old 12-26-2004, 03:41 PM   #9
linuxgeekery
Member
 
Registered: Jul 2004
Location: Austin, Texas!
Distribution: Gentoo
Posts: 121

Rep: Reputation: 15
Partimage is perfect. Feather Linux is a live cd with partimage. Check out this as a Partimage with feather resource: http://www.linuxdevcenter.com/pub/a/...therlinux.html
 
Old 12-26-2004, 04:12 PM   #10
tcv
Member
 
Registered: Apr 2003
Location: Billerica, MA
Posts: 114

Original Poster
Rep: Reputation: 15
Wow. That really sounds like it does fit the bill. Thanks for the link.

One last question: Will Featurelinux automount USB-connected drives?

m
 
Old 12-26-2004, 04:33 PM   #11
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 56
Partimage is on a lot of livecds and I enjoy feather, systemrescue, knoppix and just about any other distro. I think knoppix has the inside track on detecting hardware. You don't have to boot to the full blown graphical mode.
I usually boot into the command line like this ...
knoppix26 2 but you may want to run the command: dmesg to see if the usb drive is detected and what it's called like maybe /dev/sda or similar.
 
Old 12-26-2004, 04:53 PM   #12
tcv
Member
 
Registered: Apr 2003
Location: Billerica, MA
Posts: 114

Original Poster
Rep: Reputation: 15
On the story linuxgeekery linked to, it shows partimage as being able to detect an NTFS-formatted fs partition. ... Can I expect this?

Actually, the only downside I see now is that with Ghost, one doesn't have to restore the entire drive. If one wants, they can use the explorer to find and restore individual files.

But that's a minor downside with what I want to do...

m

Last edited by tcv; 12-26-2004 at 04:56 PM.
 
Old 12-26-2004, 05:18 PM   #13
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 56
Partimage does work to save and restore ntfs partitions. You can save and restore individual partitions but then you will need to create the partition using something like fdisk or qtparted. The downside to creating the partition is that it needs to be the same size or larger than the original partition. ( much easier to make it larger than try get the exact size ) . If you restore to a slightly larger partition, then you will need to use the correct tools to resize the filesystem to fit the partition. That is no big deal INHO
For ntfs patitions, that would be ntfsresize
For example, on a system where it's on /dev/hda I would use the command:
ntfsresize /dev/hda
 
Old 12-26-2004, 05:36 PM   #14
tcv
Member
 
Registered: Apr 2003
Location: Billerica, MA
Posts: 114

Original Poster
Rep: Reputation: 15
I apologize, but I'm used to thinking of this in Ghost terms.

Can I use partimage to image and entire drive -- let's say, multiple partitions plus MBR?

And can I use partimage restore that ENTIRE drive -- let's say, multiple partitions plus MBR?

That's the type of thing I want to do.

Also: What will happen if I restore to an entirely different disk? Anything? If the new disk is bigger, will it auto-resize the partitions or will I have to use that other utility mentioned?

Thanks. I apologize for the density.
 
Old 12-26-2004, 07:04 PM   #15
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 56
Partimage is not quite to the point of automaitcally making an image of several partitions but you can use the proceedure which I mentioned before to save and restore the MBR and partition table.
Then you can use partimage to save individual partitions and to restore individual partitions.
You can put those jobs into a couple of scripts which will walk through the process one partition at a time thus you can to the entire hard drive. One script for saving things and one script for restoring but unless things are always the same, you will need to edit the scripts accordingly....
For example, here is an operation to save and restore a drive /dev/sda which has three partitions on it.

If you are going to clone an NTFS partition, you may want to run defrag and scandisk first.

Bootup with the rescue cd and run the save script to save the partitions to images.

Mount the partition where the images are going to be saved to.
mount /dev/hda1 /mnt/images -t vfat

Image save script
Code:
#!/bin/bash
#
clear
echo

#Save the MBR with partition table
dd if=/dev/sda of=/mnt/images/partfile bs=512 count=1

#Save partition #1
partimage save -c -b -d -z2 -f3 /dev/sda1 /mnt/images/win1

#Save partiton #2
partimage save -c -b -d -z2 -f3 /dev/sda2 /mnt/images/win2

#Save partition #3
partimage save -c -b -d -z2 -f3 /dev/sda3 /mnt/images/win3

clear
echo "Images save operation is complete"
echo
exit 0
####End
Image restore script

Bootup with the rescue cd and run the save script to save the partitions to images.

Mount the partition where the images are going to be restored from.
mount /dev/hda1 /mnt/images -t vfat

Code:
#!/bin/bash
#
clear
echo
echo "********************************************************************"
echo "     Caution!!!     This program will erase your hard drive"
echo
echo -n "                Do you want to proceed (Y/N)?"
read answer
if test "$answer" != "Y" -a "$answer" != "y";
then exit 0;
fi
#
clear
#
#Erase the old boot sector
dd if=/dev/zero of=/dev/sda bs=512 count=1
#
# Restore the partition table from file using the dd tool
#dd if=/mnt/images/partfile of=/dev/sda bs=512 count=1
clear
#
#Restore the images with Partimage
partimage restore -b -z2 -f3 /dev/sda1 /mnt/images/win1.000
#
partimage restore -b -z2 -f3 /dev/sda1 /mnt/images/win2.000
#
partimage restore -b -z2 -f3 /dev/sda1 /mnt/images/win3.000
clear
echo "Image restore is complete"
echo
exit 0
####End

Last edited by homey; 12-27-2004 at 01:21 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
backup images of NTFS drives jason2 Linux - Software 1 07-21-2006 06:23 PM
Convert cd images to dvd images rcsuk Debian 2 07-11-2005 10:34 AM
can I backup a root disk and boot from the new backup disk linuxbkp Linux - Enterprise 3 10-15-2004 06:42 PM
Selective backup to CDRW, or other backup methods. trekk Linux - Software 1 11-03-2003 02:46 PM
backup and update the backup file doris Linux - General 4 08-24-2002 07:26 PM


All times are GMT -5. The time now is 01:17 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration