Skip to content

MyBackupDiskIsAlmostFull

Luca Finzi Contini edited this page Nov 3, 2024 · 6 revisions

My backup disk is almost full!

There is basically nothing new with changing disks on the backup server. The procedure will be just identical to the steps we saw in the previous page, ZFS Disk Change.

What to do when the Backup disk gets full

When the Backup disk or pool gets almost full with data, you need to plan for substitution with bigger disks.

How to Change ZFS Disk on the mirror pool

This the state before the operation begins:

buser@backup:~$ zpool status backuppool
  pool: backuppool
 state: ONLINE
config:

        NAME                                             STATE     READ WRITE CKSUM
        backuppool                                       ONLINE       0     0     0
          mirror-0                                       ONLINE       0     0     0
            scsi-SATA_VBOX_HARDDISK_VBa7d677b2-9e2a7960  ONLINE       0     0     0
            scsi-SATA_VBOX_HARDDISK_VBaf0a693c-ec9482f2  ONLINE       0     0     0

errors: No known data errors
buser@backup:~$
  • Substitute the 1st disk and perform the replacement:
buser@backup:~$ sudo zpool replace backuppool scsi-SATA_VBOX_HARDDISK_VBa7d677b2-9e2a7960 scsi-SATA_VBOX_HARDDISK_VBd24458c6-2a941b88
buser@backup:~$ zpool status
  pool: backuppool
 state: ONLINE
status: One or more devices is currently being resilvered.  The pool will
        continue to function, possibly in a degraded state.
action: Wait for the resilver to complete.
  scan: resilver in progress since Sat Nov  2 23:54:03 2024
        557M / 557M scanned, 440M / 556M issued at 110M/s
        425M resilvered, 79.10% done, 00:00:01 to go
config:

        NAME                                               STATE     READ WRITE CKSUM
        backuppool                                         ONLINE       0     0     0
          mirror-0                                         ONLINE       0     0     0
            replacing-0                                    ONLINE       0     0     0
              scsi-SATA_VBOX_HARDDISK_VBa7d677b2-9e2a7960  ONLINE       0     0     0
              scsi-SATA_VBOX_HARDDISK_VBd24458c6-2a941b88  ONLINE       0     0     0  (resilvering)
            scsi-SATA_VBOX_HARDDISK_VBaf0a693c-ec9482f2    ONLINE       0     0     0

errors: No known data errors
  • Set the property autoexpand to on and perform the second and last replacement:
buser@backup:~$ sudo zpool set autoexpand=on backuppool
buser@backup:~$ zpool status
  pool: backuppool
 state: ONLINE
status: One or more devices is currently being resilvered.  The pool will
        continue to function, possibly in a degraded state.
action: Wait for the resilver to complete.
  scan: resilver in progress since Sun Nov  3 00:03:50 2024
        557M / 557M scanned, 410M / 556M issued at 137M/s
        395M resilvered, 73.71% done, 00:00:01 to go
config:

        NAME                                               STATE     READ WRITE CKSUM
        backuppool                                         ONLINE       0     0     0
          mirror-0                                         ONLINE       0     0     0
            scsi-SATA_VBOX_HARDDISK_VBd24458c6-2a941b88    ONLINE       0     0     0
            replacing-1                                    ONLINE       0     0     0
              scsi-SATA_VBOX_HARDDISK_VBaf0a693c-ec9482f2  ONLINE       0     0     0
              scsi-SATA_VBOX_HARDDISK_VB3be4e1ad-ef1bfd24  ONLINE       0     0     0  (resilvering)

errors: No known data errors

Let's check the free space after the resilvering completes:

buser@backup:~$ zfs list
NAME                                 USED  AVAIL  REFER  MOUNTPOINT
backuppool                           557M  37.7G    96K  /mnt/storage
backuppool/DocumentsBackup           555M  37.7G   421M  /mnt/storage/DocumentsBackup
[...]
buser@backup:~$

Now let's remove the autoexpand property:

sudo zpool set autoexpand=off backuppool

Now the work is complete.

How to Change ZFS Disk on the simple 1-disk pool

This can be tricky because you cannot remove the only disk in the pool. You need to add it to the system in an available SATA port or whatever port you can,

set the autoexpand property and then perform the replace operation.

Here is the sequence of operations:

First we perform the whole backup on the single-disk pool with a descriptor like this:

SRC_POOL=zfspool
SRC_DATASET=Documents

DST_POOL=testpool
DST_DATASET=DocumentsBackupSingleDisk

DST_USERNAME=buser
DST_ADDR=backup

then we perform the backup and this is the result:

buser@backup:~$ zfs list -t snapshot
NAME                                                     USED  AVAIL  REFER  MOUNTPOINT
backuppool/DocumentsBackup@2024.07.26-00.48.47           296K      -   474M  -
backuppool/DocumentsBackup@2024.10.27-21.59.11            96K      -   474M  -
backuppool/DocumentsBackup@2024.10.27-22.13.33            96K      -   555M  -
backuppool/DocumentsBackup@2024.10.27-22.15.19            88K      -   421M  -
backuppool/DocumentsBackup@2024.10.27-22.18.59             0B      -   421M  -
testpool/DocumentsBackupSingleDisk@2024.07.26-00.48.47   204K      -   473M  -
testpool/DocumentsBackupSingleDisk@2024.10.27-21.59.11    32K      -   474M  -
testpool/DocumentsBackupSingleDisk@2024.10.27-22.13.33    32K      -   554M  -
testpool/DocumentsBackupSingleDisk@2024.10.27-22.15.19    31K      -   420M  -
testpool/DocumentsBackupSingleDisk@2024.10.27-22.18.59    29K      -   420M  -
buser@backup:~$

Here we see that the testpool has all the snapshots. Now we shutdown the backup machine, add the new 40GB disk, and then turn it up to proceed.

buser@backup:~$ sudo zpool set autoexpand=on testpool
buser@backup:~$ sudo zpool replace testpool scsi-SATA_VBOX_HARDDISK_VB34d7fb0c-9bcc84c6  scsi-SATA_VBOX_HARDDISK_VBa35276ab-58deee46
buser@backup:~$ zpool status
[...]
  pool: testpool
 state: ONLINE
  scan: resilvered 556M in 00:00:04 with 0 errors on Sat Nov  2 23:38:07 2024
config:

        NAME                                           STATE     READ WRITE CKSUM
        testpool                                       ONLINE       0     0     0
          scsi-SATA_VBOX_HARDDISK_VBa35276ab-58deee46  ONLINE       0     0     0

errors: No known data errors

Now it looks that everything went OK: let's check the size:

buser@backup:~$ zfs list
NAME                                 USED  AVAIL  REFER  MOUNTPOINT
[...]
testpool                             555M  37.7G    24K  /mnt/test
testpool/DocumentsBackupSingleDisk   554M  37.7G   420M  /mnt/test/DocumentsBackupSingleDisk
buser@backup:~$

Let's check the snapshots:

buser@backup:~$ zfs list  -t snapshot | grep testpool
testpool/DocumentsBackupSingleDisk@2024.07.26-00.48.47   204K      -   473M  -
testpool/DocumentsBackupSingleDisk@2024.10.27-21.59.11    32K      -   474M  -
testpool/DocumentsBackupSingleDisk@2024.10.27-22.13.33    32K      -   554M  -
testpool/DocumentsBackupSingleDisk@2024.10.27-22.15.19    31K      -   420M  -
testpool/DocumentsBackupSingleDisk@2024.10.27-22.18.59    29K      -   420M  -

Looks good! :)

Clone this wiki locally