Page 1 of 2 12 LastLast
Results 1 to 10 of 17

Thread: Ubuntu 24.04 and zfs snapshots

  1. #1
    Join Date
    Feb 2017
    Beans
    75

    Ubuntu 24.04 and zfs snapshots

    There were already things said on this subject, but I would need more recent info, applicable to the new Ubuntu. I use zfs on Ubuntu since 20.04 (no encryption) and I like how it would create snapshot whenever something is installed, I had to restore system more than once in the past. That feature is however missing in 24.04.

    So, what to use now to make and manage zfs snapshots? Sadly, Timeshift doesn't work with zfs AFAIK. Does anyone use zfsnap? Could the old zfs snapshot functionality be restored again in 24.04? I'd appreciate all input.

  2. #2
    Join Date
    Mar 2010
    Location
    USA
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: Ubuntu 24.04 and zfs snapshots

    What you mentioned about a past "feature" was for Zsys, which came with Ubuntu 20.04 LTS using the ZFS-On-Root install.

    Zsys was short lived. It had problems filling the bpool with snapshots, becaseu the defualt snapshot count was too many, and the size of the bpool not large enough to handle that many. That could be adjusted to get around that.

    I have not heard of zfsnap. I'll have to try it before I can really say anything about it.

    There is a long list of ZFS snapshot msnsgers out there. They are all wrappers of the basic commands...
    Sanoid
    Syncoid
    ZnapZend
    zfs-auto-snapshot
    zsys
    zfs-snap-manager
    zrepl
    Oracle ZFSSA

    I still seem to fall back to doing it manually.

    "Concurrent coexistence of Windows, Linux and UNIX..." || Ubuntu user # 33563, Linux user # 533637
    Sticky: Graphics Resolution | UbuntuForums 'system-info' Script | Posting Guidelines | Code Tags

  3. #3
    #&thj^% is offline I Ubuntu, Therefore, I Am
    Join Date
    Aug 2016
    Beans
    Hidden!

    Re: Ubuntu 24.04 and zfs snapshots

    just to add to MAFoElffen's list there is also ZC-Commander.
    Code:
    ┌─ Datasets ─────────────────────────────────────────────────────────┐┌─ Snapshots ─────────────────────────────────────────────────────────┐
    │bpool                                                               ││bpool@5-6-2024                                                       │
    │bpool/BOOT                                                          ││bpool/BOOT@5-6-2024                                                  │
    │bpool/BOOT/ubuntu_xj7tth                                            ││bpool/BOOT/ubuntu_xj7tth@5-6-2024                                    │
    │rpool                                                               ││rpool@5-6-2024                                                       │
    │rpool/ROOT                                                          ││rpool/ROOT@5-6-2024                                                  │
    │rpool/ROOT/ubuntu_xj7tth                                            ││rpool/USERDATA@5-6-2024                                              │
    │rpool/ROOT/ubuntu_xj7tth/srv                                        ││rpool/USERDATA/home_qkvs92@5-6-2024                                  │
    │rpool/ROOT/ubuntu_xj7tth/usr                                        ││rpool/USERDATA/root_qkvs92@5-6-2024                                  │
    │rpool/ROOT/ubuntu_xj7tth/usr/local                                  ││                                                                     │
    │rpool/ROOT/ubuntu_xj7tth/var                                        ││                                                                     │
    │rpool/ROOT/ubuntu_xj7tth/var/games                                  ││                                                                     │
    │rpool/ROOT/ubuntu_xj7tth/var/lib                                    ││                                                                     │
    │rpool/ROOT/ubuntu_xj7tth/var/lib/AccountsService                    ││                                                                     │
    │rpool/ROOT/ubuntu_xj7tth/var/lib/NetworkManager                     ││                                                                     │
    │rpool/ROOT/ubuntu_xj7tth/var/lib/apt                                ││                                                                     │
    │rpool/ROOT/ubuntu_xj7tth/var/lib/dpkg                               ││                                                                     │
    │rpool/ROOT/ubuntu_xj7tth/var/log                                    ││                                                                     │
    │rpool/ROOT/ubuntu_xj7tth/var/mail                                   ││                                                                     │
    │rpool/ROOT/ubuntu_xj7tth/var/snap                                   ││                                                                     │
    │rpool/ROOT/ubuntu_xj7tth/var/spool                                  ││                                                                     │
    │rpool/ROOT/ubuntu_xj7tth/var/www                                    ││                                                                     │
    └────────────────────────────────────────────────────────────────────┘└─────────────────────────────────────────────────────────────────────┘
     F1 Help  F2 Promote  F3 ____  F4 ____  F5 Snapshot  F6 Rename  F7 Create  F8 Destroy  F9 Get all  F10 Exit
    https://github.com/manoeldesouza/zc
    And I as well like manual snapshots...
    Last edited by #&thj^%; May 11th, 2024 at 04:38 PM. Reason: fixed code tags

  4. #4
    Join Date
    Feb 2017
    Beans
    75

    Re: Ubuntu 24.04 and zfs snapshots

    Great, this seems like a nice beginning, lots of apps to check out. But I'm mostly interested in apps that people have actually tested on 24.04, because there are always these little changes in booting and whatnot, I would hate to think that I'm safe because I have a snapshot, just to end up with an unbootable system after a restore attempt. If you could perhaps restore the fs to earlier state just to confirm that the tool works fine on new Ubuntu.

    And since you mentioned manual snapshots, let's see how that would work exactly, since I'm not a virtuoso with the complicated zfs command. How exactly would I properly take snapshots of the existing bpool and rpool and restore them to the time of the snapshot, after let's say Nvidia driver update messes up my system, which tends to happen a lot?

  5. #5
    Join Date
    Mar 2010
    Location
    USA
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: Ubuntu 24.04 and zfs snapshots

    I can let you know, both 1fallen and I are the majority of the support for ZFS in the forums, and we also are both DEV-Testers for releases in the DEV-cyles. So us testing ZFS in the DEV cycles IS something we both do.

    Further, ZFS is ZFS. We found no issues with doing snapshots with "Ubuntu 24.04". There were issues that we pushed fixes for for 22.04 & 23.10, with the version of Grub, but we pushed the fix for DEV-Noble before it's release, and had the patches backported for 22.04 & 23.10.

    We also got the version of the (then) current version of zfs-linus pushed for Noble to overcome some issues OpenZFS issues, and other patches pushed for other things ZFS. So that when Noble was released, it passed both what we thought should be there for us, and the other Users.

    Like I said, those snapshot managers are just wrappers over the underlying zpool and zfs commands. Those commands did not change for OpenZFS 2.2.x.

    Yes. I tell people to try and review things for themselves. That is going to confirm what you feel is right for you and how you want to do things. I can't tell you what is 'best for you'. LOL. Personal tastes are diverse.

    NVidia needing to be uninstalled/reinstalled is an ongoing thing. That is just a part of owning NVidia high-end graphics. 1fallen and I both have Nvidia. I thik he would agree that NVidia owners just need to learn and remember a few things to "keep them" going through updates. It's not currently as bad as it used to be years ago. There was a time when every kernel update was a trigger to manually fix it. The repetition of doing that has become second nature. For NVidia, it's not if, it's when... And rolling a snapshot back to fix that is only a band-aid. The other updates that triggered it are still going to happen eventually.

    "Concurrent coexistence of Windows, Linux and UNIX..." || Ubuntu user # 33563, Linux user # 533637
    Sticky: Graphics Resolution | UbuntuForums 'system-info' Script | Posting Guidelines | Code Tags

  6. #6
    #&thj^% is offline I Ubuntu, Therefore, I Am
    Join Date
    Aug 2016
    Beans
    Hidden!

    Re: Ubuntu 24.04 and zfs snapshots

    +1 With MAFoElffen
    Quote Originally Posted by laserburn2 View Post
    And since you mentioned manual snapshots, let's see how that would work exactly, since I'm not a virtuoso with the complicated zfs command. How exactly would I properly take snapshots of the existing bpool and rpool and restore them to the time of the snapshot, after let's say Nvidia driver update messes up my system, which tends to happen a lot?
    here is a great place to study up on: https://ubuntu.com/tutorials/using-z...nes#1-overview

    Also as MAFoElffen said nVidia is just a different non native part of Linux, you will have to install the drivers again. (In most cases)

  7. #7
    Join Date
    Mar 2010
    Location
    USA
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: Ubuntu 24.04 and zfs snapshots

    This is my script that automates an nVidia driver reinstall:
    Code:
    #!/bin/bash
    
    ## MAFoelffen,<mafoelffen@ubuntu.com,20180429
    # Updated 2024.05.11
    #
    #  Purpose: reinstall nVidia Driver
    #
    
    ############
    # Variables
    ############
    installed_driver=$(apt list nvidia-driver* --installed 2>/dev/null | \
        awk -F '/' '/nvidia-driver/ {print $1}')
    exit_code=0
    
    ############
    # Functions
    ############
    
    function CheckInstalled() {
        if [ !z $installed_driver ]
        then
            exit_code=1
            echo -e "No drivers were found to remove."
            exit $exit_code
        fi
    }
    
    function RemoveOld() {
        sudo apt remove --purge -y nvidia* libnvidia*
        exit_code=$?
        if [ $exit_code -ne 0 ]
        then
            echo -e "There was a problem removing drivers. Exiting."
            exit $exit_code
        fi 
    }
    
    funcion Reinstall() {
        sudo apt install -y $installed_driver
        exit_code=$?
            if [ $exit_code -ne 0 ]
        then
            echo -e "There was a problem reinstalling the driver."
            echo -e "Check the output for the errors.... exiting"
            exit $exit_code
        fi 
    }
    
    #######
    # Main
    #######
    CheckInstalled
    RemoveOld
    Reinstall
    echo -e "Reinstall of nVidia driver was successful"
    Last edited by MAFoElffen; May 11th, 2024 at 08:40 PM.

    "Concurrent coexistence of Windows, Linux and UNIX..." || Ubuntu user # 33563, Linux user # 533637
    Sticky: Graphics Resolution | UbuntuForums 'system-info' Script | Posting Guidelines | Code Tags

  8. #8
    Join Date
    Feb 2017
    Beans
    75

    Re: Ubuntu 24.04 and zfs snapshots

    Thank you, that's a really nice tutorial to cover to important basics. So, let's say update messed up something important on the system and I need to go back to an earlier snapshot. Like this?

    zfs rollback rpool/example@snap1
    zfs rollback bpool/example@snap1

    Could I just run those commands in a terminal in a graphic session or would I need to go to single-user mode or something? After that, what, reboot and everything is as it was when snapshot was taken?

  9. #9
    Join Date
    Mar 2010
    Location
    USA
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: Ubuntu 24.04 and zfs snapshots

    Well heck. It depends if it boots or not. LOL

    Yes, except first do this to find the most recent snapshots in those pool datasets
    Code:
    UID=$(sudo zfs list | awk -F '[/, ]' ' /rpool\/ROOT\/ubuntu_/ {print $3;exit}')
    sudo zfs list -t snapshot -o name -s creation -r bpool/BOOT/$UID | tail -1
    sudo zfs list -t snapshot -o name -s creation -r rpool/ROOT/$UID | tail -1
    Then roll back those datasets.

    ZFS snapshot are are of datasets, not of a pool. You tell it to make a snapshot (either differential, recursive or clone) of a dataset.

    If it doesn't boot, then you boot from an installer LiveUSB > Use "Try" > Open a terminal session > mount the ZFS pools and datasets to the Live Image Evironment > chroot into the installed system > Then do the above to rollback to the most current snapshots...

    "Concurrent coexistence of Windows, Linux and UNIX..." || Ubuntu user # 33563, Linux user # 533637
    Sticky: Graphics Resolution | UbuntuForums 'system-info' Script | Posting Guidelines | Code Tags

  10. #10
    #&thj^% is offline I Ubuntu, Therefore, I Am
    Join Date
    Aug 2016
    Beans
    Hidden!

    Re: Ubuntu 24.04 and zfs snapshots

    This bit is for zc-commander.
    Don't let this confuse you, this is off an Arch Based system, but it works the same on Ubuntu/Flavors as well:
    Code:
    ┌─ Datasets ──────────────────────────────────────────┌─ Snapshots ─────────────────────────────────────────┐
    │zpcachyos                                            │zpcachyos@tuesday-16                                 │
    │zpcachyos/ROOT                                       │zpcachyos/ROOT@tuesday-16                            │
    │zpcachyos/ROOT/cos                                   │zpcachyos/ROOT/cos@tuesday-16                        │
    │zpcachyos/ROOT/cos/home                              │zpcachyos/ROOT/cos/home@tuesday-16                   │
    │zpcachyos/ROOT/cos/root                              │zpcachyos/ROOT/cos/root@tuesday-16                   │
    │zpcachyos/ROOT/cos/varcache                          │zpcachyos/ROOT/cos/varcache@tuesday-16               │
    │zpcachyos/ROOT/cos/varlog                            │zpcachyos/ROOT/cos/varlog@tuesday-16                 │
    │                                                     │                                                     │
    │                                                     │                                                     │
    │                                                     │                                                     │
    │                                                     │                                                     │
    │                                                     │                                                     │
    │                                                     │                                                     │
    │                                                     │                                                     │
    │                                                     │                                                     │
    │                                                     │                                                     │
    │                                                     │                                                     │
    │                                                     │                                                     │
    │                                                     │                                                     │
    │                                                     │                                                     │
    │                                                     │                                                     │
    │                                                     │                                                     │
    │                                                     │                                                     │
    │                                                     │                                                     │
    │                                                     │                                                     │
    └─────────────────────────────────────────────────────└─────────────────────────────────────────────────────┘
     F1 Help  F2 Promote  F3 ____  F4 ____  F5 Snapshot  F6 Rename  F7 Create  F8 Destroy  F9 Get all  F10 Exit
    On the left is your or in this case my Pools.
    I use the arrow keys to navagate (up down && right left) Now at the bottom of the terminal youll see your options:
    Code:
    F1 Help  F2 Promote  F3 ____  F4 ____  F5 Snapshot  F6 Rename  F7 Create  F8 Destroy  F9 Get all  F10 Exit
    "F5" takes the snapshot, and you name or date it as you wish. That will now show in the right hand side. I'm trying to keep this very short, we could write page after page here, so some learning will be needed by you.

    I've grown to like this little utility, a lot of features like "send" which dose not show in my current code box.
    Now if you arrow righ to a snapshot the "F5" has a Cone option and The "F9" gives you a nice look at:
    Code:
    ┌─ ZFS Get All ──────────────────────────────────────────────────────────────────────────────────────┐  │
    │zpc│                                                                                                    │  │
    │zpc│  NAME                  PROPERTY              VALUE                  SOURCE                         │  │
    │zpc│  zpcachyos@tuesday-16  type                  snapshot               -                              │  │
    │zpc│  zpcachyos@tuesday-16  creation              Tue Apr 16 15:04 2024  -                              │  │
    │   │  zpcachyos@tuesday-16  used                  0B                     -                              │  │
    │   │  zpcachyos@tuesday-16  referenced            96K                    -                              │  │
    │   │  zpcachyos@tuesday-16  compressratio         1.00x                  -                              │  │
    │   │  zpcachyos@tuesday-16  devices               on                     default                        │  │
    │   │  zpcachyos@tuesday-16  exec                  on                     default                        │  │
    │   │  zpcachyos@tuesday-16  setuid                on                     default                        │  │
    │   │  zpcachyos@tuesday-16  createtxg             69105                  -                              │  │
    │   │  zpcachyos@tuesday-16  xattr                 sa                     inherited from zpcachyos       │  │
    │   │  zpcachyos@tuesday-16  version               5                      -                              │  │
    │   │  zpcachyos@tuesday-16  utf8only              on                     -                              │  │
    │   │  zpcachyos@tuesday-16  normalization         formD                  -                              │  │
    │   │  zpcachyos@tuesday-16  casesensitivity       sensitive              -                              │  │
    │   │  zpcachyos@tuesday-16  nbmand                off                    default                        │  │
    │   │  zpcachyos@tuesday-16  guid                  8613493534852254011    -                              │  │
    │   │                                -------------------------------------                               │  │
    │   │                                   ENTER Modify  F2 New  F10 close                                  │  │
    │   └────────────────────────────────────────────────────────────────────────────────────────────────────┘  │
    │                                                     │                                                     │
    └─────────────────────────────────────────────────────└─────────────────────────────────────────────────────┘
    Any who you kind of figure things out a bit more hopefully.

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •