# Bsdinstall, sysinstall...



## jb_fvwm2 (Jul 25, 2012)

Would like to put this in Off-topic however.

I had a hard disk fried (immediately) by an IDE-to-SATA port adapter. Fortunately, I had a backup from a few hours before and experience with a similar (disk crash) situation. It was a little tougher this time.

Bsdinstall did (maybe) a few of the things it was supposed to do, but when I wished it to install (per se) it only had alter-partitions menu(s).

Gpart I find the manual way too terse still, but it succeeded in putting an MBR on the new disk where fdisk, the USB stick, sysinstall and bsdinstall could not.

Sysinstall succeeded in partitioning the disk, and getting the arithmetic (not without "issues") :\

```
newfs
df -aH 
tunefs -j enable
labels
rsync
```
 from another v9... installworld-from-thumbdrive ) Way too lengthy and difficult to detail here, convoluted (rsync'd /bin from the 2nd v9 but forgot sbin; then, I had forgot /etc, etc.) methodology to eventually restore the new v9 to a state where I could rsync from backup.

```
# /backup/usr rsync ... --size-only ... . /usr # note the dot 
 # see the other posts (search 'bwlimit' for the complete command)
```
Generally impressed with the way things could eventually work if one knew the way around it from a few versions ago (and added that parameter above to my notes for the next instance). However each conventional method of reinstall encountered what could be considered a showstopper for most less experienced users. Maybe if I was more pressed for time I would have tried the pcbsd installer

Sorry for the non-guide. I have notes but it is sort of an edge case, better just to relate a few hints if someone else reading this encounters the same issues. Also I am pressed for time so consider the above only a draft of a more polished post.


----------



## jb_fvwm2 (Jul 26, 2012)

FWIW, after running a floppy-based tool to fix the size (31mb) of a 1T disk, gpart readily replied that there was already a MBR on it (I had attempted to install to the 31mb...) and then sysinstall in the "allocate disk space" seamlessly made two huge partitions into which I expect to place the filesystems. If someone upgraded sysinstall to incorporate all of bsdinstall's features, and working the the new geom classes (no matter what the length of time it may take...) that would be super. ( I can even imagine a twenty-page-long "bsdinstall" which appears onscreen like the options page in sysinstall, where one sets a multitude of parameters and they are all done with a verbose-before warning which is very informative, all at once...)


----------



## jb_fvwm2 (Jul 30, 2012)

*Lucas' Absolute Freebsd recommendation here...*

Might as well post what worked in this instance (the 1T disk, not the other one)
(Some steps probably terse or omitted, I apologize)

Fixup the 31mb disk to 1T with the floppy-based tool.
Plan sizes with df -aH
Sysinstall, create partitions
bsdlabel [existing disk], plan sizes  ( examines the bsdlabel)   (NOT this disk)
bsdlabel -w [ each of the partitions created in sysinstall unless type 11 etc] (creates one where probably one has not existed)
csh ( to enable the setenv EDITOR /usr/local/bin/nano )
bsdlabel -e [ each of the bsdlabels written above, ... no way I could've done that,
probably, without pg 539 of Lucas' Absolute Freebsd, the only place I found which
showed a method of writing the bsdlabel without a multi-hour templating...]
exit (to return to one's usual shell)
boot0cfg... (per the man page) the new disk
newfs each slice created with the bsdlabel -e
reboot
newfs -j enable some/al new l slices ##### pending: labels...

Now it should be ready for rsync  onto it or some other method...

A WARNING: I had to be sure to use ada0 in nearly all instances, an existing
ada1 (ad6) from which I was using commands is somewhat backwards to the
numbering one may expect... (Checked carefully with fdisk  beforehand...)


----------



## Ogham (Jul 30, 2012)

I would be tempted to zero out that 1TB disk, just to be sure it is a 100% clean slate! You'll get the added bonus of letting the drive attempt to address any bad blocks it may encounter.


```
dd if=/dev/zero of=/dev/ada0 bs=1m
```

Adjusting your output device name accordingly of course


----------



## jb_fvwm2 (Jul 31, 2012)

That was one of the things I had done. The steps I listed above do not seem to
be working with another disk (It can disklabel -w, disklabel -e, newfs -U and even ffsk_ffs ...  but not actually mount either slice in  the third partition (vs the other two...). I'll get back to it sometime this week.


----------



## wblock@ (Jul 31, 2012)

Use gpart(8).  fdisk(8) and bsdlabel(8) are MBR-only, gpart(8) can do many types of partition schemes.  GPT is easiest and more capable than MBR.


----------



## Ogham (Jul 31, 2012)

Good luck with that disk  I totally agree with wblock@, gpart is the way forward.

Watch out if using dd on GPT disks, gpart stores metadata at both ends of the partition. Saving time by just zeroing out the first few MB of the disk without a gpart destroy -F could end up causing headaches!


----------



## jb_fvwm2 (Jul 31, 2012)

```
geom not found
```

That is the error I most often encounter using gpart, which I'd more readily use, if there were a multi-page set of examples covering many different situations using "mbr-speak" as it were (or as stated below); it seems the examples are most useful for those used to using it multiple times already... (for instance, install partitions, but what about mountpoints? and newfs'ing
them later? something about several complete bsd installs the fdisk-bsdlabel-newfs-glabel way, directly translated into gpart equivalents with explanations.  [Someone may
post a web page with that information before it gets to the man page, I'd expect...].
OTOH this week I may muddle through it and write my own short guide for my notes.  

Or maybe the handbook in its newer versions has the information more verbosely already.
Whatever.  Don't want to disparage the effort that has already been put into it.


----------



## wblock@ (Jul 31, 2012)

The second half of Disk Setup On FreeBSD explains and shows setting up a GPT disk.


----------

