Moving a zpool to smaller drives #ZFS #FreeBSD

After succeeding with whole drives and with partitioned drives, I’m ready to try with more complex partitions. This is a repeat of the failed attempt a few days ago.

Parition creation

The partitions are created

Create the schema:

root@r730-04:/home/dvl # gpart create -s gpt /dev/mfisyspd0
mfisyspd0 created
root@r730-04:/home/dvl # gpart create -s gpt /dev/mfisyspd1
mfisyspd1 created
root@r730-04:/home/dvl # gpart create -s gpt /dev/mfisyspd2
mfisyspd2 created
root@r730-04:/home/dvl # gpart create -s gpt /dev/mfisyspd3
mfisyspd3 created

Boot:

root@r730-04:/home/dvl # gpart add -t freebsd-boot -s 512b /dev/mfisyspd0
mfisyspd0p1 added
root@r730-04:/home/dvl # gpart add -t freebsd-boot -s 512b /dev/mfisyspd1
mfisyspd1p1 added
root@r730-04:/home/dvl # gpart add -t freebsd-boot -s 512b /dev/mfisyspd2
mfisyspd2p1 added
root@r730-04:/home/dvl # gpart add -t freebsd-boot -s 512b /dev/mfisyspd3
mfisyspd3p1 added

Swap:

root@r730-04:/home/dvl # gpart add -t freebsd-swap -s 8G /dev/mfisyspd0
mfisyspd0p2 added
root@r730-04:/home/dvl # gpart add -t freebsd-swap -s 8G /dev/mfisyspd1
mfisyspd1p2 added
root@r730-04:/home/dvl # gpart add -t freebsd-swap -s 8G /dev/mfisyspd2
mfisyspd2p2 added
root@r730-04:/home/dvl # gpart add -t freebsd-swap -s 8G /dev/mfisyspd3
mfisyspd3p2 added

The partition to be used for a zpool:

root@r730-04:/home/dvl # gpart add -t freebsd-zfs /dev/mfisyspd0
mfisyspd0p3 added
root@r730-04:/home/dvl # gpart add -t freebsd-zfs /dev/mfisyspd1
mfisyspd1p3 added
root@r730-04:/home/dvl # gpart add -t freebsd-zfs /dev/mfisyspd2
mfisyspd2p3 added
root@r730-04:/home/dvl # gpart add -t freebsd-zfs /dev/mfisyspd3
mfisyspd3p3 added

The results:

root@r730-04:/home/dvl # gpart show mfisyspd0 mfisyspd1 mfisyspd2 mfisyspd3
=>       40  468862048  mfisyspd0  GPT  (224G)
         40          1          1  freebsd-boot  (512B)
         41   16777216          2  freebsd-swap  (8.0G)
   16777257  452084831          3  freebsd-zfs  (216G)

=>       40  468862048  mfisyspd1  GPT  (224G)
         40          1          1  freebsd-boot  (512B)
         41   16777216          2  freebsd-swap  (8.0G)
   16777257  452084831          3  freebsd-zfs  (216G)

=>      40  62533216  mfisyspd2  GPT  (30G)
        40         1          1  freebsd-boot  (512B)
        41  16777216          2  freebsd-swap  (8.0G)
  16777257  45755999          3  freebsd-zfs  (22G)

=>      40  62533216  mfisyspd3  GPT  (30G)
        40         1          1  freebsd-boot  (512B)
        41  16777216          2  freebsd-swap  (8.0G)
  16777257  45755999          3  freebsd-zfs  (22G)

root@r730-04:/home/dvl # 

The zpool creation

In these tests, the main difference between now and the previous test is the partition index being used (p1 v p3):

root@r730-04:/home/dvl # zpool create ztest mirror /dev/mfisyspd0p3 /dev/mfisyspd1p3
root@r730-04:/home/dvl # zpool list ztest
NAME    SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP    HEALTH  ALTROOT
ztest   214G   372K   214G        -         -     0%     0%  1.00x    ONLINE  -
root@r730-04:/home/dvl # zpool status ztest
  pool: ztest
 state: ONLINE
config:

	NAME             STATE     READ WRITE CKSUM
	ztest            ONLINE       0     0     0
	  mirror-0       ONLINE       0     0     0
	    mfisyspd0p3  ONLINE       0     0     0
	    mfisyspd1p3  ONLINE       0     0     0

errors: No known data errors
root@r730-04:/home/dvl # 

Add in the second mirror

First, touch the file:

root@r730-04:/home/dvl # touch /ztest/things
root@r730-04:/home/dvl # ls -l /ztest/things
-rw-r--r--  1 root wheel 0 Nov 22 14:49 /ztest/things
root@r730-04:/home/dvl # 

Then add in the drives:

root@r730-04:/home/dvl # zpool add ztest mirror /dev/mfisyspd2p3 mfisyspd3p3
root@r730-04:/home/dvl # zpool status ztest
  pool: ztest
 state: ONLINE
config:

	NAME             STATE     READ WRITE CKSUM
	ztest            ONLINE       0     0     0
	  mirror-0       ONLINE       0     0     0
	    mfisyspd0p3  ONLINE       0     0     0
	    mfisyspd1p3  ONLINE       0     0     0
	  mirror-1       ONLINE       0     0     0
	    mfisyspd2p3  ONLINE       0     0     0
	    mfisyspd3p3  ONLINE       0     0     0

errors: No known data errors
root@r730-04:/home/dvl # ls -l /ztest/things
-rw-r--r--  1 root wheel 0 Nov 22 14:49 /ztest/things
root@r730-04:/home/dvl # 

And next, remove:

root@r730-04:/home/dvl # zpool remove ztest mirror-0
root@r730-04:/home/dvl # zpool status ztest
  pool: ztest
 state: ONLINE
remove: Removal of vdev 0 copied 492K in 0h0m, completed on Sat Nov 22 14:50:31 2025
	336 memory used for removed device mappings
config:

	NAME             STATE     READ WRITE CKSUM
	ztest            ONLINE       0     0     0
	  mirror-1       ONLINE       0     0     0
	    mfisyspd2p3  ONLINE       0     0     0
	    mfisyspd3p3  ONLINE       0     0     0

errors: No known data errors
root@r730-04:/home/dvl # ls -l /ztest/things
-rw-r--r--  1 root wheel 0 Nov 22 14:49 /ztest/things
root@r730-04:/home/dvl # zpool list ztest
NAME    SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP    HEALTH  ALTROOT
ztest  21.5G   528K  21.5G        -         -     0%     0%  1.00x    ONLINE  -
root@r730-04:/home/dvl # 

Success. I still don’t know why my first test failed.

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

Leave a Comment

Scroll to Top