[Lxc-users] lxc-create -B zfs

Tamas Papp tompos at martos.bme.hu
Tue Oct 1 09:51:13 UTC 2013


On 10/01/2013 07:08 AM, Serge Hallyn wrote:
> Quoting Tamas Papp (tompos at martos.bme.hu):
>> On 06/18/2013 04:14 AM, Serge Hallyn wrote:
>>
>> hi Serge,
>>
>>> Quoting Tamas Papp (tompos at martos.bme.hu):
>>>> On 06/10/2013 03:41 PM, Serge Hallyn wrote:
>>>>> Quoting Tamas Papp (tompos at martos.bme.hu):
>>>>>> hi,
>>>>>>
>>>>>> # lxc-create -n pony -t ubuntu -B zfs --zfsroot=tank/lxc
>>>>> Hm.  Mine is simply called 'lxc', and that works.  So it sounds like I'm
>>>>> doing something wrong in parsing the zfsroot, but I can't offhand see
>>>>> in the code where.
>>>>>
>>>>> Could you run this through 'strace -f -odebutfile' and look in debugfile
>>>>> for the exec of 'zfs create'?
>>>> hi,
>>>>
>>>> Sorry, I could get back to this just now:
>>>>
>>>> log.103022:execve("/sbin/zfs", ["zfs", "create",
>>>> "-omountpoint=/var/lib/lxc/test123/rootfs", "tank/lxc/test123"], [/*
>>>> 21 vars */]) = 0
>>>>
>>>> From cli it works fine.
>>>>
>>>> I can send the whole log file, if you want.
>>> Yes, please do - to me personally depending on the size, to spare the
>>> list.
>> Shame on me, I absolutely forgot to answer this email.
>>
>> This one works fine:
>>
>> # lxc-create -n eee -t ubuntu -B zfs --zfsroot tank/lxc

hi,

> Can zfs pools be any directory hierarchy depth?  Examples I had seen

Yes, they can.
A complete zfs pool acts as a hierarchy set of directories and volumes.

For example this one is from a production server:

# zfs list
NAME                     USED  AVAIL  REFER  MOUNTPOINT
tank                    1.56T  3.79T   176K  /tank
tank/eee                 136K  3.79T   136K  /tank/eee
tank/iso                11.1G  3.79T  11.1G  /tank/iso
tank/kvm                97.1G  3.79T   136K  /tank/kvm
tank/kvm/bw1            39.0G  3.79T  32.5G  -
tank/kvm/compreg-vmk01  11.4G  3.79T  9.18G  -
tank/kvm/ipa12          1005M  3.79T   953M  -
tank/kvm/naming-vmk01   18.7G  3.79T  15.3G  -
tank/kvm/naming-vmk02   17.5G  3.79T  12.5G  -
tank/kvm/tpl-kvm-w7     9.49G  3.79T  9.49G  -
tank/lxc                1.46T  3.79T   339M  /tank/lxc
tank/lxc/cz              136K  3.79T   136K  /tank/lxc/cz
tank/lxc/dctest          338M  3.79T   338M  /tank/lxc/dctest
tank/lxc/finance        2.97G  3.79T  2.97G  /tank/lxc/finance
tank/lxc/hammer         1.16T  3.79T  1.16T  /tank/lxc/hammer
tank/lxc/ijc-cipool     38.5G  3.79T  38.5G  /tank/lxc/ijc-cipool
tank/lxc/inventory       706M  3.79T   504M  /tank/lxc/inventory
tank/lxc/jay            94.8G  3.79T  94.8G  /tank/lxc/jay
tank/lxc/jcc-vmc01      1.26G  3.79T  1.26G  /tank/lxc/jcc-vmc01
tank/lxc/marvin4jsci    6.03G  3.79T  6.03G  /tank/lxc/marvin4jsci
tank/lxc/marvinci       5.93G  3.79T  5.93G  /tank/lxc/marvinci
tank/lxc/svntest         149G  3.79T   149G  /tank/lxc/svntest
tank/lxc/webdev-vmc01    767M  3.79T   767M  /tank/lxc/webdev-vmc01
tank/tmp                 282M  3.79T   136K  /tank/tmp



There is nothing directly under the pool 'tank', but mostly filesystems.
tank/lxc and tank/kvm are like forks of a volume group (though they could be used as simple
directories).

> were always just one (i.e. 'tank'), so I always just used 'lxc'.

Terminology:

tank -> pool
tank/lxc -> filesystem
tank/ -> "root" filesystem of the pool.


Differences are in properties:

# zpool get all tank
NAME  PROPERTY               VALUE                  SOURCE
tank  size                   5.44T                  -
tank  capacity               28%                    -
tank  altroot                -                      default
tank  health                 ONLINE                 -
tank  guid                   14358046246634998549   default
tank  version                -                      default
tank  bootfs                 -                      default
tank  delegation             on                     default
tank  autoreplace            off                    default
tank  cachefile              -                      default
tank  failmode               wait                   default
tank  listsnapshots          off                    default
tank  autoexpand             off                    default
tank  dedupditto             0                      default
tank  dedupratio             1.00x                  -
tank  free                   3.87T                  -
tank  allocated              1.57T                  -
tank  readonly               off                    -
tank  ashift                 12                     local
tank  comment                -                      default
tank  expandsize             0                      -
tank  freeing                0                      default
tank  feature at async_destroy  enabled                local
tank  feature at empty_bpobj    active                 local
tank  feature at lz4_compress   active                 local

# zfs get all tank
NAME  PROPERTY              VALUE                  SOURCE
tank  type                  filesystem             -
tank  creation              Tue Jul 16 17:23 2013  -
tank  used                  1.57T                  -
tank  available             3.79T                  -
tank  referenced            176K                   -
tank  compressratio         1.32x                  -
tank  mounted               yes                    -
tank  quota                 none                   default
tank  reservation           none                   default
tank  recordsize            128K                   default
tank  mountpoint            /tank                  default
tank  sharenfs              off                    default
tank  checksum              on                     default
tank  compression           lz4                    local
tank  atime                 off                    local
tank  devices               on                     default
tank  exec                  on                     default
tank  setuid                on                     default
tank  readonly              off                    default
tank  zoned                 off                    default
tank  snapdir               hidden                 default
tank  aclinherit            restricted             default
tank  canmount              on                     default
tank  xattr                 on                     default
tank  copies                1                      default
tank  version               5                      -
tank  utf8only              off                    -
tank  normalization         none                   -
tank  casesensitivity       sensitive              -
tank  vscan                 off                    default
tank  nbmand                off                    default
tank  sharesmb              off                    default
tank  refquota              none                   default
tank  refreservation        none                   default
tank  primarycache          all                    default
tank  secondarycache        all                    default
tank  usedbysnapshots       0                      -
tank  usedbydataset         176K                   -
tank  usedbychildren        1.57T                  -
tank  usedbyrefreservation  0                      -
tank  logbias               latency                default
tank  dedup                 off                    default
tank  mlslabel              none                   default
tank  sync                  standard               default
tank  refcompressratio      1.00x                  -
tank  written               176K                   -
tank  snapdev               hidden                 default




For --zfsroot filesystem needs to be used. It can be either '<POOLNAME>' or '<POOLNAME>/a/b/c', 
anything that can be used for zfs create:

$ zfs create <POOLNAME>/a/b/c

>From the manpage:

zfs create [-p] [-o property=value] ... filesystem


Thank you,
tamas




More information about the lxc-users mailing list