Adding in a stand-by spare drive for ZFS on FreeBSD

This is a follow up to Adding in a hot-spare for zfs on FreeBSD from two months ago. The replacement for the returned drive has arrived and after sitting for many weeks on my coffee table, it is installed in r730-03.

Here it is, as found in /var/log/messages – this host is a Dell R730 which has drive cages allowing me to insert the drive without powering off the host.

Jun 30 16:17:15 r730-03 kernel: mrsas0: System PD created target ID: 0x7
Jun 30 16:17:16 r730-03 kernel: da7 at mrsas0 bus 1 scbus1 target 7 lun 0
Jun 30 16:17:16 r730-03 kernel: da7:  Fixed Direct Access SPC-4 SCSI device
Jun 30 16:17:16 r730-03 kernel: da7: Serial Number ZL2G3LB9
Jun 30 16:17:16 r730-03 kernel: da7: 150.000MB/s transfers
Jun 30 16:17:16 r730-03 kernel: da7: 11444224MB (23437770752 512 byte sectors)

I’m going to set this up as a stand-by drive, as opposed to a hot-spare, ready to be grabbed by zfsd.

Identify a matching drive

These are the zpools:

[16:47 r730-03 dvl ~] % zpool list         
NAME     SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP    HEALTH  ALTROOT
data01  32.7T  22.3T  10.4T        -         -    25%    68%  1.00x    ONLINE  -
zroot    412G  31.9G   380G        -         -    24%     7%  1.00x    ONLINE  -

These are the vdevs in that big pool:

[16:47 r730-03 dvl ~] % zpool status data01
  pool: data01
 state: ONLINE
  scan: scrub repaired 0B in 22:15:48 with 0 errors on Fri Jun 27 01:56:15 2025
config:

	NAME                   STATE     READ WRITE CKSUM
	data01                 ONLINE       0     0     0
	  mirror-0             ONLINE       0     0     0
	    gpt/SEAG_ZJV4HFPE  ONLINE       0     0     0
	    gpt/SEAG_ZHZ16KEX  ONLINE       0     0     0
	  mirror-1             ONLINE       0     0     0
	    gpt/SG_ZHZ03BAT    ONLINE       0     0     0
	    gpt/HGST_8CJW1G4E  ONLINE       0     0     0
	  mirror-2             ONLINE       0     0     0
	    gpt/SG_ZL2NJBT2    ONLINE       0     0     0
	    gpt/HGST_5PGGTH3D  ONLINE       0     0     0

errors: No known data errors

Look above for SEAG_ZJV4HFPE – I’m going to use that drive as the sample for the new one.

Next, look below for the same label as I look for the device name.

These are the partitions on all drives in the host:

[16:50 r730-03 dvl ~] % gpart show -l                     
=>       40  937703008  ada0  GPT  (447G)
         40       1024     1  gptboot1  (512K)
       1064        984        - free -  (492K)
       2048   67108864     2  swap1  (32G)
   67110912  870590464     3  zfs1  (415G)
  937701376       1672        - free -  (836K)

=>       40  937703008  ada1  GPT  (447G)
         40       1024     1  gptboot0  (512K)
       1064        984        - free -  (492K)
       2048   67108864     2  swap0  (32G)
   67110912  870590464     3  zfs0  (415G)
  937701376       1672        - free -  (836K)

=>         40  23437770672  da4  GPT  (11T)
           40  23437770600    1  HGST_8CJW1G4E  (11T)
  23437770640           72       - free -  (36K)

=>         40  23437770672  da1  GPT  (11T)
           40  23437770600    1  HGST_5PGGTH3D  (11T)
  23437770640           72       - free -  (36K)

=>         40  23437770672  da0  GPT  (11T)
           40  23437770600    1  SEAG_ZJV4HFPE  (11T)
  23437770640           72       - free -  (36K)

=>         34  23437770685  da5  GPT  (11T)
           34            6       - free -  (3.0K)
           40  23437770600    1  SG_ZL2NJBT2  (11T)
  23437770640           79       - free -  (40K)

=>         40  23437770672  da2  GPT  (11T)
           40  23437770600    1  SEAG_ZHZ16KEX  (11T)
  23437770640           72       - free -  (36K)

=>         40  23437770672  da3  GPT  (11T)
           40  23437770600    1  SG_ZHZ03BAT  (11T)
  23437770640           72       - free -  (36K)

=>         40  23437770672  da7  GPT  (11T)
           40  23437770672       - free -  (11T)

[16:50 r730-03 dvl ~] % 

That tells me da0 is the device I’m going to use as the sample drive.

Partition the new drive

Here, I create the partition scheme (GUID, see PARTITIONING SCHEMES in man gpart(8).

[16:41 r730-03 dvl ~] % sudo gpart create -s gpt da7
da7 created
[16:50 r730-03 dvl ~] % gpart show da7
=>         40  23437770672  da7  GPT  (11T)
           40  23437770672       - free -  (11T)

New drive information

Some of this information will be useful to me when I label the drive:

[17:05 r730-03 dvl ~] % sudo diskinfo -v /dev/da7                       
/dev/da7
	512         	# sectorsize
	12000138625024	# mediasize in bytes (11T)
	23437770752 	# mediasize in sectors
	4096        	# stripesize
	0           	# stripeoffset
	1458933     	# Cylinders according to firmware.
	255         	# Heads according to firmware.
	63          	# Sectors according to firmware.
	ATA ST12000NM001G-2M	# Disk descr.
	ZL2G3LB9    	# Disk ident.
	mrsas0      	# Attachment
	No          	# TRIM/UNMAP support
	7200        	# Rotation rate in RPM
	Not_Zoned   	# Zone Mode

[17:06 r730-03 dvl ~] % 

From there, using the Disk descr, I know this is a Segate drive (I know anyway, but if I didn’t, that description can be used to look it up and find out).

I also know this drive is in slot 7 of the server. I suspect the 1 scbus1 target 7 from

/var/log/messages

(as shown at the top of this page) confirms that.

Create the partition

[17:05 r730-03 dvl ~] % sudo sudo gpart add -i 1 -t freebsd-zfs -a 4k -l SLOT_7_ST_ZL2G3LB9 -s 23437770600 da7
da7p1 added

Those parameters explained:

argument description
-i 1 first index
-t freebsd-zfs type freebsd-zfs partition
-a 4k align on 4K – usually a safe bet
-l SLOT_7_ST_ZL2G3LB9 a user-supplied label telling me the drive is in slot 7, it’s a Segate, with that serial number.
-s 23437770600 the partition size (matches da0)

There, done

[17:15 r730-03 dvl ~] % gpart show da7
=>         40  23437770672  da7  GPT  (11T)
           40  23437770600    1  freebsd-zfs  (11T)
  23437770640           72       - free -  (36K)

[17:22 r730-03 dvl ~] % 

Thank you for coming to my TED talk.

Website Pin Facebook Twitter Myspace Friendfeed Technorati del.icio.us Digg Google StumbleUpon Premium Responsive

Leave a Comment

Scroll to Top