ZFS questions?

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

Albert Yang

Member
Oct 26, 2017
72
1
8
30
Hi,

I was wondering if someone could lend me a hand on a few questions i have,

Currently I have samba share, after reading on creating shadow copies i had 3 options, BTRFS, ZFS or LVM,

As i tried LVM snapshots could not get it work, and im more familiar with ZFS then BTRFS, But there is an issue. The samba share is a VM inside proxmox which runs ZFS. So the samba OS disk is ext while the second disk is ZFS and was successfully configured the shadow copies, but not sure what consequences im going to have in the future because its a vm under proxmox which has ZFS.

  1. do i need to scrub that disk in the vm?

  2. how often should i scrub? before i was scrubbing my host every week but now im doing every month

  3. What should i be prepare as running ZFS under another vm disk which has ZFS


And my second question, Now that i have a vm disk which has the ZFS i would need in the future to know how to expand it, i was reading a bit and found out how to expand it and it worked but theres a part where i delete a partition which i dont know why so not sure if its the correct way.

These are the steps i took and it worked without deleting any information

Code:
zpool set autoexpand=on data
parted /dev/vdc
parted /dev/vdc rm 9
parted /dev/vdc resizepart 1 100%
zpool online -e data /dev/vdc
 

gea

Well-Known Member
Dec 31, 2010
3,157
1,195
113
DE
Scrub
On every read, ZFS verifies the checksum and auto repairs problems from redundancy (self healing). Scrub does the same for all all files in a pool. You run a scrub mainly to get informed early on problems. The interval depends on system quality. I would range it from once a month to once every 6 months. Main problem of a scrub is the reduced pool performance while it runs.

If your VM is ext4 on ZFS, you can only scrub ZFS. But even if ZFS reports no errors, the VM ext4 filesystem can become corrupted, mainly on a crash where the content of the zfs rambased writecache is lost without ZFS syncwrite enabled. If yout guest filesystem is ZFS and you want avoid corruptions and dataloss you must enably sync on the base ZFS and the guest ZFS (performance may ecome very low)

ZFS snaps as Windows previous versions
If SAMBA runs on ext4, it cannot access ZFS snaps. If SAMBA is on a ZFS VM it can only access snaps in the guest ZFS. As SAMBA knows nothing about ZFS and a SAMBA share can span several nested ZFS filesystems it can be impossible or tricky to access ZFS snaps via Windows previous versions. This is different to the kernelbased Solarish ZFS server where a SMB share is a strict ZFS filesystem property and ZFS snaps=previous versions works always out of the box and without special settings or precautions.

ZFS expand
You can expand a pool by replacing all disks in a vdev with larger ones (ex zpool replace tank c1t1d0 c2t0d0). When all disks are replaced (autoexpand=on) the higher capacity is available. Second option to expand capacity is to add a vdev. This will not only increase capacity but also performance. Using low level tools like parted may be dangerous.
 
  • Like
Reactions: fossxplorer

Albert Yang

Member
Oct 26, 2017
72
1
8
30
Thank you so much for the reply,

as for the ZFS expand,
i was successfully expanding ZFS virtual Disk in side of the VM running those steps, i was just concerned about the
Code:
parted /dev/vdc rm 9
as you said above may be dangerous the problem is that im not expanding the pool by adding a disk im expanding a virutal disk which is a VM which has ZFS disk

as for ZFS snaps as Windows previous versions
i was successfully configured it running the OS ext4 and another virtual disk in ZFS (hence above the expanding the disk) and windows can detect it the only odd issue is the time as this is my samba config, if u turn on shadow:localtime to yes the windows previous versions cannot read it

Code:
[shares]
    path = /disk2
    browseable = yes
    force create mode = 0660
    force directory mode = 0660
    valid users = @"Domain Users"
    read list =
    write list = @"Domain Users"
    admin users =
    vfs objects = acl_xattr full_audit recycle shadow_copy2
#    full_audit:failure = connect opendir disconnect unlink mkdir rmdir open rename
full_audit:prefix = %u|%I|%S
full_audit:failure = connect
full_audit:success = mkdir rename unlink rmdir pwrite pread connect disconnect
full_audit:facility = local5
full_audit:priority = notice
shadow: snapdir = .zfs/snapshot
shadow: sort = desc
shadow: format = _%Y-%m-%d_%H:%M:%S
shadow: snapprefix = ^pyznap
shadow: delimiter = _
shadow:localtime = no
    recycle: keeptree = Yes
    recycle: excludedir = /tmp|/var/tmp
    recycle: directory_mode = 0700
    recycle: versions = Yes
    recycle: inherit_nt_acl = Yes
    recycle: repository = RecycleBin
And as for the scrub your right ill leave it by default the scrub monthly, but the VM that has only that disk ZFS should i scrub it? or kinda pointless?
Because im scrubbing the host

Thank you
 

gea

Well-Known Member
Dec 31, 2010
3,157
1,195
113
DE
The base ZFS filesystem cannot guarantee the consistency of any VM guest filesystem unless you enable sync and can trust (or protect/disable) all caches in the system. This is why you may scrub a guest ZFS filesystem as well if you want to verify the whole VM. But overall the risk is low if you do not scrub as the data is always verified on reads..

ZFS snaps = Windows previous versions works when a share is a filesystem. It makes troubles when a share is not a filesystem as .zfs/snapshot is only valid for this filesystem.
 
  • Like
Reactions: Albert Yang