Categories
Storage Windows

Backup of CIFS/Samba share

By mounting a smb share on your linux machine you can make an rsnapshot of the entire share without installing cwrsync. example below

  1. Download ds_smbmount
  2. Create a script that mounts all samba shares you want to snapshot.  the script should exit with an exitcode > 0 if mounting fails.  Script is later refered to as /root/smb/radion-mount
    #!/bin/bash
    
    /root/bin/ds_smbmount -d "/mnt/share/radion/k2/foreningar" -s "//192.168.60.202/föreningar" -u backup -p mypassword -U 0 -G 1003
    if [ $? -ne "0" ]; then
     echo "Failed to mount /mnt/share/radion/k2/foreningar"
     exit 1;
    fi;
  3. Create a script that umount all samba shares after your rsnapshot is finished. script is later refered to as /root/smb/radion-umount
    #!/bin/bash
    
    umount /mnt/share/radion/k2/foreningar
  4. Configure rsnapshot to run an script before and after snapshot.
    #################################################
    # rsnapshot.conf - rsnapshot configuration file #
    #################################################
    
    #######################
    # CONFIG FILE VERSION #
    #######################
    
    config_version 1.2
    
    ###########################
    # SNAPSHOT ROOT DIRECTORY #
    ###########################
    
    # All snapshots will be stored under this root directory.
    snapshot_root /zfs-pool-2/backup/radion
    no_create_root 0
    
    #################################
    # EXTERNAL PROGRAM DEPENDENCIES #
    #################################
    
    cmd_cp /bin/cp
    cmd_rm /bin/rm
    cmd_rsync /usr/bin/rsync
    cmd_ssh /usr/bin/ssh
    cmd_logger /usr/bin/logger
    
    cmd_preexec /root/smb/radion-mount
    cmd_postexec /root/smb/radion-umount
    
    #########################################
    # BACKUP INTERVALS #
    #########################################
    
    retain daily 30
    
    ############################################
    # GLOBAL OPTIONS #
    ############################################
    
    verbose 2
    loglevel 3
    logfile /var/log/rsnapshot-radion.log
    lockfile /var/run/rsnapshot-radion.pid
    
    # Bandwith limited to 30000KB/s =~ 240Mb/s
    # default --relative removed to keep simple folder structure.
    rsync_long_args --bwlimit=30000 --delete --numeric-ids --delete-excluded
    
    
    ###############################
    ### BACKUP POINTS / SCRIPTS ###
    ###############################
    
    backup /mnt/share/radion/k2/foreningar     k2/foreningar

 

Categories
Windows

CIFS/Smbclient speed

By default the linux smbclient mounts smb shares using smb protocol version 1.0 (now deprecated). resulting in slow transfer speed against Windows 10 shares. by adding vers=3.0 to you mount options you are using smb protocol version 3.0 with greater speed.

mount -t cifs //192.168.60.202/föreningar "/mnt/share/radion/k2/foreningar" --verbose -o username=backup,password=mypassword,vers=3.0

More info in this stackexchange thread about cifs randomly losing connection to windows share

Categories
Windows

Set ip-number from commandline

Set Static IP-number

netsh interface ipv4 set address "Extern" static x.x.x.x y.y.y.y z.z.z.z
netsh interface ipv4 add dnsserver name="Extern" address=208.67.220.220 index=1
netsh interface ipv4 add dnsserver name="Extern" address=208.67.222.222 index=2

Extern is the name of your network device
x.x.x.x is your ip-number
y.y.y.y is your netmask.
z.z.z.z is your default gateway.

Enable DHCP

netsh interface ipv4 set address "Extern" source=dhcp
netsh interface ipv4 set dnsserver "Extern" source=dhcp

 

 

Categories
Network

Encrypt private key OpenVPN

You can password protect your key file so that ed an extra password is needed to connect with openvpn. It will also work with embedded certificates in .ovpn

OpenVPN asking for a password
Categories
Windows

Windows 10 and ViewCast Osprey 700e

This video card is not produced anymore and the last driver (Version 2.1.0.92) is from 2013. This card works fine with Windows 10 if you disable fast startup mode.

Categories
Linux Virtualization Windows

KVM With usb/pci passthrough

Creating a Virtual Machine for Windows 10

[code language=”bash”]
virt-install \
–name=Windows10-VM1 \
–ram=4096 \
–cpu=host \
–vcpus=2 \
–os-type=windows \
–os-variant=win7 \
–disk /srv/dev-disk-by-label-SSD/kvm/Windows10-VM1,size=200,sparse=true,bus=virtio \
–disk /zfs-pool-1/kvm/iso/Windows10.iso,device=cdrom,bus=ide \
–disk /zfs-pool-1/kvm/iso/virtio-win.iso,device=cdrom,bus=ide \
–network bridge=br0 \
–graphics vnc,listen=0.0.0.0
[/code]