Disk Partitioning

If you need to set up another disk, we describe here how to prepare it.

⚠ Notice all this can be achieved after disk encryption and havig a RAID identified as "sd1" later.

Identifiy the disk

Plug the disk and run "dmesg". You'll see something like that :

umass0 at uhub0 port 1 configuration 1 interface 0 "Western Digital Ext HDD 1021" rev 2.00/20.21 addr 2
umass0: using SCSI over Bulk-Only
scsibus2 at umass0: 2 targets, initiator 0
sd1 at scsibus2 targ 1 lun 0: <WD, Ext HDD 1021, 2021> SCSI2 0/direct fixed serial.10581021383235373034
sd1: 1907727MB, 512 bytes/sector, 3907024896 sectors

Here, the disk is identified as "sd1". Adjust according to your case later.

Partitioning

Actually, we create slices with disklabel :

# disklabel -E sd1

Now we can create slices.

When in doubt, enter "p" to display the current state.

To create the first slice, enter "a a". It meas "Add a slice a".

Let default offset. Set the size according to your needs. To do so, you may use :

Choose filesystem "4.2BSD".

Add more slices if you want with "a d", "a e", "a f"...

⚠ Notice you can't create a "c" slice since it's reserved to identify the whole disk. Also, "b" is often used for swap, but it's not mandatory.

Once done, enter "q" to exit and apply changes.

Now enter "disklabel sd1" to see disk state :

# /dev/rsd1c:
type: SCSI
disk: SCSI disk
label: Ext HDD 1021
duid: 782f1ddb783cdd13
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 255
sectors/cylinder: 16065
cylinders: 243201
total sectors: 3907024896
boundstart: 64
boundend: 3907024065
drivedata: 0
16 partitions:
#            size       offset  fstype [fsize bsize  cpg]
  a:    629153472           64  4.2BSD   4096 32768    1
  d:   3277870464    629153536  4.2BSD   8192 65536    1 
  c:   3907024896            0  unused

Notice the "duid" :

duid: 782f1ddb783cdd13

You can use it later to identify the disk and avoid confusions if there are several. You can find it also with this command :

# sysctl hw.disknames
hw.disknames=wd0:bfb4775bb8397569,cd0:,wd1:56845c8da732ee7b,wd2:f18e359c8fa2522b

You're almost done, you still have to create the filesystem for each slices :

# newfs /dev/rsd1a
# newfs /dev/rsd1d

Don't forget the "r" 😉

Now you can edit "/etc/fstab" to mount the previous slices easyly. Notice the use of the previous duid :

...
782f1ddb783cdd13.a /home/prx/music/ ffs rw,softdep,noatime,nodev,nosuid,noauto 0 0
782f1ddb783cdd13.d /mnt/backup/ ffs rw,softdep,noatime,nodev,nosuid 1 2

That's a lot of options, you'll learn more in man fstab(5).

In this example :

To mount every mountpoint listed in "/etc/fstab", enter :

# mount -a