« Home | Out-going admin cron jobs » | Who hits my website » | Scripts for all occasions » | Bash shell option » | Get the hidden files » | Chrooted SSH HowTo » | How to create IP-IP tunnel between FreeBSD and Lin... » | How can I have two default routes? » | Revealing your routing tables » | Where do the IP addresses come from? » 

Thursday, March 23, 2006 

Poor Mans Raid & Clone Script Tutorial

POORMANS RAID & CLONE SCRIPT

1. Get yourself two hardives setup your first drive (HDA) with the your perfek system.
2. Power up your second drive (HDC)
3. Slice HDC up by using cfdisk (command is cfdisk /dev/hdc)

Hda1 - primary boot begining Label [ / ]
Hda5 - logical beginning [ /usr ]
Hda6 - logical beginning [ /var ]
Hda7 - logical beginning [ swap ]
Hda8 - logical beginning [ /tmp ]
Hda9 - logical beginning [ /home ]

To Setup your filesystem and your labels

Mkfs -t ext3 -L / dev/hdc1
Mkfs -t ext3 -L /usr dev/hdc5
Mkfs -t ext3 -L /var dev/hdc6
Mkfs -t ext3 -L /tmp dev/hdc8
Mkfs -t ext3 -L /home dev/hdc9

okay so you have sliced HDC and setup your filesystems with Labels.

Vi and copy the below script save a file called clone, make it chmod 777 and run it.

once copied run Grub
#grub --no-floppy
#grub>
# device (hd0) /dev/hdc
# root (hd0,0)
# setup (hd0)
# quit

Clone Script"make sure nothing is mounted in /mnt!"
echo "going to unmount /mnt"
/bin/umount /mnt

mount /dev/hdc1 /mnt
cd /
cp -ax / /mnt

mount /dev/hdc5 /mnt/usr
cd /usr
tar lcpBf - /usr | (cd /mnt; tar xBf -)

mount /dev/hdc9 /mnt/home
cd /home
tar lcpBf - /home | (cd /mnt; tar xBf -)

mount /dev/hdc8 /mnt/tmp
cd /tmp
tar lcpBf - /tmp | (cd /mnt; tar xBf -)

#Stop crtical services
/etc/init.d/mysql stop

mount /dev/hdc6 /mnt/var
cd /var
tar lcpBf - /var | (cd /mnt; tar xBf -)

#start all the services again
/etc/init.d/mysql start

echo "all copied"
exit 0

Links to this post

Create a Link