Forum
  • Search
  • Member List
  • Calendar
Hello There, Guest! Login Register — Login with Facebook

NFS boot and backup script with LVM snapshot
Thank you for your donation

Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Threaded Mode | Linear Mode
NFS boot and backup script with LVM snapshot
13th Feb, 2014, 02:14 AM
Post: #1
Fabio72 Offline
Registered
Posts: 96
Joined: Feb 2014
Reputation: 5
NFS boot and backup script with LVM snapshot
After testing and destroying my configuration a couple of time I get tired to backup and restore the SD using dd
So I moved Xbian in an NFS share on my media server following these instruction:
http://forum.xbian.org/thread-1531-post-17118.html#pid17118

I created a dedicated ext4 2G volume optimized for speed, following this:
http://erikugel.wordpress.com/2011/04/14/the-quest-for-the-fastest-linux-filesystem/

The volume is mounted as:
Code:
/dev/VG1/Xbian                                         /srv/Xbian           ext4       noatime,nodiratime,data=writeback,stripe=16,barrier=0,errors=remount-ro,nobh      1   1

and exported as:
Code:
/srv/Xbian               192.168.1.208(rw,sync,nohide,no_root_squash,no_subtree_check)

The I made a script to make a daily full backup, using LVM snapshot to keep a consistent copy.
I keep only the last 7 backup

Code:
#!/bin/bash
# simple 7 day backup

/sbin/lvcreate --size 1G --snapshot --name XbianSnap /dev/VG1/Xbian
/usr/bin/mount /dev/VG1/XbianSnap /mnt -o ro

data=`/usr/bin/date +"%d-%m-%Y"`
/bin/tar zcf /srv/backup_Xbian/Xbian_$data.tgz /mnt
/usr/bin/find /srv/backup_Xbian -type f -name Xbian* -mtime +7 -exec rm -f {} \;

/usr/bin/umount /mnt
/sbin/lvremove -f /dev/VG1/Xbian

If you don't have an LVM setup you can use the script removing the lvm and mount parts.

Now I'm planning to add a scheduled script in Xbian to backup the boot partition on the nfs volume:
Code:
mount /boot -o remount,ro
dd if=/dev/mmcblk0p1 of=/root/boot.img
mount /boot -o remount,rw
Find all posts by this user
Quote this message in a reply
« Next Oldest | Next Newest »
Post Reply 


Possibly Related Threads...
Thread: Author Replies Views: Last Post
  Pre-upgrade, Online, Full System Backup Script alangibson 1 7,733 5th Aug, 2014 01:10 AM
Last Post: IriDium

  • View a Printable Version
  • Send this Thread to a Friend
  • Subscribe to this thread
Forum Jump:

Current time: 11th May, 2025, 11:02 AM Powered By MyBB, © 2002-2025 MyBB Group.