ZFS Problem in snapshots

Hi dear,
I have FreeBSD 10.1 in VM and add a hdd with 1 GB capacity, and create a pool via:
# zpool create pool /dev/da1
and for volume:
# zfs create -V 500M pool/vol

Therefore, in pool 500 MB is not allocated.

I start iSCSI initiator in CentOS and view LUN, mount it, then copy files to it, until free space equals 10 MB. When I want to create snapshot it shows:
Code:
can not create snapshot out of space
Thanks.
 
Hi Hamid,

the command you are using creates a zvol block device, is that what you want to do? The command as you show it does in fact allocate the space according to the man pages, you need to use -s to choose the sparse option to create a volume without allocating space:

Though not recommended, a "sparse volume" (also known as "thin provi-
sioning") can be created by specifying the -s option to the "zfs
create
-V" command, or by changing the reservation after the volume
has been created. A "sparse volume" is a volume where the reservation
is less then the volume size. Consequently, writes to a sparse vol-
ume can fail with ENOSPC when the pool is low on space. For a sparse
volume, changes to volsize are not reflected in the reservation.

thanks, Andy.
 
1GB isn't a lot of space. ZFS will use some for itself and you have 500MB taken up by the zvol. Can you show the output of zpool list poolname and zfs list poolname when you are getting the out of space error so we can see how much space you actually have available before the snapshot is taken.
 
Thanks dears,

I do it again as:
I create a pool with 20GB and create volume : # zfs create -V 9G mypool/vol

It been show below:
vbe1_first.png


And I copy many files to volume:
5c82_after_copy.png


Afterwards, I can snapshot from mypool/vol, but with have free space, it can't create new volume.
5x3g_after_snap.png


Can you help me, please?

Problem 2:
Friends, is it right, that snapshots save out of space volume and save in free space of pool?
How much space need for snapshot in each 1 TB?

Thanks.
 
I'm not sure exactly how much free space ZFS needs spare to be able to create new volumes/snapshots. It splits the disks into slabs, and then tries to allocate data inside those slabs in order to try and keep fragmentation down. When you only have a 20GB pool, those slabs will be fairly small, coupled with trying to create datasets that almost fill the entire pool, ZFS is probably struggling to find places to put it.

To be honest your biggest problem seems to be that you're creating tiny pools then trying to 'almost' fill them. There's a general rule that you should have (at least) 20% headroom on a ZFS pool for it to be happy, and I personally would be expecting problems if a pool ever got to the point where there's only a few GB left. ZFS is designed for big storage and is optimised on the basis that it will usually have a lot of room to play with.

As mentioned you could try using the sparse option, so that the zvols only use space as they are filled. Not sure if that will help, but really you need to sort out your requirements. If you want 20GB worth of volumes (and possibly space to snapshot those) then you really want a pool that's at least 50GB.

Code:
zfs create -s -V 9G my pool/vol
 
Thanks dears,
So, for each 1 TB data, I need 1 TB free space in pool, in order to take a snapshot from data?
 
No you don't need 2 TB of space if you only have 1 TB of data. You just need to use some common sense when deciding how much space you require, and make sure you always have a decent amount of overhead and aren't running ZFS into the ground.

If you create a 20 GB pool, I would expect problems if you start trying to create files/volumes/etc that leave you less than about 5 GB, because that's really very little space for ZFS to work with. It's just not been designed for use cases where people have only got a few GB of overhead.
It's designed more for pools of several TB+ where ZFS is always going to have a few hundred GB to work with.

Lets say you want to store 500 GB of data, and also take daily snapshots for 30 days. If you estimate that 10 GB will change every day, your space requirement would be (very roughly) 500 GB + (10 GB * 30) = 800 GB. You could probably get away with using a 1 TB pool for that, as you'd always have ~130 GB spare which is a reasonable amount. If you started getting closer to 900 GB of used space, you'd probably want to look at keeping less snapshots or increasing pool size. If you know from the start that you were going to use almost 1 TB of disk space, I'd suggest just going for a 1.5 or 2 TB pool in the first place.
 
To both elaborate a bit on and reiterate what usdmatt said, you can use ZFS in smaller pools as long as you've properly accounted for your needs. The trouble is that snapshots grow as changes to the filesystem are made, and so trying to make snapshots of small volumes that are under frequent load will invariably eat up all your disk space very quickly.

The other problem is that a ZFS volume (zvol) containing a virtual machine is static---it takes up a predefined amount of space, while ordinary ZFS filesystems are designed to dynamically account for space consumed. This makes the former much less flexible than the latter, since (unless I'm wrong about this) the files within the zvol/virtual machine are ignored and the whole thing is seen as a single unit. Taking snapshots of zvols containing virtual machines will thus consume space much more quickly, as even a minor change to a virtual machine (maybe even just the act of starting up the virtual machine) will result in the entire zvol being written within the snapshot.
 
Back
Top