[GUIDE] Windows Previous Versions and Samba (Btrfs - Atomic COW - Volume Shadow Copy)

    • Offizieller Beitrag

    Windows Previous Versions and Samba (Btrfs - Atomic COW - Volume Shadow Copy)


    This guide provides a setup to make available in Samba shares windows previous versions so you can restore files using the properties dialog. This is possible using the snapshot btrfs capability. Since btrfs has COW feature, this will use little space overhead on the file system.


    What you need?

    • A BTRFS formatted drive (With zfs this is also possible)
    • OMV with kernel version 3.16.7 (Backports kernel, BTRFS has to be used in an updated kernel)
    • Btrfs-tools, this is the user space tools provided to do file system operations; you also need the latest version. You can build your own 3.17 from the Jessie sources. It has minimal dependencies so it should have no problem.
    • Any modern version of Windows (starting from 7)
    • Omv-extras
    • SSH access


    Just recently basic support for btrfs was introduced for OMV. The support allows now to mount BTRFS volumes, and with that create shares and spread them in OMV services.


    Start


    Let’s access with ssh to our newly mounted btrfs volume, there will create a sub volume name @Documents, the “@” is not compulsory, but is used as convention in the btrfs village for identifying sub volumes


    btrfs subvolume create @Documents


    A stat commands accuses the @Documents sub volume does not have standard OMV permissions. this will produce conflicts in samba share and trying to add content remotely


    01.png


    We go to shared folders in OMV create a share with @Documents subvolume (looks like a folder) and use the omv-extras utility to reset to default permissions. (admin RW, users RW, other RO)


    02.png


    03.png



    Snapshot setup


    Now let’s create another sub volume inside @Documents, this will prevent deletion since is a “sub file system”


    btrfs subvolume create @Documents/.snapshots



    Cron Setup

    Now we will add the repetitive task (daily, weekly monthly you choose) of creating read only snapshots of @Documents, in scheduled task with the following command:


    btrfs subvolume snapshot –r /media/uuid/@Documents /media/uuid/@Documents/.snapshots/@GMT_`date +%Y.%m.%d-%H.%M.%S` ##Replace uuid for yours


    NOTE:
    If you have trouble with windows recognizing the previous versions try and change to UTC


    btrfs subvolume snapshot –r /media/uuid/@Documents /media/uuid/@Documents/.snapshots/@GMT_`date -u +%Y.%m.%d-%H.%M.%S`


    Screen Shot 2015-06-24 at 12.01.15 PM.png


    The snapshots then will get created at the “.snapshots” folder. This will be hidden from windows view (unless you activate view hidden folders)



    Samba Setup
    Now let’s share this volume with samba, also we will add the following extra options at the end of the share


    Code
    vfs objects = shadow_copy2
    shadow:format = @GMT_%Y.%m.%d-%H.%M.%S
    shadow:sort = desc
    shadow:snapdir = .snapshots


    05.png


    Windows side

    You can start filling your share with content, once the days pass by and the snapshots get created and you edit documents or add content you should see this in your properties dialog in windows


    06.png


    You can also have previous versions of the top level of the share


    07.png


    Questions / Problems / Discussions
    Windows Previous Versions and Samba

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!