I have a disk with these layers: sata disk, luks, zpool, ext4
The ext4 fs was created with these commands:
cryptsetup -v luksFormat /dev/sdb
cryptsetup luksOpen /dev/sda store02
zpool create zstore02 /dev/mapper/store02
zfs create -V 1600G zstore02/dsk02
mkfs.ext4 -L dsk02 /dev/zstore02/dsk02
System is Ubuntu 20.04.1 LTS. This pool was later imported on another 20.04.1 system.
I want to create a read/write snapshot and mount it. But it tells me "out of space":
root@computer:~# zpool list
NAME SIZE ALLOC FREE CKPOINT EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
zstore02 1,81T 1,50T 320G - - 7% 82% 1.00x ONLINE -
root@computer:~# zfs list
NAME USED AVAIL REFER MOUNTPOINT
zstore02 1,61T 148G 24K /zstore02
zstore02/dsk02 1,61T 262G 1,50T -
root@computer:~# zfs snapshot zstore02/dsk02@test
cannot create snapshot 'zstore02/dsk02@test': out of space
root@computer:~# zfs get reservation zstore02/dsk02
NAME PROPERTY VALUE SOURCE
zstore02/dsk02 reservation none local
root@computer:~# zfs set reservation=10G zstore02
root@computer:~# zfs set reservation=10G zstore02/dsk02
root@computer:~# zfs snapshot zstore02/dsk02@test
cannot create snapshot 'zstore02/dsk02@test': out of space
root@computer:~#
It does not work with reserved=none nor reserved=10G.
Apparently, "zpool list" reports 300G free space, and "zfs list" reports 262G free space. But somehow I cannot create a snapshot. Why?
UPDATE
If I try to create a new volume, then it works (sorry for the Hungarian locale):
root@computer:~# zfs create -V 1G zstore02/test
root@computer:~# mkfs.ext4 -L test /dev/zstore02/test
mke2fs 1.45.5 (07-Jan-2020)
Eszközblokkok eldobása: kész
Fájlrendszer létrehozása 262144 4 blokkal és 65536 inode-dal
Fájlrendszer UUID: 14e07b33-5d25-465a-aeb8-7fbfe2499dfd
Tartalék szuperblokkok tárolva a blokkokon:
32768, 98304, 163840, 229376
Csoporttáblák foglalása: kész
Inode táblák írásakor: kész
Napló létrehozása (8192 blokk): kész
Szuperblokkok és fájlrendszer-könyvelési információk írása: kész
root@computer:~# zfs snapshot zstore02/test@snap1
root@computer:~# zfs list -t snapshot
NAME USED AVAIL REFER MOUNTPOINT
zstore02/test@snap1 0B - 32,7M -
root@computer:~#
It works for any volume that I create, except zstore02/dsk02.
But why?
You have a
refreservation
set on your zvol, which reserves disk space for that dataset or zvol without regard to snapshots or clones. In order to make a snapshot there must be enough unreserved space left in the dataset to accommodate its referenced space, in this case 1.50T. Since yourrefreservation
is (most likely) 1.61T you basically cannot do much of anything as all the free space gets reserved for that zvol (which will never use it).To fix the problem, get rid of the refreservation.
To avoid the problem in future, create zvols with the
-s
(sparse) flag, which will also thin provision them:If a thick provisioned volume is desired instead, create the volume and then set
refreservation=auto
.