adding a harddisk
dillon at backplane.com
Sun Jul 9 16:10:29 PDT 2023
Just adding a hard drive and formatting for use is easy. Add the hard
drive to the system and find the serial number it attached as. The 'dmesg'
output should give you a fairly good overview.
dmesg | egrep 'da|nvme'
A SATA drive attaches as da0, da1, etc. A nvme drive attaches as nvme0,
nvme1, etc. So for example, lets say the new hard drive is this:
da1: Serial Number 2105E4F03879
nvme1: Model Samsung_SSD_960_EVO_250GB BaseSerial S3ESNX0J219064Y nscount=1
nvme1: Disk nvme0 ns=1 blksize=512 lbacnt=488397168 cap=232GB
Being very careful not to mistake your existing drives, find the device of
the new drive and also remember the serial number for later. In this
example the serial number would be 2105E4F03879 on da1,
or S3ESNX0J219064Y-1 on nvme1, depending.
To format the drive with gpt, non-bootable:
gpt init -f /dev/nvme1
(for bootable, gpt init -f -B /dev/nvme1)
The gpt init -f will also create an empty disklabel on /dev/nvme1s1 which
you can edit:
disklabel -e nvme1s1
To create a data-only partition, usually an entry like this suffices. We
use 'd' by convention. 'a' is typically used for /boot, 'b' for swap, 'c'
is typically not used (it had a legacy meaning in prior decades), 'd' is
typically root, and 'e', 'f', 'g', etc etc are additional drives. This is
by convention only, you can use whatever partition labels you like. But to
avoid confusion when examining drives in the future it is good to stick to
e: * * HAMMER2
Save the disklabel and newfs_hammer2 the filesystem:
Ok, now for mounting purposes it is best to reference the device by its
serial number instead of via the raw device, because device numberings can
change. An example entry in your /etc/fstab would be:
serno/S3ESNX0J219064Y-1.s1e /data hammer2 rw 1 1
Where you would mkdir /data on your root partition to mount it on. That's
it. 'mount /data' and it should mount.
If you want to make the drive bootable you would gpt init -f -B /dev/nvme1
instead of just gpt init -f /dev/nvme1 above, and you would partition the
drive differently. Typically for a bootable drive, a 1G /boot partition is
created on 'a', with UFS as the filesystem, a swap partition is created on
'b', and the root partition is created on 'd'. You would also need a
configuration line in /boot/loader.conf to tell it where the root mount is
But creating multiple bootable drives can create confusion in the BIOS, so
generally speaking you don't do that for additional drives. Still, you
can. You can also partition the drive however you want. Rather than
adding just a single 'e' partition. But it is good to stick to convention
to reduce confusion. What examining a drive's disklabel, seeing a single
'e' partition tells you immediately that it is strictly a data drive.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Users