Skip to contentSkip to conversation

Backup Command

DISCUSSION [email protected] 4 participants 5 messages Jan 21, 2011 Btrfs file system

lore
Share & tools
lore
#0 lore raw

Well thanks to some help from you guys I seem to have my backup server almost fully running and functional with rsync. Amazing functions, this snapshotting and rsync.

I still don't know why I cannot remove snapshots though. (Debian Testing with 2.6.32-28)

And I don't know how to reach out from the backup server to the HTPC and stop MythTV there, so I can export the Mysql database safely, from a cron job on the backup server. Suggestions?

#1 lore raw
Quoted 4 lines · On 01/21/2011 08:07 PM, [email protected] wrote:

Well thanks to some help from you guys I seem to have my backup server almost fully running and functional with rsync. Amazing functions, this snapshotting and rsync.

I still don't know why I cannot remove snapshots though. (Debian Testing with 2.6.32-28)

I am not sure if the kernel 2.32 supports snapshot removal...

Quoted 9 lines

And I don't know how to reach out from the backup server to the HTPC and stop MythTV there, so I can export the Mysql database safely, from a cron job on the backup server. Suggestions?

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
.

#2 lore raw
In reply to [email protected]

Kernel 2.6.32.x is to old for snapshot deletion, you will have to use something more recent

Quoted 10 lines · On Fri, 2011-01-21 at 11:07 -0800, [email protected] wrote:

Well thanks to some help from you guys I seem to have my backup server almost fully running and functional with rsync. Amazing functions, this snapshotting and rsync.

I still don't know why I cannot remove snapshots though. (Debian Testing with 2.6.32-28)

And I don't know how to reach out from the backup server to the HTPC and stop MythTV there, so I can export the Mysql database safely, from a cron job on the backup server. Suggestions?

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
In reply to [email protected]
Quoted 2 lines · On Fri, Jan 21, 2011 at 11:07 AM, <[email protected]> wrote:

Well thanks to some help from you guys I seem to have my backup serve=

r almost fully running and functional with rsync. =C2=A0Amazing functio= ns, this snapshotting and rsync.

Quoted 2 lines

I still don't know why I cannot remove snapshots though. (Debian Test=

ing with 2.6.32-28)

Quoted 2 lines

And I don't know how to reach out from the backup server to the HTPC =

and stop MythTV there, so I can export the Mysql database safely, from = a cron job on the backup server. =C2=A0Suggestions?

Simplified, but workable:

#!/bin/sh

ssh [email protected] "/path/to/some/script stop"

/path/to/your/rsync/script

ssh [email protected] "/path/to/some/script start"

The above script would be your backup wrapper script, that gets called = by cron.

On the HTPC, "/path/to/some/script" would be a script that takes 2 arguments (stop|start).

The stop argument would stop mythtv using the init script for it. Then would do whatever you need to do to the database (stop it, dump it, whatever).

The start argument would do the reverse, starting the database and Myth= TV.

And, "/path/to/your/rsync/script" would call your actual backups script that runs rsync.

--=20
=46reddie Cash
[email protected]
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" = in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw
Quoted 7 lines · On Fri 21 January 2011 11:44:24 Freddie Cash wrote:

#!/bin/sh
=20
ssh [email protected] "/path/to/some/script stop" =20
/path/to/your/rsync/script
=20
ssh [email protected] "/path/to/some/script start"

Ho-lee crap, this is fantastic. Everything seems to work. I find thou= gh that if I stop myth -and- mysql, I cannot export the database, so I = only stop Myth. It's the only thing using the database anyway, in my c= ase.

Well it's been 12 hours and I'm still doing my first HTPC data transfer= , so not all commands are tested (untested=3D=3D#), but I am confident = they will work. I'm donating my (weekly) cron script here in case it h= elps someone. (below)

I have four systems:
hex - work laptop
droog - HTPC with a 4TB btrfs raid0 array on /home and 500GB raptor on = /
slepnir - backup server in a cube case out in the garage (in case of th= eft or fire) with a SuperMicro 5 disk hot-swap cage, 6TB so far. (WD Gr= een 2TB now $80 with rebate!)
phone - Android Nexus One with 16GB SD

The backup server has SSH credentials on the other systems, but only th= e work laptop can ssh to it (limited by Shorewall). The backup server = will also handle security cameras and will presumably dnat a port to th= e HTPC, which will serve it to the WAN on SSH (reverse tunnel) so I can=
get motion notifications and video on my phone. (ZoneMinder) The HTPC= is the only system allowed to present anything to the WAN as it has no=
thing sensitive, and -that- will be on a subnet. Maybe I can limit it = to my phone's IP.

I do have a (disused) WindowsXP partition, but unsure how to back that = up. Maybe ssh with a dd command.

Thanks for the help all.

backups
-----------------------------------------------------------------------=
----------------------------------------------------------
#!/bin/sh
#

# cron.weekly/backups -- schedules periodic backups of darkmatter syste=
ms
#
# Copyleft =C2=A9 Carl Cook
#
#--archive is  equivalent  to  'recursive links perms times group owner=
 DevicesSpecials'

/bin/mount /media/backups

#------------------------------------------------------
# Hex

#/sbin/btrfs subvolume snapshot /media/backups/hex-home/ /media/backups= /hex-home-snap-$(date +"%Y-%m-%d")
/usr/bin/rsync --archive --checksum --compress --hard-links --delete-du= ring --delete-excluded --inplace --numeric-ids --log-file=3D/media/back= ups/hex-home-$(date +"%Y-%m-%d").log -e ssh root@hex:///home/ /media/ba= ckups/hex-home/

#/sbin/btrfs subvolume snapshot /media/backups/hex-root/ /media/backups= /hex-root-snap-$(date +"%Y-%m-%d")
#/usr/bin/rsync --archive --checksum --compress --hard-links --delete-d= uring --delete-excluded --inplace --numeric-ids --exclude-from=3D/media= /backups/exclude-root --log-file=3D/media/backups/hex-root-$(date +"%Y-= %m-%d").log -e ssh root@hex:/// /media/backups/hex-root/

#------------------------------------------------------
# Droog

#/sbin/btrfs subvolume snapshot /media/backups/droog-home/ /media/backu= ps/droog-home-snap-$(date +"%Y-%m-%d")
/usr/bin/rsync --archive --checksum --compress --hard-links --delete-du= ring --delete-excluded --inplace --numeric-ids --log-file=3D/media/back= ups/droog-home-$(date +"%Y-%m-%d").log -e ssh root@droog:///home/ /medi= a/backups/droog-home/

/usr/bin/ssh root@droog "/etc/init.d/mythtv-backend stop" /usr/bin/ssh root@droog "/usr/bin/mysqldump -u mythtv -pmythtv mythconv= erg -c > /home/bill/.mythtv/mysql_backup-$(date +"%Y-%m-%d").sql" /usr/bin/ssh root@droog "/etc/init.d/mythtv-backend start" /sbin/btrfs subvolume snapshot /media/backups/droog-root/ /media/backup= s/droog-root-snap-$(date +"%Y-%m-%d")
/usr/bin/rsync --archive --checksum --compress --hard-links --delete-du= ring --delete-excluded --inplace --numeric-ids --exclude-from=3D/media/= backups/exclude-root --log-file=3D/media/backups/droog-root-$(date +"%Y= -%m-%d").log -e ssh root@droog:/// /media/backups/droog-root/

#------------------------------------------------------
# Phone

#/sbin/btrfs subvolume snapshot /media/backups/phone-sd/ /media/backups= /phone-sd-snap-$(date +"%Y-%m-%d")
#/usr/bin/rsync --archive --checksum --compress --hard-links --delete-d= uring --delete-excluded --inplace --numeric-ids --log-file=3D/media/bac= kups/phone-sd-$(date +"%Y-%m-%d").log -e ssh root@hex:///media/disk-1/ = /media/backups/phone-sd/

#------------------------------------------------------

/bin/umount /media/backups

-----------------------------------------------------------------------=
----------------------------------------------------------
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" = in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html