Skip to content

ZFSRemotePoolCreation

Luca Finzi Contini edited this page Jul 26, 2024 · 4 revisions

Creating Remote ZFS Pool for Backup

On the backup server, we will create two pools for the sake of demonstration :

  • one simple pool with 1 disk, called testpool of size 20GB (which is the total available size of the zfspool pool) -> /dev/sdd
  • one slightly more complex pool with 2 mirrored disks called backuppool, both of 20GB so that the total available size will be again 20GB -> /dev/sdb, /dev/sdc

Just a sidenote: with VirtualBox, the command vboximg-mount --list will give you information about VDI disk image files UUID that you can match with information in /dev/disk/by-id/...; on a real Linux box it is easier to match /dev/disk/by-id/... with /dev/sdX.

Creating the testpool pool

The testpool will be a simple one-disk pool with our /dev/sdd:

buser@backup:~$ sudo zpool create testpool /dev/disk/by-id/ata-VBOX_HARDDISK_VBb713d0e5-bc544b92
buser@backup:~$ zpool status
  pool: testpool
 state: ONLINE
config:

        NAME                                     STATE     READ WRITE CKSUM
        testpool                                 ONLINE       0     0     0
          ata-VBOX_HARDDISK_VBb713d0e5-bc544b92  ONLINE       0     0     0

errors: No known data errors

We now have a pool that is nearly the size of our NAS Documents file system . Here, we have slightly less space, but when TBs are concerned, it will be all right .

buser@backup:~$ zfs list
NAME       USED  AVAIL  REFER  MOUNTPOINT
testpool   112K  18.9G    24K  /testpool

Let's mount this under /mnt/test:

buser@backup:~$ sudo zfs set mountpoint=/mnt/test testpool
buser@backup:~$ zfs list
NAME       USED  AVAIL  REFER  MOUNTPOINT
testpool   134K  18.9G    24K  /mnt/test

Creating the backuppool pool

The backuppool pool will be a pool with 2 mirrored disks, /dev/sdb/ and /dev/sdc.

buser@backup:~$ ls -la /dev/disk/by-id/ata-VBOX_*
lrwxrwxrwx 1 root root  9 Jul 21 00:05 /dev/disk/by-id/ata-VBOX_CD-ROM_VB2-01700376 -> ../../sr0
lrwxrwxrwx 1 root root  9 Jul 21 00:05 /dev/disk/by-id/ata-VBOX_HARDDISK_VBa774b117-646db467 -> ../../sda
lrwxrwxrwx 1 root root 10 Jul 21 00:05 /dev/disk/by-id/ata-VBOX_HARDDISK_VBa774b117-646db467-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 Jul 21 00:05 /dev/disk/by-id/ata-VBOX_HARDDISK_VBa774b117-646db467-part2 -> ../../sda2
lrwxrwxrwx 1 root root 10 Jul 21 00:05 /dev/disk/by-id/ata-VBOX_HARDDISK_VBa774b117-646db467-part3 -> ../../sda3
lrwxrwxrwx 1 root root  9 Jul 21 00:05 /dev/disk/by-id/ata-VBOX_HARDDISK_VBad84d57b-ac3f5cd2 -> ../../sdc
lrwxrwxrwx 1 root root  9 Jul 21 00:05 /dev/disk/by-id/ata-VBOX_HARDDISK_VBb713d0e5-bc544b92 -> ../../sdd
lrwxrwxrwx 1 root root 10 Jul 21 00:18 /dev/disk/by-id/ata-VBOX_HARDDISK_VBb713d0e5-bc544b92-part1 -> ../../sdd1
lrwxrwxrwx 1 root root 10 Jul 21 00:18 /dev/disk/by-id/ata-VBOX_HARDDISK_VBb713d0e5-bc544b92-part9 -> ../../sdd9
lrwxrwxrwx 1 root root  9 Jul 21 00:05 /dev/disk/by-id/ata-VBOX_HARDDISK_VBd6b07a1a-5fed615f -> ../../sdb
buser@backup:~$ sudo zpool create -o ashift=12 -f backuppool mirror  /dev/disk/by-id/ata-VBOX_HARDDISK_VBd6b07a1a-5fed615f  /dev/disk/by-id/ata-VBOX_HARDDISK_VBad84d57b-ac3f5cd2
buser@backup:~$ zpool status
  pool: backuppool
 state: ONLINE
config:

        NAME                                       STATE     READ WRITE CKSUM
        backuppool                                 ONLINE       0     0     0
          mirror-0                                 ONLINE       0     0     0
            ata-VBOX_HARDDISK_VBd6b07a1a-5fed615f  ONLINE       0     0     0
            ata-VBOX_HARDDISK_VBad84d57b-ac3f5cd2  ONLINE       0     0     0

errors: No known data errors

  pool: testpool
 state: ONLINE
config:

        NAME                                     STATE     READ WRITE CKSUM
        testpool                                 ONLINE       0     0     0
          ata-VBOX_HARDDISK_VBb713d0e5-bc544b92  ONLINE       0     0     0

errors: No known data errors

Let's mount backuppool on /mnt/storage for example:

buser@backup:~$ sudo zfs set mountpoint=/mnt/storage backuppool
buser@backup:~$ zfs list
NAME         USED  AVAIL  REFER  MOUNTPOINT
backuppool   432K  18.9G    96K  /mnt/storage
testpool     160K  18.9G    24K  /mnt/test

Enough for pool creation, let's configure samba on the nas as in local server Samba configuration, shall we?

Clone this wiki locally