can't make an 'a' slice except with auto-defaults

Jerry McAllister jerrymc at
Wed Feb 3 18:26:53 UTC 2010

On Wed, Feb 03, 2010 at 06:37:22PM +0100, Polytropon wrote:

> On Wed, 3 Feb 2010 10:26:06 -0700, Steve Franks <bahamasfranks at> wrote:
> > I'm just trying
> > to make a fresh disk ready for dump/restore with a 1G /, so I guess
> > sysinstall is out as an option at this time.
> Why so complicated? The command
> 	# newfs /dev/ad1
> will prepare the disk, assuming ad1 is the new disk. It
> will create one single partition covering the whole disk,
> with no slice. You can then run
> 	# mount /dev/ad1 /mnt
> to access it; /dev/ad1 is the same as /dev/ad1c, "the
> whole disk".

This gets you what is referred to as a "dangerously dedicated" disk
in the documentation.    If you are doing nothing unusual with other
OSen, then it works fine.    But, it is also not at all hard to use
fdisk and bsdlabel to create the full slice+partition.

Here is the basic routine.

   dd if=/dev/zero of=/dev/ad1 bs=512 count=1024
   fdisk -BI ad1
   dd if=/dev/zero of=/dev/ad1s1 bs=512 count=1024
   bsdlabel -w -B ad1s1
   bsdlabel -e ad1s1

The second bsdlabel command puts you in to an edit session.
Edit the partition table to something like this, then save[write] and exit.
(Just those two lines for a single partition disk)

# /dev/ad1s1:
8 partitions:
#        size  offset   fstype   [fsize bsize bps/cpg]
  c: 89867610       0   unused        0     0         # "raw" part, don't edit
  h:        *       0   4.2BSD     2048 16384     8 

You can use any partition identifier except 'c', but I like to 
reserve 'a' for bootable root (/) and 'b' for swap to reduce 
the confusion in my head.   

If the disk will not be bootable take out the 'B' from each of 
the fdisk and bsdlabel commands.

You probably do not need the two dd-s, but sometimes they are 
needed if the system cannot read the sector 0  on the disk for
some reason.

Finally, when that is done, do:

   newfs /dev/ad1s1d

Make yourself a mount point and mount the new disk.

   mkdir /bigwork
   mount /dev/ad1s1d /bigwork

Edit /etc/fstab so it will mount automatically.

It is not weird or mysterious, though I admit the man pages
for both fdisk and bsdlabel could stand a going through.
They do not follow the conventions of most man pages in the
way they describe the switches and parameters.   Fortunately
they have lots of examples (but could use even more).


> By the way, have you tried the program
> 	# sade
> instead of sysinstall?
> -- 
> Polytropon
> Magdeburg, Germany
> Happy FreeBSD user since 4.0
> Andra moi ennepe, Mousa, ...
> _______________________________________________
> freebsd-questions at mailing list
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at"

More information about the freebsd-questions mailing list