Hi

BEWARE: Copying tarnsfering data from a mounted partition can cause
problems. In my examples I am using /dev/hdb as an example unmounted
source {original} drive and /dev/hdb as an unmounted destination drive.


You could try this if you want different sized partitions:

Create partitions on new drive and format them.
mount partitions starting from /mnt/destination {or what ever you want
to call it}.

tar -c -C /mnt/source -f - . | tar -x -C /mnt/destination
sync
umount /mnt/replicate

If all the drives have the same geometry, try this:

Note: the command below duplicates the drives image. The geometry and
partitions will be duplicated on the new drive. {This will not work if
the new drive is smaller than the original. If the new drive is larger
than the original drive, it will end up being resized to the same size
as the original drive.

dd if=/dev/hdb of=/dev/hdd

The above example has been given by others before my message but they
didn't mention the problems with drive size and geometry, I have seen
this problem before.

If you have the room a good, way of doing this is to archive the original
drive contents to a file then apply the archive to the new drive(s).

Examples:

{bzip2 can be repalced with gzip but change the extention bz2 to gz}

dd if=/dev/hdb | bzip2 -c >/path/to/drive.img.bz2

or

Create partitions on new drive and format them.

tar -c -C /mnt/source -f - . | bzip2 -c >/path/to/drive.tar.bz2

or

Create partitions on new drive and format them.

tar -c -j -C /mnt/source -f . /path/to/drive.tar.bz2

Using the method(s) above you could possibly use the same machine.

The tar methods are the best way because if the drive has any bad
blocks they will not be written with data. The tar methods also allow
you to resize your partions or use a different sized drive.

I have replicated drives before, and used these methods.

You may also want to try Norton Ghost. I am not sure but I believe
it now supports linux partitions.

I have not devoted much time to figuring out how to create partitions
automaticaly. Wait.......

I snooped around {apropos partition} and discovered sfdisk!

sfdisk -d /dev/hdb > /path/to/source.part

Edit /path/to/source.part and save as /path/to/destination.part {if you want}.

sfdisk /dev/hdd < /path/to/destination.part

This should be able to create the partitons automaticaly.

The only thing left is to create {format} the filesystems, then mount them.

Examples:

# make a swap fs on /dev/hdd1
mkswap /dev/hdd1

# make an ext2 fs on /dev/hdd2
mke2fs -q -L /boot /dev/hdd2

# make an ext3 fs on /dev/hdd
mke2fs -q -L / -j /dev/hdd3

# make a reiser fs on /dev/hdd
mkreiserfs -q /dev/hdd4



This may work for you, it could all be put into a script like:

---/usr/local/bin/createimage---
#!/bin/sh
# /usr/local/bin/createimage - Create files to replicate a drive.
# chmod 700 /usr/local/bin/createimage
#
sfdisk -d /dev/hdb > /path/to/source.part
mount -t ext3 /dev/hdb3 /mnt/source
mount -t ext2 /dev/hdb2 /mnt/source/boot
mount -t reiser /dev/hdb4 /mnt/source/var
tar -c -C /mnt/source -f . -j /path/to/drive.tar.bz2
#
# end
---end---

Should have created ; /path/to/source.part , /path/to/drive.tar.bz2

cp /path/to/source.part /path/to/destination.part

---/usr/local/bin/restoreimage---
#!/bin/sh
# /usr/local/bin/restoreimage - Restore drive contents.
# chmod 700 /usr/local/bin/restoreimage
#
sfdisk -d /dev/hdb < /path/to/destination.part
mkswap /dev/hdd1
mke2fs -q -L /boot /dev/hdd2
mke2fs -q -L / -j /dev/hdd3
mkreiserfs -q /dev/hdd4
mount -t ext3 /dev/hdb3 /mnt/source
mkdir /mnt/source/boot
mount -t ext2 /dev/hdb2 /mnt/source/boot
mkdir /mnt/source/var
mount -t reiser /dev/hdb4 /mnt/source/var
tar -x -j -C /mnt/source -f /path/to/drive.tar.bz2
sync
umount /dev/hdd2
umount /dev/hdd4
umount /dev/hdd3
#
# end
---end---

I just scratched this up for you but it should work.
Please notice the order the drives are mounted and unmounted.
You can't mount a partition until all lower partitions have
been mounted. You should unmount all partions above other
partitions before unmounting lower partions.

unmount first |
               V

/----+----/boot
      |
      +----/var

^
| unmount last

I hope this is usefull for you.
Some of the other examples seemed either too simplistic or difficult.
If size permits the files could be stored on a cdrom or dvd disk.
A rescue image and the required files and programs could also be put
into the "initrd" image. But I haven't done that before.


Guy

Travis Garrison wrote:
> Is there any program to make images of linux systems for the purpose of rolling
> out linux to multipule machines with all the same hardware. I have tried
> looking but have not had much luck. I will be rolling linux out to about 2 to 3
> hundred machines. Thanks for any help.
> 
> Travis Garrison
> [EMAIL PROTECTED]
> 
> 
> 
> _______________________________________________
> Seawolf-list mailing list
> [EMAIL PROTECTED]
> https://listman.redhat.com/mailman/listinfo/seawolf-list
> 
> 




_______________________________________________
Seawolf-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/seawolf-list

Reply via email to