#!/bin/sh # Disk drive partitioning # 2000-03-09 Rafael Skodlar # if [ $# -lt 2 ]; then echo -e "\n Usage: $0 hda hdb\n" exit fi D0=$1 DISK0=/dev/$1 DISK_SIZE0=`sfdisk -s | awk "/$D0/"|awk '{print $2}'` D1=$2 DISK1=/dev/$2 DISK_SIZE1=`sfdisk -s | awk "/$D1/"|awk '{print $2}'` echo "=================================================================" echo "Disk size= $DISK_SIZE0" echo "Disk size= $DISK_SIZE1" echo "=================================================================" if [ "$DISK_SIZE0" != "$DISK_SIZE1" ] then echo "Disk drives are not the same size!" echo -e "$DISK0: $DISK_SIZE0\n$DISK1: $DISK_SIZE1\n" exit else echo "******************************************************************" echo "* WARNING: you are about to change the partition on drive $DISK1" echo "* Changing the partion will destroy ALL data on the disk!" echo "*" echo "* Press Return to continue or Ctrl-C to abort" echo "******************************************************************" read ask sfdisk -d $DISK0 > /tmp/partition.disk0 sfdisk $DISK1 < /tmp/partition.disk0 fi