Link to home
Start Free TrialLog in
Avatar of ntstud
ntstud

asked on

Mirror

How would I create a mirror of HD0 and mirror it to HD1
Avatar of fmismetti
fmismetti

I assume that HD1 has a valid Linux partition, hdb1, and HDA is mounted as /.

1. mount /dev/hdb1 partition in /disk2 (this directory must exist).

2. Run this script:

#! /bin/bash
#
cd / && cp -a `/bin/ls -1A | egrep -v "^disk2$|^proc$"` /disk2

This will copy all files from "/" to "/disk2" except directories /disk2 and /proc (you can add more; use "^disk2$|^proc$|^tmp$" if you want to exclude also /tmp.

Last thing: the mirrored disk will not boot. If you want this, you need to do some tricks. Look in the document Hard-Disk-Upgrade mini-HOWTO. This document explains also another ways to duplicate your hard-disk (I learned about the method above there).

Let me know if this solves your problem.
Avatar of ntstud

ASKER

Where would I setup the script, or just create a txt file and make it Xacutable?

new to scripts, NTstud remember!
First, you did not explain the reason for reject the answer. I did not notice the "NTstud" and I had no means to know that you did not know how to setup scripts.

You can put this text in any text file, let's say /usr/myscripts/mirrordisk. Then you have two choices:

1. run "chmod +x /usr/myscripts/mirrordisk" and then you can just run the file from the command line.

2. run the plain text file invoking the shell and passing the text file as a parameter, like "/bin/bash /usr/myscripts/mirrordisk"


You could also use RAID-1 to mirror your disk. This way, all data will be written to two disks at the time, not just when you run the script.

For more information on RAID-1, have a look at:
http://metalab.unc.edu/LDP/HOWTO/mini/Software-RAID.html
Avatar of ntstud

ASKER

thanks fmismetti, i will award you the points (answer again).

Danny

this WILL work right?  I have an ISP's server to mirror, silly rabbit, ISP are for pros.
ASKER CERTIFIED SOLUTION
Avatar of fmismetti
fmismetti

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Ops, I forgot that the rejected answer would be gone. here is a copy from my browser cache:

I assume that HD1 has a valid Linux partition, hdb1, and HDA is mounted as /.

1. mount /dev/hdb1 partition in /disk2 (this directory must exist).

2. Run this script:

#! /bin/bash
#
cd / && cp -a `/bin/ls -1A | egrep -v "^disk2$|^proc$"` /disk2

This will copy all files from "/" to "/disk2" except directories /disk2 and /proc (you can add more; use "^disk2$|^proc$|^tmp$" if you want to exclude also /tmp.

Last thing: the mirrored disk will not boot. If you want this, you need to do some tricks. Look in the document Hard-Disk-Upgrade mini-HOWTO. This document explains also another ways to duplicate your hard-disk (I learned about the method above there).

Let me know if this solves your problem.
Before you accept this answer, ask yourself the following question:
Do I want to make a backup or a mirror?

If you want to make a backup, you'd want to do as proposed. But this can be done only at specific times, so you won't have the latest copy of your disk.

If you want to make a mirror, you want the latest copy of your disk. With RAID-1, all data will be written to two disks simultaneously.