LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-06-2008, 08:39 AM   #1
Ingla
Member
 
Registered: Oct 2005
Distribution: Ubuntu 8.04, Ubuntu 10.04
Posts: 159

Rep: Reputation: 15
Ghosting Linux


Hello.

I generally (on Windows) have two identical hard drives in removable drawers in the machine. One is a ghost of the other.

I would like to do this with Ubuntu but, even if I can get some software to ghost my disk (the only thing I know of is G4U), there appears to be a problem.

If the ghosted disk is an exact copy, it probably won't be bootable from a second IDE (or SATA) connection in the motherboard. I will presumable get something like "can't find hda2", or whatever.

Is there any way to fix this?

Any advice appreciated.

Thanks.
 
Old 03-06-2008, 10:09 AM   #2
Randux
Senior Member
 
Registered: Feb 2006
Location: Siberia
Distribution: Slackware & Slamd64. What else is there?
Posts: 1,705

Rep: Reputation: 54
I'm not sure this is what you're talking about but.....what I've done is setup an hourly cron job to rsync basically my whole system to another drive on the same box. It could be anywhere but for now it's the same box. I created an exclusion file for rsync so certain files on the mirror won't get updated like fstab and some other stuff in /etc. I setup LILO to have entries for the main system and the mirror. I can boot either one of these systems and they're identical. You could use this idea to do what you want and you don't exactly have to mirror the whole drive byte for byte, only your Linux partitions. Linux doesn't try to butt-fsck you if you make changes to your system unlike winbloze and it won't explode just because you moved it to another drive
 
Old 03-06-2008, 10:31 AM   #3
farslayer
LQ Guru
 
Registered: Oct 2005
Location: Northeast Ohio
Distribution: linuxdebian
Posts: 7,248
Blog Entries: 5

Rep: Reputation: 191Reputation: 191
If the drives are in removable trays as you stated, and both drivers are master on separate IDE channels, then just pull the drives and swap the bays tey are plugged into if you need to boot from the 'duplicate'. That is the point of having them in removable trays isn't it ?
 
Old 03-06-2008, 02:23 PM   #4
Ingla
Member
 
Registered: Oct 2005
Distribution: Ubuntu 8.04, Ubuntu 10.04
Posts: 159

Original Poster
Rep: Reputation: 15
Thanks for the replies.

Randux: Sounds like a good setup but I'm not sure I'm technically up to speed for that. How did you set up your mirror in the first place - ghost or separate install? I'm not sure a ghost would be bootable.

farslayer: Of course you're right - in theory. Problem is these movable trays are kind of delicate. I try not to move them in and out too much. They do fall apart and if the connection wires come out, sometimes you can fix it and sometimes not. Replacing the drawer is cheap but they're going out of style and getting hard to find. Therefore, I prefer to leave them where they are and just reboot into a different drive. They're only for rarer operations when I actually need to change a drive physically and they save me opening the box every time ... that's kind of hard in my cramped workspace.

That's why I'm trying to figure out how to make a cloned disk bootable in its own right.
 
Old 03-12-2008, 05:25 AM   #5
Randux
Senior Member
 
Registered: Feb 2006
Location: Siberia
Distribution: Slackware & Slamd64. What else is there?
Posts: 1,705

Rep: Reputation: 54
Quote:
Originally Posted by Ingla View Post
Thanks for the replies.

Randux: Sounds like a good setup but I'm not sure I'm technically up to speed for that. How did you set up your mirror in the first place - ghost or separate install? I'm not sure a ghost would be bootable.

That's why I'm trying to figure out how to make a cloned disk bootable in its own right.
You can boot from anywhere usually. You just have to tell your BIOS the boot search order. I can boot on this box from 4 drives or CD depending on what I set in the BIOS. I use LILO on this multiboot (about 7 OS installed) and I write the same lilo.conf to the MBRs of all drives. That way even if I lose the whole primary drive I can still boot from any living drive. I've tested this and it works a treat.

I set my mirror system up as a mirror- I didn't install anything a second time. The mirroring isn't difficult if you understand how your system is laid out. Let's give an example...

First you must create partitions on the mirror drive to match your main drive. Very important to note that these device names are examples. YOU MUST UNDERSTAND YOUR SYSTEM including what partitions you have available and what you are using them for or YOU MAY LOSE YOUR ARSE

Right, now suppose you have

Code:
Main System

/        /dev/hda1
/home    /dev/hda2
/tmp     /dev/hda3
swap     /dev/hda5
then on your mirror system you must create

Code:
Mirror System

/        /dev/hdd6
/home    /dev/hdd7
/tmp     /dev/hdd8
#  swap does not have to be created, reuse /dev/hda5 
#  but if you lose your entire main drive you'll have to create a swap
#  partition with mkswap. Not critical, you can run Linux without swap.
Note you can reuse the swap since you will not be running both Linux at the same time. You can also reuse /tmp if you like. Actually you can reuse / as well although since we're working up a mirror system you should really backup everything you can't afford to lose.

Now fdisk and create your partitions then create filesystems using fdisk and the mke2fs, mkreiserfs etc whatever you prefer.

Then do rsync to set up your mirror system (again using EXAMPLE DEVICES!)

rsync -axv // /dev/hdd6/
rsync -axv /home/ /dev/hdd7/

Note the trailing '/' which must be present.

Now you must edit fstab (usually in /etc) in your mirror system and change the mountpoints for / /home /temp and swap. Then you must change your boot loader to add an entry for the new system. You will find several files which should be exluded. /dev and /proc come to mind immediately, browser caches and other temp file rubbish are also not worth copying. Figure what you don't need and trim down your backup to be a real backup and not a rubbish heap of unnecessary files. Over time you'll tune this to your preference. Read the man page for rsync to understand how to make an exclusion file.

First try booting your mirror system and debug anything you got wrong such as missing partitions, missing files, etc. Once that's going properly, then it's time to write a script to rsync everything and see if you can boot the system again. Usually you'll find you've broken something either by overwriting something you didn't want overwritten (/etc/fstab for example) or forgot to copy something you needed copied. In a few rounds you'll have everything sorted and working properly.

The last step is to execute your rsync script as an hourly or daily or weekly cronjob whichever you prefer. Rsync is smart enough to copy only files which have been changed so after the first time the backups don't take very long unless you've done quite a bit of work or deleted something accidentally. Take care with that...if you make a mistake and delete your root partition you must quickly disable the cron job or rsync will copy your mistakes to your mirror system! Actually there are several modes rsync will work in. You can tell rsync to copy everything from the main system to the mirror system this is the simplest and safest way to start. You can also tell rsync to copy everything from the main system to the mirror and delete everything that's not on the main system. Eventually you will want to do this else everything you ever delete on your main system will live forever on your mirror and eventually you'll run out of space. BE EXTREMELY CAREFUL and TEST TEST TEST with the rsync --delete option or you MAY LOSE YOUR ARSE! It's a great option but you must understand it thoroughly before putting it into effect.

Last edited by Randux; 03-12-2008 at 05:44 AM.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Linux Ghosting Solution aslanprrrrrrr Linux - Software 2 01-16-2008 10:23 AM
Linux Ghosting Software ddzc Linux - Software 8 03-14-2007 04:15 PM
ghosting linux Damon Spector Linux - General 16 05-29-2006 06:00 AM
Ghosting Linux PapaNoHair Linux - General 3 03-23-2004 06:42 PM
Ghosting Linux to new HD? zhenwu Linux - Software 3 11-08-2001 10:36 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:03 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