Announcement

Collapse
No announcement yet.

Playing with ZFS

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Playing with ZFS

    I decided to play a little bit with ZFS by plugging three USB sticks into a USB 3.0 passive hub and playing with them. One is a 16GB stick, the second is 32GB and the third is a 64GB stick. I used PartitionManager to condition the 32 and 64GB sticks into 14.46GB partitions, to match the size of the 16GB stick.

    Then I identified the /dev/disk/by-id/ part numbers of each partition and then issued the following commands.

    Code:
    root@jerry-Aspire-V3-771:~# [FONT=courier new][B]zpool create -f usb64 raidz /dev/disk/by-id/usb-SanDisk_Cruzer_Dial_4C530001320419100424-0:0-part1  /dev/disk/by-id/usb-SanDisk_Cruzer_Dial_4C530001320419100424-0:0-part2  /dev/disk/by-id/usb-SanDisk_Cruzer_Dial_4C530001320419100424-0:0-part3 /dev/disk/by-id/usb-SanDisk_Cruzer_Dial_4C530001320419100424-0:0-part4[/B][/FONT]
    
    root@jerry-Aspire-V3-771:~# [FONT=courier new][B]zpool create -f usb16 /dev/disk/by-id/usb-_USB_DISK_3.0_070C67D3B9B63686-0:0-part1
    [/B]
    root@jerry-Aspire-V3-771:~# [B]zpool create -f usb32 /dev/disk/by-id/usb-SanDisk_Cruzer_4C530001140217123443-0:0-part1 /dev/disk/by-id/usb-SanDisk_Cruzer_4C530001140217123443-0:0-part2[/B][/FONT]
    
    
    root@jerry-Aspire-V3-771:~#[FONT=courier new][B] zpool status[/B][/FONT]
      pool: usb16
     state: ONLINE
      scan: none requested
    config:
    
            NAME                                            STATE     READ WRITE CKSUM
            usb16                                           ONLINE       0     0     0
              usb-_USB_DISK_3.0_070C67D3B9B63686-0:0-part1  ONLINE       0     0     0
    
    errors: No known data errors
    
      pool: usb32
     state: ONLINE
      scan: none requested
    config:
    
            NAME                                                 STATE     READ WRITE CKSUM
            usb32                                                ONLINE       0     0     0
              usb-SanDisk_Cruzer_4C530001140217123443-0:0-part1  ONLINE       0     0     0
              usb-SanDisk_Cruzer_4C530001140217123443-0:0-part2  ONLINE       0     0     0
    
    errors: No known data errors
    
      pool: usb64
     state: ONLINE
      scan: none requested
    config:
    
            NAME                                                        STATE     READ WRITE CKSUM
            usb64                                                       ONLINE       0     0     0
              raidz1-0                                                  ONLINE       0     0     0
                usb-SanDisk_Cruzer_Dial_4C530001320419100424-0:0-part1  ONLINE       0     0     0
                usb-SanDisk_Cruzer_Dial_4C530001320419100424-0:0-part2  ONLINE       0     0     0
                usb-SanDisk_Cruzer_Dial_4C530001320419100424-0:0-part3  ONLINE       0     0     0
                usb-SanDisk_Cruzer_Dial_4C530001320419100424-0:0-part4  ONLINE       0     0     0
    
    errors: No known data errors
    Like the Btrfs devs, the ZFS devs do not recommend using /dev/sdXn for drive assignments.

    Now, I'm going to play with them ... tomorrow.
    "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
    – John F. Kennedy, February 26, 1962.

    #2
    Look forward to the results
    Dave Kubuntu 20.04 Registered Linux User #462608

    Wireless Script: http://ubuntuforums.org/showthread.p...5#post12350385

    Comment


      #3
      I turned on my laptop this afternoon and it wouldn't boot. The 2nd of three drives kept blinking (the 16GB USB3.0 stick), indicating that it was trying to boot up. I let it try for a couple minutes, hoping that the boot would be passed to my sda1 /boot, but no joy. So, I turned off the laptop, unplugged the passive USB hub from my USB3 port, and turned my laptop back on. When the boot process reached the splash screen stage I plugged the passive hub back in.

      When my desktop came up I opened a Konsole and "sudo -i" into root. Then I did
      Code:
      [B]zpool status[/B]
        pool: usb16
       state: ONLINE
        scan: none requested
      config:
      
              NAME                                            STATE     READ WRITE CKSUM
              usb16                                           ONLINE       0     0     0
                usb-_USB_DISK_3.0_070C67D3B9B63686-0:0-part1  ONLINE       0     0     0
      
      errors: No known data errors
      
        pool: usb32
       state: ONLINE
        scan: none requested
      config:
      
              NAME                                                 STATE     READ WRITE CKSUM
              usb32                                                ONLINE       0     0     0
                usb-SanDisk_Cruzer_4C530001140217123443-0:0-part1  ONLINE       0     0     0
                usb-SanDisk_Cruzer_4C530001140217123443-0:0-part2  ONLINE       0     0     0
      
      errors: No known data errors
      
        pool: usb64
       state: ONLINE
        scan: none requested
      config:
      
              NAME                                                        STATE     READ WRITE CKSUM
              usb64                                                       ONLINE       0     0     0
                raidz1-0                                                  ONLINE       0     0     0
                  usb-SanDisk_Cruzer_Dial_4C530001320419100424-0:0-part1  ONLINE       0     0     0
                  usb-SanDisk_Cruzer_Dial_4C530001320419100424-0:0-part2  ONLINE       0     0     0
                  usb-SanDisk_Cruzer_Dial_4C530001320419100424-0:0-part3  ONLINE       0     0     0
                  usb-SanDisk_Cruzer_Dial_4C530001320419100424-0:0-part4  ONLINE       0     0     0
      
      errors: No known data errors
      All the pools were mounted, online and waiting. I decided to follow the examples given in this article.

      At this point the zpools appear as
      /usb16
      /usb32
      /usb64
      when I did "vdir /"

      I could have begun copying files to those pools as they are, but doing that doesn't appear to be good crickets in the ZFS community, and only datasets can be snapshotted. So, I created a dataset called "data"
      Code:
      root@jerry-Aspire-V3-771:~# [B]zfs create usb32/data[/B]
      ZFS filesystem, volumes, and snapshot properties are:
      Code:
      root@jerry-Aspire-V3-771:/# [B]zfs set[/B]
      missing property=value argument
      usage:
              set <property=value> <filesystem|volume|snapshot> ...
      
      The following properties are supported:
      
              PROPERTY       EDIT  INHERIT   VALUES
      
              available        NO       NO   <size>
              clones           NO       NO   <dataset>[,...]
              compressratio    NO       NO   <1.00x or higher if compressed>
              creation         NO       NO   <date>
              defer_destroy    NO       NO   yes | no
              logicalreferenced  NO       NO   <size>
              logicalused      NO       NO   <size>
              mounted          NO       NO   yes | no
              origin           NO       NO   <snapshot>
              refcompressratio  NO       NO   <1.00x or higher if compressed>
              referenced       NO       NO   <size>
              type             NO       NO   filesystem | volume | snapshot | bookmark
              used             NO       NO   <size>
              usedbychildren   NO       NO   <size>
              usedbydataset    NO       NO   <size>
              usedbyrefreservation  NO       NO   <size>
              usedbysnapshots  NO       NO   <size>
              userrefs         NO       NO   <count>
              written          NO       NO   <size>
              aclinherit      YES      YES   discard | noallow | restricted | passthrough | passthrough-x
              acltype         YES      YES   noacl | posixacl
              atime           YES      YES   on | off
              canmount        YES       NO   on | off | noauto
              casesensitivity  NO      YES   sensitive | insensitive | mixed
              checksum        YES      YES   on | off | fletcher2 | fletcher4 | sha256
              compression     YES      YES   on | off | lzjb | gzip | gzip-[1-9] | zle | lz4
              context         YES       NO   <selinux context>
              copies          YES      YES   1 | 2 | 3
              dedup           YES      YES   on | off | verify | sha256[,verify]
              defcontext      YES       NO   <selinux defcontext>
              devices         YES      YES   on | off
              exec            YES      YES   on | off
              filesystem_count YES       NO   <count>
              filesystem_limit YES       NO   <count> | none
              fscontext       YES       NO   <selinux fscontext>
              logbias         YES      YES   latency | throughput
              mlslabel        YES      YES   <sensitivity label>
              mountpoint      YES      YES   <path> | legacy | none
              nbmand          YES      YES   on | off
              normalization    NO      YES   none | formC | formD | formKC | formKD
              overlay         YES      YES   on | off
              primarycache    YES      YES   all | none | metadata
              quota           YES       NO   <size> | none
              readonly        YES      YES   on | off
              recordsize      YES      YES   512 to 1M, power of 2
              redundant_metadata YES      YES   all | most
              refquota        YES       NO   <size> | none
              refreservation  YES       NO   <size> | none
              relatime        YES      YES   on | off
              reservation     YES       NO   <size> | none
              rootcontext     YES       NO   <selinux rootcontext>
              secondarycache  YES      YES   all | none | metadata
              setuid          YES      YES   on | off
              sharenfs        YES      YES   on | off | share(1M) options
              sharesmb        YES      YES   on | off | sharemgr(1M) options
              snapdev         YES      YES   hidden | visible
              snapdir         YES      YES   hidden | visible
              snapshot_count  YES       NO   <count>
              snapshot_limit  YES       NO   <count> | none
              sync            YES      YES   standard | always | disabled
              utf8only         NO      YES   on | off
              version         YES       NO   1 | 2 | 3 | 4 | 5 | current
              volblocksize     NO      YES   512 to 128k, power of 2
              volsize         YES       NO   <size>
              vscan           YES      YES   on | off
              xattr           YES      YES   on | off | dir | sa
              zoned           YES      YES   on | off
              userused@...     NO       NO   <size>
              groupused@...    NO       NO   <size>
              userquota@...   YES       NO   <size> | none
              groupquota@...  YES       NO   <size> | none
              written@<snap>   NO       NO   <size>
      
      Sizes are specified in bytes with standard units such as K, M, G, etc.
      
      User-defined properties can be specified by using a name containing a colon (:).
      
      The {user|group}{used|quota}@ properties must be appended with
      a user or group specifier of one of these forms:
          POSIX name      (eg: "matt")
          POSIX id        (eg: "126829")
          SMB name@domain (eg: "matt@sun")
          SMB SID         (eg: "S-1-234-567-89")
      I didn't mess with any of those properties but just list them here to show what is available in the Ubuntu version of ZFS.

      I used mc to copy a bunch of files from my home directory to /usb32/data
      mc showed that the dataset was 98% full. I noticed NO degradation in speed at that level.
      Code:
      root@jerry-Aspire-V3-771:/#[B] vdir /usb32/data[/B]
      total 378391
      -rw------- 1 jerry jerry    287858 May 21 10:51 bookmarks-2018-05-21.json
      -rw-rw-r-- 1 jerry jerry    241247 Apr 10 21:21 corn_worksheets.zip
      -rw-rw-r-- 1 jerry jerry 322221283 Sep 26  2017 kmail_bkup_2017_09_26.zip
      -rw-rw-r-- 1 jerry jerry      4752 Apr  2 15:13 ned_problem
      -rw-rw-r-- 1 jerry jerry        99 Apr  2 15:22 ned_problem_data
      -rw-rw-r-- 1 jerry jerry       498 Apr  2 19:57 ned_sage_equation
      -rw-rw-r-- 1 jerry jerry      2976 Mar 23 19:28 netstat_stats.txt
      -rw-rw-r-- 1 jerry jerry  64170635 Apr  2 20:53 WebPlotDigitizer-4.1-linux-x64.zip
      -rw-rw-r-- 1 jerry jerry       553 May 26 22:44 zfs_creation_commands.txt
      
      root@jerry-Aspire-V3-771:/# [B]df -h /usb32[/B]
      Filesystem      Size  Used Avail Use% Mounted on
      usb32            28G     0   28G   0% /usb32
      The next thing to try was a snapshot:
      Code:
      root@jerry-Aspire-V3-771:~# [B]zfs list -t snapshot [/B]
      no datasets available
      root@jerry-Aspire-V3-771:~# [B]zfs snapshot -r usb32/data@snap1data[/B]
      root@jerry-Aspire-V3-771:~# [B]zfs list -t snapshot[/B]
      NAME                   USED  AVAIL  REFER  MOUNTPOINT
      usb32/data@snap1data      0      -   370M  -
      I then delete the data in /usb32/data and rolled back
      Code:
      root@jerry-Aspire-V3-771:~#[B] rm -rf /usb32/data[/B]
      
      root@jerry-Aspire-V3-771:/# [B]zfs rollback usb32/data@snap1data[/B]
      The data was gone, and then it was back.

      I then did a scrub of the dataset.
      Code:
      root@jerry-Aspire-V3-771:/# [B]zpool scrub usb32 [/B]
      root@jerry-Aspire-V3-771:/#[B] zpool status[/B]
        pool: usb16
       state: ONLINE
        scan: none requested
      config:
      
              NAME                                            STATE     READ WRITE CKSUM
              usb16                                           ONLINE       0     0     0
                usb-_USB_DISK_3.0_070C67D3B9B63686-0:0-part1  ONLINE       0     0     0
      
      errors: No known data errors
      
        [FONT=courier new][B]pool: usb32
       state: ONLINE
        scan: scrub in progress since Sun May 27 15:20:10 2018
          213M scanned out of 370M at 19.3M/s, 0h0m to go
          0 repaired, 57.56% done
      config:
      
              NAME                                                 STATE     READ WRITE CKSUM
              usb32                                                ONLINE       0     0     0
                usb-SanDisk_Cruzer_4C530001140217123443-0:0-part1  ONLINE       0     0     0
                usb-SanDisk_Cruzer_4C530001140217123443-0:0-part2  ONLINE       0     0     0[/B][/FONT]
      [FONT=courier new][B]
      errors: No known data errors[/B][/FONT]
      
        pool: usb64
       state: ONLINE
        scan: none requested
      config:
      
              NAME                                                        STATE     READ WRITE CKSUM
              usb64                                                       ONLINE       0     0     0
                raidz1-0                                                  ONLINE       0     0     0
                  usb-SanDisk_Cruzer_Dial_4C530001320419100424-0:0-part1  ONLINE       0     0     0
                  usb-SanDisk_Cruzer_Dial_4C530001320419100424-0:0-part2  ONLINE       0     0     0
                  usb-SanDisk_Cruzer_Dial_4C530001320419100424-0:0-part3  ONLINE       0     0     0
                  usb-SanDisk_Cruzer_Dial_4C530001320419100424-0:0-part4  ONLINE       0     0     0
      
      errors: No known data errors
      root@jerry-Aspire-V3-771:/# zpool status
        pool: usb16
       state: ONLINE
        scan: none requested
      config:
      
              NAME                                            STATE     READ WRITE CKSUM
              usb16                                           ONLINE       0     0     0
                usb-_USB_DISK_3.0_070C67D3B9B63686-0:0-part1  ONLINE       0     0     0
      
      errors: No known data errors
      
        [FONT=courier new][B]pool: usb32
       state: ONLINE
        scan: scrub repaired 0 in 0h0m with 0 errors on Sun May 27 15:20:29 2018
      config:
      
              NAME                                                 STATE     READ WRITE CKSUM
              usb32                                                ONLINE       0     0     0
                usb-SanDisk_Cruzer_4C530001140217123443-0:0-part1  ONLINE       0     0     0
                usb-SanDisk_Cruzer_4C530001140217123443-0:0-part2  ONLINE       0     0     0
      
      errors: No known data errors
      [/B][/FONT]
        pool: usb64
       state: ONLINE
        scan: none requested
      config:
      
              NAME                                                        STATE     READ WRITE CKSUM
              usb64                                                       ONLINE       0     0     0
                raidz1-0                                                  ONLINE       0     0     0
                  usb-SanDisk_Cruzer_Dial_4C530001320419100424-0:0-part1  ONLINE       0     0     0
                  usb-SanDisk_Cruzer_Dial_4C530001320419100424-0:0-part2  ONLINE       0     0     0
                  usb-SanDisk_Cruzer_Dial_4C530001320419100424-0:0-part3  ONLINE       0     0     0
                  usb-SanDisk_Cruzer_Dial_4C530001320419100424-0:0-part4  ONLINE       0     0     0
      
      errors: No known data errors
      [B]root@jerry-Aspire-V3-771:/# zpool status usb32[/B]
        pool: usb32
       state: ONLINE
        scan: scrub repaired 0 in 0h0m with 0 errors on Sun May 27 15:20:29 2018
      config:
      
              NAME                                                 STATE     READ WRITE CKSUM
              usb32                                                ONLINE       0     0     0
                usb-SanDisk_Cruzer_4C530001140217123443-0:0-part1  ONLINE       0     0     0
                usb-SanDisk_Cruzer_4C530001140217123443-0:0-part2  ONLINE       0     0     0
      
      errors: No known data errors
      I took a btrfs snapshot of @ as @z_usb32 and browsed it. Like /home, which is a btrfs subvolume titled @home, none of the pools showed any contents. /usb16, /usb32 and /usb64 were empty in the snapshot. Btrfs ignores nested subvolumes when a snapshot is taken. I deleted @z_usb32.

      I deleted the dataset data.
      Code:
      root@jerry-Aspire-V3-771:/# [B]zfs destroy usb32/data@snap1data[/B]
      root@jerry-Aspire-V3-771:/# [B]zfs list -t snapshot[/B]
      no datasets available
      In the next posting, I will create another dataset, populated it, make snapshots, and explore the snapshots. Like Btrfs, if one is working in the dataset and inadvertently damages or destroys a file or folder, one can retrieve that file or folder from the snapshot. The only loss will be what was added since the snapshot was taken, and things removed since the last snapshot will reappear after the rollback.
      Last edited by GreyGeek; May 27, 2018, 03:19 PM. Reason: forgot to mention scrub
      "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
      – John F. Kennedy, February 26, 1962.

      Comment


        #4
        I made another snapshot, /usb32/data@snap1data.
        Then I deleted some files and added other files.
        Code:
        root@jerry-Aspire-V3-771:/# [B]vdir /usb32/data[/B]
        total 8600
        -rw-rw-r-- 1 jerry jerry  241247 Apr 10 21:21 corn_worksheets.zip
        -rw-rw-r-- 1 jerry jerry    4752 Apr  2 15:13 ned_problem
        -rw-rw-r-- 1 jerry jerry      99 Apr  2 15:22 ned_problem_data
        -rw-rw-r-- 1 jerry jerry     498 Apr  2 19:57 ned_sage_equation
        -rw-rw-r-- 1 jerry jerry    2976 Mar 23 19:28 netstat_stats.txt
        -rwxr-x--- 1 jerry jerry 8491478 Jul 19  2006 NoGutsNoGlory.pdf
        -rw-rw-r-- 1 jerry jerry    2081 Apr 16 21:29 oshunluver_bkup_script.sh
        -rw-rw-r-- 1 jerry jerry     553 May 26 22:44 zfs_creation_commands.txt
        Then I took another snapshot, /usr32/data@snap2data
        Code:
        root@jerry-Aspire-V3-771:/# [B]zfs snapshot -r usb32/data@snap2data[/B]
        root@jerry-Aspire-V3-771:/# [B]zfs list -t snapshot[/B]
        NAME                   USED  AVAIL  REFER  MOUNTPOINT
        usb32/data@snap1data   369M      -   370M  -
        usb32/data@snap2data      0      -  8.42M  -
        So now all I need to do is find where ZFS stores its snapshots.

        First, turn on "listsnapshots".
        Code:
        root@jerry-Aspire-V3-771:/# [B]zpool get listsnapshots usb32[/B]
        NAME   PROPERTY       VALUE      SOURCE
        usb32  listsnapshots  off        default
        root@jerry-Aspire-V3-771:/# [B]zpool set listsnapshots=on usb32[/B]
        root@jerry-Aspire-V3-771:/# [B]zpool get listsnapshots usb32[/B]
        NAME   PROPERTY       VALUE      SOURCE
        usb32  listsnapshots  on         local
        
        root@jerry-Aspire-V3-771:/# [B]zfs list[/B]
        NAME                   USED  AVAIL  REFER  MOUNTPOINT
        usb16                   61K  13.9G    19K  /usb16
        usb32                  378M  27.7G    19K  /usb32
        usb32/data             378M  27.7G  8.42M  /usb32/data
        usb32/data@snap1data   369M      -   370M  -
        usb32/data@snap2data      0      -  8.42M  -
        usb64                 79.3K  41.7G  25.4K  /usb64
        Turning listsnapshots on allowed "zfs list" to list the snapshots.
        Code:
        root@jerry-Aspire-V3-771:/# zpool set listsnapshots=off usb32
        root@jerry-Aspire-V3-771:/# zfs list
        NAME         USED  AVAIL  REFER  MOUNTPOINT
        usb16         61K  13.9G    19K  /usb16
        usb32        378M  27.7G    19K  /usb32
        usb32/data   378M  27.7G  8.42M  /usb32/data
        usb64       79.3K  41.7G  25.4K  /usb64
        One cannot browse /usb32/data/@snap1data because it does not exist at that location. Oracle says:
        Snapshots of file systems are accessible in the .zfs/snapshot directory within the root of the file system. For example, if tank/home/ahrens is mounted on /home/ahrens, then the tank/home/ahrens@thursday snapshot data is accessible in the /home/ahrens/.zfs/snapshot/thursday directory.
        The "home" of usb32 is "/". However, "/" does not appear to contain .zfs
        Code:
        root@jerry-Aspire-V3-771:/# ls 
        backup  boot   dev  home        initrd.img.old  lib32  media  opt   root  sbin  sys  usb16  usb64  var      vmlinuz.old
        bin     cdrom  etc  initrd.img  lib             lib64  mnt    proc  run   srv   tmp  usb32  usr    vmlinuz
        
        root@jerry-Aspire-V3-771:/# locate .zfs
        /sbin/fsck.zfs
        /sbin/mount.zfs
        /usr/share/man/man8/fsck.zfs.8.gz
        /usr/share/man/man8/mount.zfs.8.gz
        Neither ls, vdir or mc would show .zfs under usb32. So, I assumed that it was "hiding". In the blind I did
        Code:
        root@jerry-Aspire-V3-771:/#[B] cd .zfs[/B]
        -bash: cd: .zfs: No such file or directory
        root@jerry-Aspire-V3-771:/# [B]cd usb32[/B]
        root@jerry-Aspire-V3-771:/usb32# [B]cd .zfs[/B]
        root@jerry-Aspire-V3-771:[COLOR=#ff0000]/usb32/.zfs[/COLOR]# [B]dir[/B]
        shares  snapshot
        There they were! Not under root, but in the pool itself. However, I was quickly disappointed. mc didn't show anything. Neither did vdir or ls.
        Code:
        root@jerry-Aspire-V3-771:/usb32/.zfs# [B]vdir[/B]
        total 0
        dr-xr-xr-x 2 root root 2 May 27 16:56 shares
        dr-xr-xr-x 2 root root 2 May 27 14:05 snapshot
        
        root@jerry-Aspire-V3-771:/usb32/.zfs# [B]vdir shares/[/B]
        [COLOR=#ff0000]total 0[/COLOR]
        root@jerry-Aspire-V3-771:/usb32/.zfs# [B]vdir snapshot/[/B]
        [COLOR=#ff0000]total 0[/COLOR]
        root@jerry-Aspire-V3-771:/usb32/.zfs#[B] cd snapshot[/B]
        root@jerry-Aspire-V3-771:/usb32/.zfs/snapshot# [B]cd snap1data[/B]
        -bash: cd: snap1data: No such file or directory
        root@jerry-Aspire-V3-771:/usb32/.zfs/snapshot# [B]cd @snap1data[/B]
        -bash: cd: @snap1data: No such file or directory
        Ok, where are the snapshots themselves stored?

        Off to do some more searching. I can't copy individual folders and files out of a snapshot IF I can't find the snapshot. Btrfs is easy. The snapshots are exactly where I want to put them.

        Meanwhile, a couple of quick listings about dataset usage:
        Code:
        root@jerry-Aspire-V3-771:/# [B]zfs list -r -t snapshot -o name,creation /usb32[/B]
        NAME                  CREATION
        usb32/data@snap1data  Sun May 27 16:21 2018
        usb32/data@snap2data  Sun May 27 16:31 2018
        
        root@jerry-Aspire-V3-771:/# [B]zfs list -o space[/B]
        NAME        AVAIL   USED  USEDSNAP  USEDDS  USEDREFRESERV  USEDCHILD
        usb16       13.9G    61K         0     19K              0        42K
        usb32       27.7G   378M         0     19K              0       378M
        usb32/data  27.7G   378M      369M   8.42M              0          0
        usb64       41.7G  79.3K         0   25.4K              0      53.9K
        
        
        root@jerry-Aspire-V3-771:/usb32/.zfs/snapshot# [B]zfs diff usb32/data@snap1data usb32/data@snap2data[/B]
        M       /usb32/data/
        -       /usb32/data/WebPlotDigitizer-4.1-linux-x64.zip
        +       /usb32/data/NoGutsNoGlory.pdf
        -       /usb32/data/bookmarks-2018-05-21.json
        +       /usb32/data/oshunluver_bkup_script.sh
        -       /usb32/data/kmail_bkup_2017_09_26.zip
        Last edited by GreyGeek; May 27, 2018, 04:19 PM.
        "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
        – John F. Kennedy, February 26, 1962.

        Comment


          #5
          Well, after playing all afternoon with ZFS I decided that I had seen enough. I did the following commands:
          Code:
          root@jerry-Aspire-V3-771:/# [B]zpool destroy usb16[/B]
          root@jerry-Aspire-V3-771:/# [B]zpool destroy usb32[/B]
          root@jerry-Aspire-V3-771:/# [B]zpool destroy usb64[/B]
          usb32 had the data dataset. It and all the data in usb32, and usb32, were blown away in a couple seconds.

          This concludes my trip in ZFS wonderland. I won't be playing in that sandbox any longer for the foreseeable future.
          "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
          – John F. Kennedy, February 26, 1962.

          Comment


            #6
            I think you were looking for the snapshots in the wrong directory. The correct .zfs directory should be in the root of the filesystem in question...in your case the snapshots should have been in /usb32/data/.zfs/snapshots (not /usb32/.zfs/snapshots like you tried...in your test usb32 and usb32/data were separate filesystems), IOW, I think you misunderstood this part:
            Snapshots of file systems are accessible in the .zfs/snapshot directory within the root of the file system
            It does not mean the system root directory (/) or the root of the "parent" filesystem (/usb32), it means the root of the file system mounted at /usb32/data, which can be found in /usb32/data (since the filesystem is currently mounted there)..

            Also, the .zfs directory is invisible by default (you can still cd into it like you noticed), if you wish to make it visible, you can use "zfs set snapdir=visible <pool>/<dataset>"
            Last edited by kubicle; May 27, 2018, 09:41 PM.

            Comment


              #7
              Playing with ZFS

              I am not surprised. I assumed that might be the case as well, but .zfs was not visible under /usb32/data and doing
              cd /usb32/data/.zfs
              in the blind gave a. “not found” msg.

              The .zfs directory I did find was at /usb32/.zfs and it had two subdirs; share and snapshots, but both were empty. As I wrote, neither mc, ls, dir or vdir would show /usb32/.zfs but I could navigate to it blindly. It would show up as a hidden file in Dolphin, either. I set Dolphin to show “hidden” files so apparently there is a difference between Kubuntu’s “hidden” and ZFS’s “invisible”.

              An aside: The four ZFS partitions were very difficult to reformat. Deleting the partitions in Kpartition and formatting the lone remaining raw partition always completed with a “Success!” Msg but when you clicked the “Ok” button on the dialog it would immediately revert to four zfs partitions. I had to use
              dd if=/dev/zero of=/dev/sdd bs=4096
              followed by
              Mkfs.vfat /dev/sdd -I
              Then it held. Using bs=1024 didn’t work even though the MBR is only 512 bytes.

              All three usb sticks gave me this problem. This was even after I destroyed the pool. z_mnt was a running process.

              Anyway, my curiosity about ZFS has been satisfied and any thoughts about moving to it or using it have been eliminated.

              I also noticed that ZFS suffers from the same documentation problem Btrfs has. The Internet is awash in outdated docs, or docs that are valid for only one time period a/o one particular brand. The more recent the release the fewer the docs that describe the new features or explain why older features were dropped.
              Last edited by GreyGeek; May 27, 2018, 11:57 PM.
              "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
              – John F. Kennedy, February 26, 1962.

              Comment


                #8
                Originally posted by GreyGeek View Post
                I assumed that might be the case as well, but .zfs was not visible under /usb32/data and doing
                cd /usb32/data/.zfs
                in the blind gave a. “not found” msg.
                Are you sure, you did not mention that in your posts? (See my next post for more)

                Originally posted by GreyGeek View Post
                The .zfs directory I did find was at /usb32/.zfs and it had two subdirs; share and snapshots, but both were empty. As I wrote, neither mc, ls, dir or vdir would show /usb32/.zfs but I could navigate to it blindly.
                That .zfs/snapshots directory would be were you'd find snapshots of the usb32 filesystem (for example usb32@somesnaphot), the usb32/data filesystem snapshots (for example usb32/data@somesnapshot) should have been in usb32/data/.zfs/snapshots. This is both logical and a technical necessity...you might imagine unmounting a filesystem and moving the media to the other side of the earth, attaching the media to another computer and mounting the file system there. It would make no sense for the snaphots to be stored on the original machine (in it's root or the former parent directory), it would also be impossible to keep the snapshot delta up to date, as the filesystem delta could not magically leap between the the original and current machine.

                Originally posted by GreyGeek View Post
                It would show up as a hidden file in Dolphin, either. I set Dolphin to show “hidden” files so apparently there is a difference between Kubuntu’s “hidden” and ZFS’s “invisible”.
                There is a difference. That's why I said you'd need to use "zfs set snapdir=visible <pool>/<dataset>" to make it visible. It would still be a "hidden" directory, but would show in dolphin (if show hidden directories was enabled) and ls (with the -a option)...if snapdir=visible is not set, it is truly invisible and not just "hidden".
                Last edited by kubicle; May 28, 2018, 01:04 AM.

                Comment


                  #9
                  After my last post, just to confirm what I wrote, I tested it myself...see below:

                  (get root)
                  $sudo -i

                  (create pool)
                  #zpool create -f usbzfs /dev/sdb

                  #zpool status usbzfs
                  pool: usbzfs
                  state: ONLINE
                  scan: none requested
                  config:

                  NAME STATE READ WRITE CKSUM
                  usbzfs ONLINE 0 0 0
                  sdb ONLINE 0 0 0

                  errors: No known data errors

                  #mount | grep usbzfs
                  usbzfs on /usbzfs type zfs (rw,relatime,xattr,noacl)

                  (create new dataset usbzfs/data)
                  #zfs create usbzfs/data

                  #zfs list
                  NAME USED AVAIL REFER MOUNTPOINT
                  usbzfs 80K 7,21G 19K /usbzfs
                  usbzfs/data 19K 7,21G 19K /usbzfs/data

                  (create snapshot)
                  #zfs snapshot -r usbzfs/data@snap1data

                  #zpool set listsnapshots=on usbzfs

                  #zfs list
                  NAME USED AVAIL REFER MOUNTPOINT
                  usbzfs 83K 7,20G 19K /usbzfs
                  usbzfs/data 19K 7,20G 19K /usbzfs/data
                  usbzfs/data@snap1data 0 - 19K -

                  (list contents of the snapdir ".zfs" of /usbzfs/data/.zfs...note that it's not /usbzfs/.zfs, even though that directory also exists...as a snapdir for usbzfs, but not for usbzfs/data)
                  #ls -la /usbzfs/data/.zfs
                  dr-xr-xr-x 1 root root 0K 28.05.2018 09:33 .
                  drwxr-xr-x 2 root root 1K 28.05.2018 09:33 ..
                  dr-xr-xr-x 2 root root 1K 28.05.2018 09:39 shares
                  dr-xr-xr-x 2 root root 1K 28.05.2018 09:37 snapshot

                  (the .zfs directory is invisible of course)
                  #ls -la /usbzfs/data
                  drwxr-xr-x 2 root root 1K 28.05.2018 09:33 .
                  drwxr-xr-x 3 root root 1K 28.05.2018 09:33 ..

                  (set it visible)
                  #zfs set snapdir=visible usbzfs/data

                  (now it is shown)
                  #ls -la /usbzfs/data
                  drwxr-xr-x 2 root root 1K 28.05.2018 09:33 .
                  drwxr-xr-x 3 root root 1K 28.05.2018 09:33 ..
                  dr-xr-xr-x 1 root root 0K 28.05.2018 09:33 .zfs

                  (finally, confirm that the created snapshot can be found in the snapshot dir...it could be found even if I hadn't made it visible previously, if you know where to look. And it's there where it is supposed to be)
                  #ls -la /usbzfs/data/.zfs/snapshot
                  dr-xr-xr-x 2 root root 1K 28.05.2018 09:37 .
                  dr-xr-xr-x 1 root root 0K 28.05.2018 09:33 ..
                  dr-xr-xr-x 1 root root 0K 28.05.2018 09:48 snap1data
                  Last edited by kubicle; May 28, 2018, 01:05 AM.

                  Comment


                    #10
                    Thanks, Kubical, I was going to create a zpool and test what you wrote, but my ignorance of being able to turn the visibility of snapshots on or off explains why I couldn’t find them. I did try to cd into /usb32/data/.zfs and it did fail.

                    I read where snapshot could be taken of datasets, and as far as I tell a zpool is not a dataset, so I had no inclination to attempt a snapshot of it. When I could cd into /usb32/.zfs but found it empty I was unaware of any difference between a “hidden” file and an “invisible” file.

                    All of this makes me thankful I’m just smart enough to use Btrfs!
                    "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
                    – John F. Kennedy, February 26, 1962.

                    Comment

                    Working...
                    X