I have a little script that sets up a freebsd box:
Code:
#!/usr/bin/sh
umount /dev/ad0*
dd if=/dev/zero of=/dev/ad0 bs=1k count=1
fdisk -BI /dev/ad0
disklabel -R ad0 /home/mylabel
newfs /dev/ad0s1a
newfs /dev/ad0s1e
newfs /dev/ad0s1f
newfs /dev/ad0s1g
mount /dev/ad0s1a /mnt/ufs.1
mount /dev/ad0s1e /mnt/ufs.2
mount /dev/ad0s1f /mnt/ufs.3
mount /dev/ad0s1g /mnt/ufs.4
cd /home
cp backuproot.tar.gz /mnt/ufs.1
cp backupvar.tar.gz /mnt/ufs.2
cp backupusr.tar.gz /mnt/ufs.3
cd /mnt/ufs.1 && tar xzvf backuproot.tar.gz
cd /mnt/ufs.2 && tar xzvf backupvar.tar.gz
cd /mnt/ufs.3 && tar xzvf backupusr.tar.gz
cp /home/fstab /mnt/ufs.1/etc/fstab
boot0cfg -B ad0
So this worked to the point where I coudl reboot it and it was able to boot but had problems mounting some partitions.......
Well now when I run the script...it screws up on the 2nd step?
The dd command t says its transfered some bytes but then says:
Code:
Dec 3 15:03:59 FreesBIE /kernel: ad0: cannot find label (no disklabel)
Dec 3 15:03:59 FreesBIE /kernel: ad0s1: cannot find label (no disklabel)
and then the script does the fdisk command and gives the invalid fdisk partition tabel found which I think is normal
But here is the main part that screws it all up, the disklabel part gives an error of
Code:
fixlabel: invalid magic
disklabel: ioctl DIOCWDINFO: no disk label on disk;
add "-r" to install initial label
Dec 3 15:03:59 FreesBIE /kernel: ad0: cannot find label (no disklabel)
Dec 3 15:03:59 FreesBIE /kernel: ad0s1: cannot find label (no disklabel)
Now the thing is that this MAGIC error should not happen since:
"Grep'ing the error message in the sources it leads to this snipped of
code in kern/subr_diskslice.c in function fixlabel() (line 855):
/* These errors "can't happen" so don't bother reporting details. */
if (lp->d_magic != DISKMAGIC || lp->d_magic2 != DISKMAGIC)
return ("fixlabel: invalid magic");
if (dkcksum(lp) != 0)
return ("fixlabel: invalid checksum");"