Jump to content

Jaster

Members
  • Posts

    409
  • Joined

  • Last visited

Posts posted by Jaster

  1. Corruption can occur any time, so my questions is how to overcome it. Full backup of the drive, sure...

    However if this is the risky part about BTRFS, I'd like to cover this with a little bit less effort (hardware wise). So... would it be possible to create a backup or an "external" RAID just for the file system? E.g. Having the array with all HDDs protected by parity, while the file system resides on a RAID 5/10 Pool of SSDs. Or just have a job that back ups the file system on an hourly/daily basis?

  2. So the increased risk is losing the filesystem on a disk, but this can be recovered by the usual parity rebuild?

    If I want to backup something from another pool, I need to create an entry point based on a disk instead of a share, right? Anything else I do not see?

     

    Is there something like a "save procedure" to migrate from xfs to btrfs?

  3. I saw it is possible to run the Array with BTRFS drives. As I'm using more BTRFS features (snapshots for backups, etc) I'd like to know if it is a viable option and if there is any risk involved migrating from XFS?

     

    Right now I'm running an array with two paraties (XFS), a nvme raid 0 (BTRFS), another SSD raid 10 (BTRFS) and a backup raid 10 (BTRFS) with HDDs. My Idea would be to integrate the backup raid into the array and perform backups to the array rather then to a separate instance. Further I could stripe the SSDs to get more space there and have also backups inside the array.

     

    Good Idea? Bad Idea?

  4. I am going to run the images on a non assigned nvme. Should I create a subvol there or can I use "the whole thing"?

    As for now I am at about 1TB+ of VM's.

    I think I'll check the performance with a spinner and decide if I want to kill the SSDs or if I can live with a spinner - which I would only update every 2 weeks or so.

  5. I'm about to perform the migration. Should I still use the domains share or should I use custom share for the used images?

    How would/should I set it up?

     

    What I gonna do: use a nvme for the images itself. Have a raid 10 SSD BTRFS cache where I keep the backups, but don't transfer those to the parity array (via mover or what so ever).

    Create a script that creates a new "root backup" every Sunday and creates increments from those on a daily basis. After I got 5 weeks full, I'll delete the latest... I'm wondering if I need to set this up file by file or if I can script it somehow on a folder/share basis...?

  6. On 10/3/2020 at 12:06 PM, bastl said:

    @Jaster Sry, I linked you the wrong thread. Here is the one I use for my snapshots. Method 2 is what I use.

    The initial Snapshot I do by hand every 2-3 months. For this snapshot I turn all my VMs down to have them in a safe shutdown state.

    1. create a read only snapshot of my VMs share. This share isn't the default "domains" share which is created by unraid. It is already a BTRFS subvol on my cache, created like described in the thread from JorgeB and hosts all my VMs.

    
    # create readonly snapshot
    btrfs subvolume snapshot -r /mnt/cache/VMs /mnt/cache/VMs_backup
    
    sync

     

    2. send/receive initial snapshot copy to the target drive mounted at "VMs_backup_hdd". This process will take some time transfering all my vdisks.

    
    btrfs send /mnt/cache/VMs_backup | btrfs receive /mnt/disks/VMs_backup_hdd
    
    sync

    3. After that I have 2 scripts running. First script runs every sunday, checking if VMs are running and if so, shutting them down and doing a snapshot. named as "VMs_backup_offline_" with the current date at the end.

    
    #!/bin/bash
    #backgroundOnly=false
    #arrayStarted=true
    cd /mnt/cache/VMs_backup
    sd=$(echo VMs_backup_off* | awk '{print $1}')
    ps=$(echo VMs_backup_off* | awk '{print $2}')
    
    if [ "$ps" == "VMs_backup_offline_$(date '+%Y%m%d')" ]
    then
        echo "There's already a snapshot from today"
    else
    	for i in `virsh list | grep running | awk '{print $2}'`; do virsh shutdown $i; done
    	
    		# Wait until all domains are shut down or timeout has reached.
    		END_TIME=$(date -d "300 seconds" +%s)
    
    		while [ $(date +%s) -lt $END_TIME ]; do
    			# Break while loop when no domains are left.
    			test -z "`virsh list | grep running | awk '{print $2}'`" && break
    			# Wait a little, we don't want to DoS libvirt.
    			sleep 1
    		done
    	echo "shutdown completed"
    	virsh list | grep running | awk '{print $2}'
        btrfs sub snap -r /mnt/cache/VMs /mnt/cache/VMs_backup_offline_$(date '+%Y%m%d')
    	for i in `virsh list --all --autostart|awk '{print $2}'|grep -v Name`; do virsh start $i; done
    	sync
        btrfs send -p /mnt/cache/VMs_backup/$ps /mnt/cache/VMs_backup_offline_$(date '+%Y%m%d') | btrfs receive /mnt/disks/VMs_backup_hdd
            if [[ $? -eq 0 ]]; then
            /usr/local/emhttp/webGui/scripts/notify -i normal -s "BTRFS Send/Receive beendet" -d "Script ausgeführt" -m "$(date '+%Y-%m-%d %H:%M') Information: BTRFS VM Offline Snapshot auf HDD erfolgreich abgeschlossen"
            btrfs sub del /mnt/cache/$sd
            #btrfs sub del /mnt/disks/VMs_backup_HDD/VMs_backup/$sd
            else
            /usr/local/emhttp/webGui/scripts/notify -i warning -s "BTRFS Send/Receive gescheitert" -d "Script abgebrochen" -m "$(date '+%Y-%m-%d %H:%M') Information: Es wurde heute bereits ein Offline Snapshot erstellt"
            fi
    fi

    4. The second script runs daily and snapshots the VM as "VMs_backup_online_" with date no matter if they are running or not. Keep in mind if you have to restore snapshots of VMs which where running at the time the snapshot was taken, they will be in a "crashed" state. Not had any issues with that so far, but there might be situations with databases running in a VM which might break by this. Therefore I have set the weekly snapshots with all my VMs turned of. Just in case.

    
    #!/bin/bash
    #description=
    #arrayStarted=true
    #backgroundOnly=false
    cd /mnt/cache/VMs_backup
    sd=$(echo VMs_backup_onl* | awk '{print $1}')
    ps=$(echo VMs_backup_onl* | awk '{print $2}')
    
    if [ "$ps" == "VMs_backup_online_$(date '+%Y%m%d')" ]
    then
        echo "There's already a snapshot from today"
    else
        btrfs sub snap -r /mnt/cache/VMs /mnt/cache/VMs_backup_online_$(date '+%Y%m%d')
        sync
        btrfs send -p /mnt/cache/VMs_backup/$ps /mnt/cache/VMs_backup_online_$(date '+%Y%m%d') | btrfs receive /mnt/disks/VMs_backup_hdd
            if [[ $? -eq 0 ]]; then
            /usr/local/emhttp/webGui/scripts/notify -i normal -s "BTRFS Send/Receive beendet" -d "Script ausgeführt" -m "$(date '+%Y-%m-%d %H:%M') Information: BTRFS VM Online Snapshot auf HDD erfolgreich abgeschlossen"
            btrfs sub del /mnt/cache/$sd
            #btrfs sub del /mnt/disks/backup/$sd
            else
            /usr/local/emhttp/webGui/scripts/notify -i warning -s "BTRFS Send/Receive gescheitert" -d "Script abgebrochen" -m "$(date '+%Y-%m-%d %H:%M') Information: Es wurde heute bereits ein Online Snapshot erstellt"
            fi
    fi

     

    I don't have it automated in the way that old snapshots getting deleted automatically. I monitor the target drive and if it's getting full i delete some old snapshots. First command lists all the snapshots and the second deletes a specific one. Don't delete the initial read only snapshot if you have differential snaps building up on that.

    
    btrfs sub list /mnt/disks/VMs_backup_hdd
    
    btrfs sub del /mnt/disks/VMs_backup_hdd/VMs_Offline_20181125

    If you have to restore a vdisk, simply go into the specific folder and copy the vdisk of the specific VM back to it's original share on the cache. The XML and NVRAM files for the VMs aren't backed up by this. Only the vdisks. To backup these files you can use the app "Backup/Restore Appdata" to backup the libvirt.img for example.

     

    EDIT:

    Forget to mention, I use a single 1TB NVME cache device formatted with BTRFS and a single old spinning rust 1,5TB hdd as unassigned device as target for the snapshots. Nothing special, no BTRFS raid involved.

    Thats very detailed, thanks!

     

    I'm planing a single nvme drive for the VMs and using the cache (btrfs raid) as the backup location.

     

    If I'd like to copy a specific snapshot, could I just "copy" (e.g. cp or krusader) or do I need to do some kind of restore?

     

    Are the deltas created from the initial snapshot or from the previous?

     

  7. I've been struggling with btrfs quite a lot and went away from it in favor of xfs without a raid.

    I'd like to give it another try, but doing it the "right way". I can use 3 or 4 2TB SSDs, but those ain't the same model.

    I want a setup where a disk can die/fail and I am still able to restore the data or even run in a degraded mode until I have a replacement... Is this achievable and if so; how?

     

     

  8. I have very bad experience with btrfs and would like to avoid it - but might be an option as I would not create a raid with it.

     

    Do you happen to have some scripts to tinker around with? :)

  9. Hi Guys,

    I'm using the usual script to backup several VM's every day. I have about 700GB of images and the backup takes very long. Sure, it's writing images to a hdd which doesn't go beyond 150mb/s.

    I'm wondering what strategies/solutions you use to improve that process? What I have in mind right now is backing up to cache and having the mover transfer the files "later" to the hdd's, but I'm hoping for better ideas.

  10. Hi guys,

     

    I'm experiencing some weird behaviour. The second day in a row my server has become unresponsive over night. It drops from the network. I can access the local console, but nothing will be executed -> I can log in, but neither diagnostics, nor shutdown or reboot will do anything.

    I attached the syslog and I'll add a diagnostics if required, but it's gonna be after the reboot.

    Is there something visable in the log or is there something I can do to get more details on these "crashes"?

    syslog

×
×
  • Create New...