Discussion:
advise or best practices with ZFS snapshot
sesquivels--- via freebsd-questions
2021-04-06 03:41:09 UTC
Permalink
Hello team, tank you for your time.

I was building ZFS pool

geom disk list
Geom name: nvd0
Providers:
1. Name: nvd0
   Mediasize: 512110190592 (477G)
   Sectorsize: 512
   Mode: r2w2e4
   descr: ADATA SX8100NP
   lunid: 00000000010000004ce00018dd8c9084
   ident: 2K26291JGN17
   rotationrate: 0
   fwsectors: 0
   fwheads: 0

Geom name: ada2
Providers:
1. Name: ada2
   Mediasize: 1000204886016 (932G)
   Sectorsize: 512
   Stripesize: 4096
   Stripeoffset: 0
   Mode: r1w1e1
   descr: ST1000LM035-1RK172
   lunid: 5000c500a7f6b348
   ident: WDE31N7X
   rotationrate: 5400
   fwsectors: 63
   fwheads: 16

Geom name: ada3
Providers:
1. Name: ada3
   Mediasize: 1000204886016 (932G)
   Sectorsize: 512
   Stripesize: 4096
   Stripeoffset: 0
   Mode: r1w1e1
   descr: TOSHIBA MQ04ABF100
   lunid: 500003998238047c
   ident: 9915PKVBT
   rotationrate: 5400
   fwsectors: 63
   fwheads: 16

Geom name: ada4
Providers:
1. Name: ada4
   Mediasize: 1000204886016 (932G)
   Sectorsize: 512
   Stripesize: 4096
   Stripeoffset: 0
   Mode: r1w1e2
   descr: ST1000LM049-2GH172
   lunid: 5000c500b9fa0d1f
   ident: WGS1DNPB
   rotationrate: 7200
   fwsectors: 63
   fwheads: 16

Geom name: ada5
Providers:
1. Name: ada5
   Mediasize: 1000204886016 (932G)
   Sectorsize: 512
   Stripesize: 4096
   Stripeoffset: 0
   Mode: r1w1e2
   descr: ST1000LM035-1RK172
   lunid: 5000c500b40a20b4
   ident: ZDEEM2PD
   rotationrate: 5400
   fwsectors: 63
   fwheads: 16

Geom name: ada6
Providers:
1. Name: ada6
   Mediasize: 1000204886016 (932G)
   Sectorsize: 512
   Stripesize: 4096
   Stripeoffset: 0
   Mode: r1w1e2
   descr: TOSHIBA MQ04ABF100
   lunid: 50000399eb100983
   ident: 30HOP52LT
   rotationrate: 5400
   fwsectors: 63
   fwheads: 16

Geom name: ada7
Providers:
1. Name: ada7
   Mediasize: 1000204886016 (932G)
   Sectorsize: 512
   Stripesize: 4096
   Stripeoffset: 0
   Mode: r1w1e2
   descr: ST1000LM035-1RK172
   lunid: 5000c500b3e1e35e
   ident: ZDEEF3X9
   rotationrate: 5400
   fwsectors: 63
   fwheads: 16

Geom name: ada8
Providers:
1. Name: ada8
   Mediasize: 1000204886016 (932G)
   Sectorsize: 512
   Stripesize: 4096
   Stripeoffset: 0
   Mode: r1w1e1
   descr: WDC WD10SPZX-22Z10T1
   lunid: 50014ee26897b98e
   ident: WD-WXB2AA00UENK
   rotationrate: 5400
   fwsectors: 63
   fwheads: 16

Geom name: ada0
Providers:
1. Name: ada0
   Mediasize: 1000204886016 (932G)
   Sectorsize: 512
   Stripesize: 4096
   Stripeoffset: 0
   Mode: r1w1e1
   descr: TOSHIBA MQ04ABF100
   lunid: 5000039a6b124e9a
   ident: Y0PPP0UWT
   rotationrate: 5400
   fwsectors: 63
   fwheads: 16

Geom name: ada1
Providers:
1. Name: ada1
   Mediasize: 128035676160 (119G)
   Sectorsize: 512
   Mode: r1w1e2
   descr: MTFDDAK128MAM-1J1
   lunid: 500a0751039d7440
   ident: 1405039D7440
   rotationrate: 0
   fwsectors: 63
   fwheads: 16


------------------------------------------------


zpool status
  pool: zroot
state: ONLINE
  scan: scrub repaired 0 in 0 days 01:43:28 with 0 errors on Thu Mar 18 01:57:21 2021
config:

        NAME        STATE     READ WRITE CKSUM
        zroot       ONLINE       0     0     0
          raidz1-0  ONLINE       0     0     0
            ada4p3  ONLINE       0     0     0
            ada5p3  ONLINE       0     0     0
            ada6p3  ONLINE       0     0     0
            ada7p3  ONLINE       0     0     0
          raidz1-2  ONLINE       0     0     0
            ada0    ONLINE       0     0     0
            ada2    ONLINE       0     0     0
            ada3    ONLINE       0     0     0
            ada8    ONLINE       0     0     0
        logs
          nvd0p2    ONLINE       0     0     0
        cache
          nvd0p1    ONLINE       0     0     0

errors: No known data errors


-----------------------------------------------------
I found some information at manpages for ZFS and,

https://docs.oracle.com/cd/E18752_01/html/819-5461/gbchx.html
https://docs.oracle.com/cd/E19253-01/819-5461/gbiqe/index.html

And these are my questions:

About zfs administration, and snapshots, where can I found more information?

I did this snapshot

zfs list -t snapshot
NAME                 USED  AVAIL  REFER  MOUNTPOINT
zroot/***@03252021  32.6G      -   353G  -

And interested on:

Doing a zfs send to file  as this, may I delete snapshjot from my zpool and then restore it using zfs receiver?
zfs send zroot/***@03252021 | gzip > /mnt/bkp/march2021.gz

I will be appreciate any advise,

Serguei Esquivel
David Christensen
2021-04-06 18:53:00 UTC
Permalink
Post by sesquivels--- via freebsd-questions
Geom name: ada1
1. Name: ada1
   Mediasize: 128035676160 (119G)
   Sectorsize: 512
   Mode: r1w1e2
   descr: MTFDDAK128MAM-1J1
   lunid: 500a0751039d7440
   ident: 1405039D7440
   rotationrate: 0
   fwsectors: 63
   fwheads: 16
What is this drive used for?
Post by sesquivels--- via freebsd-questions
zpool status
  pool: zroot
state: ONLINE
  scan: scrub repaired 0 in 0 days 01:43:28 with 0 errors on Thu Mar 18 01:57:21 2021
        NAME        STATE     READ WRITE CKSUM
        zroot       ONLINE       0     0     0
          raidz1-0  ONLINE       0     0     0
            ada4p3  ONLINE       0     0     0
            ada5p3  ONLINE       0     0     0
            ada6p3  ONLINE       0     0     0
            ada7p3  ONLINE       0     0     0
          raidz1-2  ONLINE       0     0     0
            ada0    ONLINE       0     0     0
            ada2    ONLINE       0     0     0
            ada3    ONLINE       0     0     0
            ada8    ONLINE       0     0     0
        logs
          nvd0p2    ONLINE       0     0     0
        cache
          nvd0p1    ONLINE       0     0     0
errors: No known data errors
So, your pool is comprised of two raidz1 vdevs of 4 @ 1 TB each, an NVMe
partition for log, and an NVMe partition for cache.


OS pools are named 'zpool' by the FreeBSD installer. Data pools are
conventionally named 'tank' (I use the letter 'p' followed by a unique
number). This article has some good ideas:

https://b3n.org/zfs-hierarchy/


Is the above your OS pool?


If your log device fails, you may lose data. The recommended practice
is to use a vdev with redundancy for the log (e.g. 2 drive mirror, 3
drive raidz1, etc.).

https://docs.oracle.com/cd/E19253-01/819-5461/gazgw/index.html


Using a partition on your NVMe device for the cache should help performance.
Post by sesquivels--- via freebsd-questions
About zfs administration, and snapshots, where can I found more information?
I like the books by Lucas:

https://mwl.io/nonfiction/os#af3e

https://mwl.io/nonfiction/os#fmzfs

https://mwl.io/nonfiction/os#fmaz
Post by sesquivels--- via freebsd-questions
https://docs.oracle.com/cd/E19253-01/819-5461/gbiqe/index.html
zfs list -t snapshot
NAME USED AVAIL REFER MOUNTPOINT
My pools were created with early versions of FreeBSD 11R and 12R, and do
not have the 'listsnapshots' property.
Post by sesquivels--- via freebsd-questions
https://docs.oracle.com/cd/E18752_01/html/819-5461/gbchx.html
Doing a zfs send to file as this, may I delete [snapshot] from my
zpool and then restore it using zfs receiver?
Do you understand that the above command will not backup any child
filesystems of zroot/Dom? Nor any other snapshots?


If and when you restore that filesystem, you may want to validate it.
mtree(8) is one option:

https://www.techrepublic.com/blog/it-security/use-mtree-for-filesystem-integrity-auditing/


Once you figure out how to properly backup, restore, and validate your
filesystem(s), you will need to think about backup redundancy and aging
policies. I would retain snapshots on the live system until it needed
more space. I would retain backup files on the backup device or system
until it needed more space.


Are you aware of zfs-auto-snapshot?

# pkg install zfstools


zfs-auto-snapshot is configured via crontab(1):

2021-04-06 10:30:36 ***@f3 ~
# crontab -l | grep ds2
3 * * * * /usr/local/sbin/zfs-auto-snapshot -P p3/ds2 -k h 24
15 3 * * 0 /usr/local/sbin/zfs-auto-snapshot -P p3/ds2 -k w 4
21 3 1 * * /usr/local/sbin/zfs-auto-snapshot -P p3/ds2 -k m 24
27 3 1 1 * /usr/local/sbin/zfs-auto-snapshot -P p3/ds2 -k y 99

and via ZFS properties:

2021-04-06 10:33:05 ***@f3 ~
# zfs get all p3 p3/ds2 | grep auto-snapshot
p3 com.sun:auto-snapshot true local
p3/ds2 com.sun:auto-snapshot true inherited from p3


I write scripts for repetitive operations to get accuracy and
consistency. My collection of scripts has grown and evolved as I have
learned.


ZFS may appear simple going in, but is non-trivial in practice. I had
more than a few painful accidents early on. I suggest that you build a
virtual machine, some pools, and some filesystems to learn and practice
with. Go through the various use-cases and make sure that you
understand what is happening before you attempt them on live data.


David
sesquivels via freebsd-questions
2021-04-10 05:41:13 UTC
Permalink
Post by sesquivels--- via freebsd-questions
Hello team, tank you for your time.
I was building ZFS pool
geom disk list
Geom name: nvd0
1. Name: nvd0
�� Mediasize: 512110190592 (477G)
�� Sectorsize: 512
�� Mode: r2w2e4
�� descr: ADATA SX8100NP
�� lunid: 00000000010000004ce00018dd8c9084
�� ident: 2K26291JGN17
�� rotationrate: 0
�� fwsectors: 0
�� fwheads: 0
Geom name: ada2
1. Name: ada2
�� Mediasize: 1000204886016 (932G)
�� Sectorsize: 512
�� Stripesize: 4096
�� Stripeoffset: 0
�� Mode: r1w1e1
�� descr: ST1000LM035-1RK172
�� lunid: 5000c500a7f6b348
�� ident: WDE31N7X
�� rotationrate: 5400
�� fwsectors: 63
�� fwheads: 16
Geom name: ada3
1. Name: ada3
�� Mediasize: 1000204886016 (932G)
�� Sectorsize: 512
�� Stripesize: 4096
�� Stripeoffset: 0
�� Mode: r1w1e1
�� descr: TOSHIBA MQ04ABF100
�� lunid: 500003998238047c
�� ident: 9915PKVBT
�� rotationrate: 5400
�� fwsectors: 63
�� fwheads: 16
Geom name: ada4
1. Name: ada4
�� Mediasize: 1000204886016 (932G)
�� Sectorsize: 512
�� Stripesize: 4096
�� Stripeoffset: 0
�� Mode: r1w1e2
�� descr: ST1000LM049-2GH172
�� lunid: 5000c500b9fa0d1f
�� ident: WGS1DNPB
�� rotationrate: 7200
�� fwsectors: 63
�� fwheads: 16
Geom name: ada5
1. Name: ada5
�� Mediasize: 1000204886016 (932G)
�� Sectorsize: 512
�� Stripesize: 4096
�� Stripeoffset: 0
�� Mode: r1w1e2
�� descr: ST1000LM035-1RK172
�� lunid: 5000c500b40a20b4
�� ident: ZDEEM2PD
�� rotationrate: 5400
�� fwsectors: 63
�� fwheads: 16
Geom name: ada6
1. Name: ada6
�� Mediasize: 1000204886016 (932G)
�� Sectorsize: 512
�� Stripesize: 4096
�� Stripeoffset: 0
�� Mode: r1w1e2
�� descr: TOSHIBA MQ04ABF100
�� lunid: 50000399eb100983
�� ident: 30HOP52LT
�� rotationrate: 5400
�� fwsectors: 63
�� fwheads: 16
Geom name: ada7
1. Name: ada7
�� Mediasize: 1000204886016 (932G)
�� Sectorsize: 512
�� Stripesize: 4096
�� Stripeoffset: 0
�� Mode: r1w1e2
�� descr: ST1000LM035-1RK172
�� lunid: 5000c500b3e1e35e
�� ident: ZDEEF3X9
�� rotationrate: 5400
�� fwsectors: 63
�� fwheads: 16
Geom name: ada8
1. Name: ada8
�� Mediasize: 1000204886016 (932G)
�� Sectorsize: 512
�� Stripesize: 4096
�� Stripeoffset: 0
�� Mode: r1w1e1
�� descr: WDC WD10SPZX-22Z10T1
�� lunid: 50014ee26897b98e
�� ident: WD-WXB2AA00UENK
�� rotationrate: 5400
�� fwsectors: 63
�� fwheads: 16
Geom name: ada0
1. Name: ada0
�� Mediasize: 1000204886016 (932G)
�� Sectorsize: 512
�� Stripesize: 4096
�� Stripeoffset: 0
�� Mode: r1w1e1
�� descr: TOSHIBA MQ04ABF100
�� lunid: 5000039a6b124e9a
�� ident: Y0PPP0UWT
�� rotationrate: 5400
�� fwsectors: 63
�� fwheads: 16
Geom name: ada1
1. Name: ada1
�� Mediasize: 128035676160 (119G)
�� Sectorsize: 512
�� Mode: r1w1e2
�� descr: MTFDDAK128MAM-1J1
�� lunid: 500a0751039d7440
�� ident: 1405039D7440
�� rotationrate: 0
�� fwsectors: 63
�� fwheads: 16
------------------------------------------------
zpool status
� pool: zroot
state: ONLINE
� scan: scrub repaired 0 in 0 days 01:43:28 with 0 errors on Thu Mar 18 01:57:21 2021
������� NAME������� STATE���� READ WRITE CKSUM
������� zroot������ ONLINE������ 0���� 0���� 0
��������� raidz1-0� ONLINE������ 0���� 0���� 0
����������� ada4p3� ONLINE������ 0���� 0���� 0
����������� ada5p3� ONLINE������ 0���� 0���� 0
����������� ada6p3� ONLINE������ 0���� 0���� 0
����������� ada7p3� ONLINE������ 0���� 0���� 0
��������� raidz1-2� ONLINE������ 0���� 0���� 0
����������� ada0��� ONLINE������ 0���� 0���� 0
����������� ada2��� ONLINE������ 0���� 0���� 0
����������� ada3��� ONLINE������ 0���� 0���� 0
����������� ada8��� ONLINE������ 0���� 0���� 0
������� logs
��������� nvd0p2��� ONLINE������ 0���� 0���� 0
������� cache
��������� nvd0p1��� ONLINE������ 0���� 0���� 0
errors: No known data errors
-----------------------------------------------------
I found some information at manpages for ZFS and,
https://docs.oracle.com/cd/E18752_01/html/819-5461/gbchx.html
https://docs.oracle.com/cd/E19253-01/819-5461/gbiqe/index.html
About zfs administration, and snapshots, where can I found more information?
I did this snapshot
zfs list -t snapshot
NAME���������������� USED� AVAIL� REFER� MOUNTPOINT
Doing a zfs send to file� as this, may I delete snapshjot from my zpool and then restore it using zfs receiver?
I will be appreciate any advise,
Serguei Esquivel
Loading...