Newbie confused with setting up ZFS

Notice: Page may contain affiliate links for which we may earn a small commission through services like Amazon Affiliates or Skimlinks.

tedSmith123

New Member
Oct 19, 2012
1
0
0
Hi,

Sorry for the dumb question, but I am trying to setup a ZFS NAS using Open Indiana and I am having a hell of problem trying to config this. In summary, every time I've created a zfs filesystem and then reboot, the box would failed on the reboot on mounting and I am unsure why.

First, I should start by saying that I am just experimenting with this before dropping any cash on the hardware, so all of this is done with a virtual box.

These are the steps of what I've done, please correct me if I have done anything stupid

a). Install OI ... all good.

b). Create 4 files to replicate 4 physical HDs with

mkfile 10G /hitachi/diskA.file
mkfile 10G /hitachi/diskB.file
mkfile 10G /hitachi/diskC.file
mkfile 10G /hitachi/diskD.file

where /hitachi is mounted on a different physical disk to the boot drive ( that is, not on the default "rpool" ). This is setup on /etc/vfstab and mounting correctly on UFS.

c). Create my ZFS that is going to be my NAS

zpool create tank mirror /hitachi/diskA.file /hitachi/diskB.file mirror /hitachi/diskC.file /hitachi/diskD.file

d). Create a folder to be share

zfs create tank/public

e). At this point, everything is fine and working as in I can touch a file in /tank/public. Note that I have not configured any sharing yet, no NFS, no CIFS ...etc.

# zfs list

NAME USED AVAIL REFER MOUNTPOINT
rpool 8.04G 3.71G 45K /rpool
rpool/ROOT 1.85G 3.71G 31K legacy
rpool/ROOT/openindiana 1.85G 3.71G 1.84G /
rpool/dump 3.00G 3.71G 3.00G -
rpool/export 98K 3.71G 32K /export
rpool/export/home 66K 3.71G 32K /export/home
rpool/export/home/ted 34K 3.71G 34K /export/home/ted
rpool/swap 3.19G 6.77G 132M -
tank 146K 9.78G 31K /tank
tank/public 31K 9.78G 31K /tank/public

# zfs mount
rpool/ROOT/openindiana /
rpool/export /export
rpool/export/home /export/home
rpool/export/home/ted /export/home/ted
rpool /rpool
tank /tank
tank/public /tank/public

Also I did not manually created the /tank and /tank/public directory myself.

f). If I reboot the box, I would get these messages ...

cannot mount 'tank/public' : directory is not empty
svc:/system/filesystem/local:default: WARNING : /usr/sbin/zfs mount -a failed: exit status 1
svc:/system/filesystem/local:default: Method "/lib/svc/method/fs-local" failed with exit status 95.

g). Upon login and su as root, I can see /tank/public is mounted and the file that I've touched previous is right there

I can run "zfs umount -a" and "zfs mount -a" straight after without any error messages. If I clear svc maintenance and reboot, sometimes this problem disappears but would reappear once I've touched another file.
I am unsure if this is relating to "By default, ZFS does not allow mounting on top of a nonempty directory" which I saw on the Solaris ZFS Admin guide.

What am I doing wrong ? Your advice is appreciated.

Thanks

Ted
 

gea

Well-Known Member
Dec 31, 2010
3,157
1,195
113
DE
Your setup confused my a little bit especially the UFS and /etc/vfstab mount of files as raw devices in b.
I suppose, your files are not converted to blockdevices after a reboot .
You may also check if you have a regular folder /tank/public which is not allowed.

But I would:
- create virtual disks in virtualbox and use them like real disks (the suggested way)
- or create ZFS volumes (http://docs.oracle.com/cd/E19963-01/html/821-1448/gaypf.html)
- or create (encrypted) devices from files with lofiadm
after a reboot, you need to re-create devices from them with lofiadm prior use
more http://constantin.glez.de/blog/2012/02/introducing-sparse-encrypted-zfs-pools

read also
http://docs.oracle.com/cd/E19082-01/817-2271/gazcr/index.html
 
Last edited: