[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: automatically partition disk as in deb-installer?



Matt Price wrote:
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

WARNING Will Robinson!

The output from sfdisk is not always usable as input
to sfdisk, even on the same disc, let alone another!

(Yes, even with "-d".)

I suggest you look carefully at the file /var/scratch/hde.out
and verify that it looks correct and usable as input to sfdisk.
If it contains warnings, then sfdisk will likely not process
it properly as input.

#######################
# 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

Umm, these look like they're being done in the wrong order
to me. I think you *do* need something to fiddle the geometry on
the installed partitions, and sfdisk should do that. Then you
also need code there. I think you may be having a problem with
needing to install a PT along with boot code. A way to do that
is to use sfdisk to install the PT, but use GRUB to install itself.

IOW, although the code and the PT both reside in the same sector,
they need to be written separately. You need to use sfdisk,
because you need to fiddle the BRs on the volumes to install
the drive geometry. You might get away with using sfdisk to
do that, followed by the write of the entire MBR, but I'm
not sure.


# 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...

Yes, *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.

I suggest using sfdisk to do the partitioning, followed by using
GRUB to install itself, rather than dd.

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

Well, you got my $0.00 worth.

:-)

Mike
--
p="p=%c%s%c;main(){printf(p,34,p,34);}";main(){printf(p,34,p,34);}
This message made from 100% recycled bits.
You have found the bank of Larn.
I can explain it for you, but I can't understand it for you.
I speak only for myself, and I am unanimous in that!



Reply to: