LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-08-2004, 06:18 PM   #1
rootking
Member
 
Registered: Sep 2002
Distribution: FreeBSD
Posts: 70

Rep: Reputation: 15
Question Utility for Imaging Hard Disks w/Linux Installed needed


I'm looking for a utility that will allow me to image my SuSE 9.0 reiserfs hard disk. I've tried ghost v7.0 using the native disk imaging and sector-to-sector imaging and this is what I get when I boot off the newly imaged disk:

L99999999999999999999999999999999999999999999
9999999999999999999999999999999999999999
9999999999999999999999999999999999999999999999
9999999999999999999999999999999999999999999999
999999999999999999999999999999999999999999

This occurs and just hangs. I'm thinking that somehow the bootloader isn't being imaged correctly, but I'm not really sure. I'm running SuSE 9.0 with the Lilo bootloader. All my partitions are on the same hard drive and all formated with reiserfs, except the swap. thanks for any advice/direction in this matter.

marshall
 
Old 06-08-2004, 07:09 PM   #2
heathpitts
Member
 
Registered: Feb 2003
Location: Florence, AL
Distribution: Debian
Posts: 157

Rep: Reputation: 30
I was not aware that ghost supported reiserfs...that's cool if it does. I really like ghost on the windows side but I have been looking for a suitable open-source replacement. I have had luck with partimage and g4l (ghost for linux). The problems with these two are the following.

Partimage is good for making network image file backups of hds but is not suitable to clone disk to disk. One other problem is that you have to recreate the partitions on a drive before cloning the partitions back to the new drive.

g4l - is ok for both but it does a full bit by bit clone of the drive when going disk to disk - no matter how much data is on the drive. This makes disk imaging extremely slow in comparison to ghost. You also have to resize the partition to fill the disk after cloning using a program like parted.

Neither of these will let you clone to a smaller disk. Useful from a technician's standpoint when cloning large drives without the hd being full.

the problems I have heard about ghost cloning using ext2 or 3 partitions is that it messes up the mbr. Your problem may be able to be fixed by using a boot disk to start your machine, checking the /etc/lilo.conf file for errors and then rerunning lilo to rewrite the mbr.

I really wish there was a true replacement for ghost in the open-source world.
 
Old 06-08-2004, 08:01 PM   #3
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 61
Quote:
Partimage is good for making network image file backups of hds but is not suitable to clone disk to disk. One other problem is that you have to recreate the partitions on a drive before cloning the partitions back to the new drive.
Actually, I have found that partimage works very nicely for "cloning" a hard drive. I use the sfdisk utility to backup and restore the partition table which includes the mbr and the layout of partitions.

Here's my notes on that....

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

Get a cd bootable version of linux like system rescue at http://www.sysresccd.org and bootup with that cd.

Mount the partition where the images are going to be saved to.
mount /dev/hdb1 /mnt/images/backup -t ext3

Run partimage to make the images and save it to the backup directory which was created in the previous step.

In this example, I have a dual boot system so I backed up both operating systems with partimage.

Save the ENTIRE PARTITION TABLE to a file using sfdisk.
sfdisk –d /dev/hda > /mnt/images/backup/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/hda of=/mnt/images/backup/mbrfile bs=512 count=1

The clone script will restore that partition table and MBR from files to the new hard drive using the commands:
sfdisk /dev/hda < /mnt/images/backup/partfile
or
dd if=/mnt/images/backup/mbrfile of=/dev/hda bs=512 count=1

After you have saved the images and the partition table, install the new hard drive, make sure that bios sees it as the /dev/hda ( Primary Master ) so you don’t accidently zap your backup images which are saved on the /dev/hdb ( Primary Slave ) .

Bootup with the rescue cd and run the clone script to restore the images to your new hard drive.

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 if=/dev/hda bs=512 count=1
#
#Restore the partition table from file using sfdisk
sfdisk /dev/hda < /mnt/images/backup/partfile
#
# Restore the partition table from file using the dd tool
#dd if=/mnt/images/backup/mbrfile of=/dev/hda bs=512 count=1
clear
#
#Restore the images with Partimage
partimage restore -b -z2 -f3 /dev/hda1 /mnt/images/backup/windows.000
#
partimage restore -b -z2 -f3 /dev/hda2 /mnt/images/backup/linux.000
#
clear
echo "Image restore is complete"
echo
 
Old 06-08-2004, 09:22 PM   #4
rootking
Member
 
Registered: Sep 2002
Distribution: FreeBSD
Posts: 70

Original Poster
Rep: Reputation: 15
thanks a lot for all of this guys. I'm going to check out ghost for linux 1st and then will try the systemrcd method.
 
Old 06-08-2004, 09:42 PM   #5
heathpitts
Member
 
Registered: Feb 2003
Location: Florence, AL
Distribution: Debian
Posts: 157

Rep: Reputation: 30
Your instructions and script would make things a lot easier. In fact I may try that tomorrow. However, that is still too much work for what I want in cloning one drive to another. It takes one more step than I want in the process. I want one that lets me set the source drive, target drive, and then lets me define how i want the partitions resized on the new drive. That is what I am looking for in a drive clone app for where I work. I guess I have to keep using ghost for the time being.

I need this simple in terms of a gui to let the other technicians not well versed in linux to use it.
 
Old 06-10-2004, 01:51 PM   #6
rootking
Member
 
Registered: Sep 2002
Distribution: FreeBSD
Posts: 70

Original Poster
Rep: Reputation: 15
is there any software similiar to ghost for linux which can create the image while the server is running? My main concern is that in order to backup an entire disk I have to reboot into the ghost for linux disk and then create the image. I'd like to be able to do this while the server is running in it's OS.
 
Old 06-10-2004, 02:04 PM   #7
heathpitts
Member
 
Registered: Feb 2003
Location: Florence, AL
Distribution: Debian
Posts: 157

Rep: Reputation: 30
you could try rsync for that. I am not sure if it will create images though
 
Old 06-10-2004, 05:18 PM   #8
rootking
Member
 
Registered: Sep 2002
Distribution: FreeBSD
Posts: 70

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by heathpitts
you could try rsync for that. I am not sure if it will create images though
so will this rsync copy one disk to another on the fly? I'm also curious if this rsync will exactly replicate my one SCSI disk to another in my system. Meaning that if rsync has run and the primary disk fails I can shutdown, and bootup off the other disk into the OS.

Not sure if it matter but The primary SCSI disk(sda) is partitioned like this:

sda1: /boot
sda2: swap
sda3: /

thanks
marshall

Last edited by rootking; 06-10-2004 at 06:19 PM.
 
Old 06-10-2004, 08:13 PM   #9
BruceCadieux
Member
 
Registered: Apr 2002
Location: Wales MA.
Distribution: openSuSE 11.1
Posts: 409

Rep: Reputation: 32
I haven't tried it yet but this looks like an extremely promising application.

http://www.mondorescue.org/
 
Old 06-10-2004, 08:31 PM   #10
heathpitts
Member
 
Registered: Feb 2003
Location: Florence, AL
Distribution: Debian
Posts: 157

Rep: Reputation: 30
I have a powerbook running mac OSX.3 that I use and there is a program for it called Carbon Copy Cloner. This program uses rsync to copy the entire to another hd while the machine is running. You can then boot off the other drive.

I suppose you could use rsync to sync the files to another disk of around the same size and create the same partitions etc. on it. then you could use this other disk to boot off of if your other drive ever failed.
 
Old 06-10-2004, 11:39 PM   #11
rootking
Member
 
Registered: Sep 2002
Distribution: FreeBSD
Posts: 70

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by heathpitts
I have a powerbook running mac OSX.3 that I use and there is a program for it called Carbon Copy Cloner. This program uses rsync to copy the entire to another hd while the machine is running. You can then boot off the other drive.

I suppose you could use rsync to sync the files to another disk of around the same size and create the same partitions etc. on it. then you could use this other disk to boot off of if your other drive ever failed.
I guess I need help with the rsync command and doing the exact mirror.

from the looks of it I think I could do a:

rsync -av / /mnt/sdb3/

Wouldn't this make an exact mirror of my entire hard drive (sda) on sdb (supposing that I had mounted sdb3 on /mnt/sdb3, and sdb1 on /mnt/sdb3/boot?) Somehow I feel that somethings missing or that this won't work correctly.

My setup is:

sda1: /boot
sda2: swap
sda3: /

what do you guys think?

Last edited by rootking; 06-11-2004 at 12:51 AM.
 
Old 06-11-2004, 08:09 AM   #12
heathpitts
Member
 
Registered: Feb 2003
Location: Florence, AL
Distribution: Debian
Posts: 157

Rep: Reputation: 30
This is from the rsync examples page.

backup to a spare disk

I do local backups on several of my machines using rsync. I have an
extra disk installed that can hold all the contents of the main
disk. I then have a nightly cron job that backs up the main disk to
the backup. This is the script I use on one of those machines.

#!/bin/sh

export PATH=/usr/local/bin:/usr/bin:/bin

LIST="rootfs usr data data2"

for d in $LIST; do
mount /backup/$d
rsync -ax --exclude fstab --delete /$d/ /backup/$d/
umount /backup/$d
done

DAY=`date "+%A"`

rsync -a --delete /usr/local/apache /data2/backups/$DAY
rsync -a --delete /data/solid /data2/backups/$DAY



The first part does the backup on the spare disk. The second part
backs up the critical parts to daily directories. I also backup the
critical parts using a rsync over ssh to a remote machine.
 
Old 06-11-2004, 10:56 AM   #13
rootking
Member
 
Registered: Sep 2002
Distribution: FreeBSD
Posts: 70

Original Poster
Rep: Reputation: 15
so with this part here I'm guessing the primary disk is backing up to the spare disk:

#!/bin/sh

export PATH=/usr/local/bin:/usr/bin:/bin

LIST="rootfs usr data data2"

for d in $LIST; do
mount /backup/$d
rsync -ax --exclude fstab --delete /$d/ /backup/$d/
umount /backup/$d
done

I'm curious if there is an fstab entry for /backup/$d, due to not seeing a device being mounted here. I also need a little help understanding this. What is "$d". is this the "/" of his main drive? and I'm assuming that his other drive is mounted on "/backup/$d/". So this is mounting that backup drive, excluding any files named "fstab", deleting files that don't exist on the primary drive (how do you delete files that aren't there?), and then syncing the source drive mounted on "/$d/" with the backup drive mounted on "/backup/$d/".

What do you think? Can you guys help me understand this script better?

Now that I look at the script again I don't believe it's exactly mirroring the drives, any comments?

Last edited by rootking; 06-11-2004 at 11:18 AM.
 
  


Reply



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
are all USB hard disks linux-compatible? ekirlu Linux - Hardware 13 08-05-2005 12:28 AM
Red Hat does not open when installed on 2 hard disks rajivb Red Hat 18 07-23-2005 09:30 PM
want to run 2 Linux distros and winXP from two hard disks anoopsinha Linux - General 3 03-23-2005 09:32 PM
linux doesn't see my other 2 hard disks tr6boy Linux - Hardware 5 07-19-2004 04:09 PM
Hard disks faliure after linux mounting emadasfour Linux - Software 2 10-22-2003 07:05 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:14 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration