Randy S wrote:
Hi,

although I am still trying to fix my multipath problem mentioned in another 
post I also have the following matter which maybe one of you guys can explain.

I have created a zpool and a volume which has been exported via iSCSI. I want 
te create a script which shows me the exact free space on that particular 
volume. (OI 7)

Sparse provisioned?

Using zfs get reservation,volsize,usedbydataset,written,usedbysnapshots <name of 
volume> you get all these nice numbers while filling up the drive from a client 
machine.

As long as you are filling up the drive, calculations seem to be parallel with 
the actual situation.
As soon as you start deleting files and snapshots, it all becomes fuzzy, at 
least to me.

Example, when you delete a snapshot, or all snapshots , the usedbysnapshots 
drops to 0 as it should.
When you delete files from the iscsi volume with the client, the 
"usedbydataset" number stays the same, rendering the calculation:

That is correct. Freeing space on the client filesystem (unless it implements SCSI UNMAP) does not free space the volume. The volume has no way of knowing the space has been freed.

Now I read somewhere (a long time ago) that zfs has a certain mechanism to 
release free space to the system, I just cannot find the article anywhere now.

So that is why I want to ask anybody here to explain to me how I could go about 
this.

The easiest(!) way is a follows:

 - Make sure the zvol has compression enabled.
 - Create a filesystem on the client with compression off.
- Within that filesystem, fill the free space with a file of zeros (this will compress to nothing on the volume):

dd if=/dev/zero of=dummy bs=1048576 &
unlink dummy

When the dd finishes, you will have the same free space on the client and server. The unlink makes sure the dummy file disappears when the dd fills the client.

--
Ian.


_______________________________________________
OpenIndiana-discuss mailing list
[email protected]
http://openindiana.org/mailman/listinfo/openindiana-discuss

Reply via email to