# ZFS question



## lordmor (Mar 23, 2009)

Hi all,

I have a question regarding zfs.
I'm doing following:


```
(ttyp0) root@shuttle ~ # zpool list                                                                                                                                 
no pools available
(ttyp0) root@shuttle ~ # zfs list 
no datasets available
(ttyp0) root@shuttle ~ # zpool create flash /dev/da0 
(ttyp0) root@shuttle ~ # zpool list 
NAME                    SIZE    USED   AVAIL    CAP  HEALTH     ALTROOT
flash                   117M    110K    117M     0%  ONLINE     -
(ttyp0) root@shuttle ~ # zfs list 
NAME    USED  AVAIL  REFER  MOUNTPOINT
flash   105K  84.9M    18K  /flash
(ttyp0) root@shuttle ~ # zfs create flash/usb 
(ttyp0) root@shuttle ~ # zfs list
NAME        USED  AVAIL  REFER  MOUNTPOINT
flash       130K  84.9M    19K  /flash
flash/usb    18K  84.9M    18K  /flash/usb
(ttyp0) root@shuttle ~ #
```

Why zpool list shows size 117M and zfs list 84.9M?
This is 128M USB stick so those 117M should be right but I'm not able to use more then above mentioned 84.9M.


```
(ttyp0) root@shuttle ~ # dd if=/dev/zero of=/flash/usb/zerofile bs=1m count=100                                                                                     22:33:14
dd: /flash/usb/zerofile: No space left on device
85+0 records in
84+1 records out
88866816 bytes transferred in 32.829308 secs (2706935 bytes/sec)
(ttyp0) root@shuttle ~ #
```

Why I can't use the whole capacity of this USB? What am I doing wrong?


Thanks,
LM


----------



## SirDice (Mar 24, 2009)

What does *zfs get all flash/usb* tell you? You might have set an reservation/quota?


----------



## lordmor (Mar 24, 2009)

Hi SirDice 

I did not set any reservation/quota, or at least I'm not aware of it.

Here is the result of *zfs get all flash/usb*:

```
(ttyp1) root@shuttle ~ # zfs get all flash/usb                          8:33:25
NAME       PROPERTY       VALUE                  SOURCE
flash/usb  type           filesystem             -
flash/usb  creation       Mon Mar 23 22:28 2009  -
flash/usb  used           18K                    -
flash/usb  available      84.7M                  -
flash/usb  referenced     18K                    -
flash/usb  compressratio  1.00x                  -
flash/usb  mounted        no                     -
flash/usb  quota          none                   default
flash/usb  reservation    none                   default
flash/usb  recordsize     128K                   default
flash/usb  mountpoint     legacy                 inherited from flash
flash/usb  sharenfs       off                    default
flash/usb  checksum       on                     default
flash/usb  compression    off                    default
flash/usb  atime          on                     default
flash/usb  devices        on                     default
flash/usb  exec           on                     default
flash/usb  setuid         on                     default
flash/usb  readonly       off                    default
flash/usb  jailed         off                    default
flash/usb  snapdir        hidden                 default
flash/usb  aclmode        groupmask              default
flash/usb  aclinherit     secure                 default
flash/usb  canmount       on                     default
flash/usb  shareiscsi     off                    default
flash/usb  xattr          on                     default
flash/usb  copies         1                      default
```

As I can see there is reservation/quota = none.

Thanks,
LM


----------



## SirDice (Mar 24, 2009)

Not sure but I have a sneaky suspicion the 'missing' space is used for housekeeping.


```
root@molly:~/test#dd if=/dev/zero of=file1 bs=1m count=128
128+0 records in
128+0 records out
134217728 bytes transferred in 2.922296 secs (45928861 bytes/sec)
root@molly:~/test#ll
total 131152
-rw-r--r--  1 root  dice  134217728 Mar 24 14:49 file1
root@molly:~/test#mdconfig -f file1
md0
root@molly:~/test#zpool create mypool /dev/md0
root@molly:~/test#zpool status
  pool: mypool
 state: ONLINE
 scrub: none requested
config:

        NAME        STATE     READ WRITE CKSUM
        mypool      ONLINE       0     0     0
          md0       ONLINE       0     0     0

errors: No known data errors
root@molly:~/test#zfs create mypool/myshare
root@molly:~/test#zfs list
NAME             USED  AVAIL  REFER  MOUNTPOINT
mypool           129K  90.9M    18K  /mypool
mypool/myshare    18K  90.9M    18K  /mypool/myshare
```


----------



## lordmor (Mar 24, 2009)

Ah, it seems that you're right.


```
(ttyp1) root@shuttle /usr/test # dd if=/dev/zero of=file1 bs=1m count=10240                                                                                         17:44:29
10240+0 records in
10240+0 records out
10737418240 bytes transferred in 235.914320 secs (45514059 bytes/sec)
(ttyp1) root@shuttle /usr/test # mdconfig -f file1                                                                                                                  17:48:44
md0
(ttyp1) root@shuttle /usr/test # zpool create mypool /dev/md0                                                                                                       17:49:51
(ttyp1) root@shuttle /usr/test # zpool list                                                                                                                         17:50:07
NAME                    SIZE    USED   AVAIL    CAP  HEALTH     ALTROOT
flash                   117M    330K    117M     0%  ONLINE     -
mypool                 9.94G    110K   9.94G     0%  ONLINE     -
(ttyp1) root@shuttle /usr/test # zfs create mypool/myshare                                                                                                          17:50:18
(ttyp1) root@shuttle /usr/test # zfs list                                                                                                                           17:50:30
NAME             USED  AVAIL  REFER  MOUNTPOINT
flash            301K  84.7M    19K  legacy
flash/usb         18K  84.7M    18K  legacy
mypool           129K  9.78G    18K  /mypool
mypool/myshare    18K  9.78G    18K  /mypool/myshare
```

Do you know where can I find more about this housekeeping?
(i.e. how is this space calculated)

Thanks a lot for your help,
LM


----------



## SirDice (Mar 24, 2009)

lordmor said:
			
		

> Do you know where can I find more about this housekeeping?
> (i.e. how is this space calculated)


No, I tried looking for it but couldn't find anything that explained it in simple terms :\

Did find this: ZFS On-Disk Specification (pdf)

So it was mainly an educated guess on my part


----------



## lordmor (Mar 24, 2009)

*[solved]*



			
				SirDice said:
			
		

> Did find this: ZFS On-Disk Specification (pdf)



Ok, will look in this .pdf
Thanks again


----------

