automatically partition disk as in deb-installer?

Matt Price matt.price at utoronto.ca
Wed Sep 28 19:01:58 UTC 2005


Hi,

I'm installing debian on a bunch of old hard drives and am looking for
a way to automate the install process, including partitioning drives.
I thought all the hard drives were idenical, but they appear not to
be, and I'm having trouble with the (very simple) script I was using
to copy the old filesystem.

Here's what I've done:
--------------------------------
# set 2 variables
SYSARCHIVE=gnomefs.tar
MBR=gnomebr

#################
# copy original 
#################
mount /dev/hde1 /mnt/hde
cd /mnt/hde
dd if=/dev/hde of=/var/scratch/$MBR bs=446 count=1
tar -cpvv  --file=/var/scratch/$SYSARCHIVE *
sfdisk -d /dev/hdf > /var/scratch/hde.out

#######################
# restore to new disk
######################
# write mbr
dd if=/var/scratch/$MBR of=/dev/hdf bs=446 count=1
# partition drive
cat /var/scratch/hde.out | sfdisk --force -f /dev/hdf 

# make filesystems
mkfs.ext3 -L / /dev/hdf1
mkswap /dev/hdf5

# mount drives
mount /dev/hdf1 /mnt/hdf
# untar archive
cd /mnt/hdf
tar -xvvf /var/scratch/$SYSARCHIVE
---------------------------------

The script seems to work fine at first, and when I run it the files untar to
the appropriate location.  however, sfdisk complains that the
partitions don't end at the end of a cylinder, so I introduced the
--force option, which seemed to work...  
Then when I try to throw the drivei n a new box and boot, I get some
crazy error with GRUB, where it just keeps printing 
GRUB GRUB GRUB GRUB GRUB GRUB GRUB GRUB GRUB GRUB GRUB GRUB GRUB
over and over again.  

So:  obviously I'm doing something wrong.  One thought I had was to
skip the sfdisk stuff altogether, which looks to me like dangerous
black magic, and try to partition the new diks some other way.
Debian-nstaller does a great job of automatically deciding how to
partition a drive, and I wondered if I could access that partitioner
somehow, feed it some options, and have the disk partitioned
non-interactively.  Or if there's some other way to automate teh whole
process properly...  

Please let me know what you think.  Thanks as always!

matt



--------------------------
 .''`.       Matt Price 
: :'  :      Debian User
`. `'` 	     & hemi-geek
  `-     
-------------------------- 
if you're an evil spambot, these addresses are for you:  aardvark at derailleur.org, zeus at derailleur.org






More information about the Legacy mailing list