<?xml version="1.0"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>Transition Technology: Ticket #763: Server Backups</title>
    <link>http://localhost:8080/trac/ticket/763</link>
    <description>&lt;p&gt;
Two weeks ago &lt;a class="closed ticket" href="http://localhost:8080/trac/ticket/754#comment:21" title="maintenance: Can we upgrade from PHP 5.3? (closed: wontfix)"&gt;annesley asked&lt;/a&gt;:
&lt;/p&gt;
&lt;blockquote class="citation"&gt;
&lt;p&gt;
what off-site data storage, file backup and quick setup do we have?
&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;
I &lt;a class="closed ticket" href="http://localhost:8080/trac/ticket/754#comment:22" title="maintenance: Can we upgrade from PHP 5.3? (closed: wontfix)"&gt;answered&lt;/a&gt;:
&lt;/p&gt;
&lt;blockquote class="citation"&gt;
&lt;p&gt;
The 3 virtual servers have their file system mounted off a BSD/NFS/ZFS file server and the whole file system is backed up and stored onto another BSD/ZFS server in the same data centre. We did have backups also being copied to a server in Manchester but this is currently off-line as the Manchester server needs a disk swapping and rebuilding as a BSD/ZFS server.
&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;
A problem with this is that it's only me and Alan that have access to these backups, so I'd like to suggest I set up a new account for backups on our backup server and sort out cron jobs to rsync data to this account and document how people can access these backups.
&lt;/p&gt;
&lt;p&gt;
The result would be that everybody would have SFTP access to 60 days worth of snapshots of backups from all three servers whenever needed without any need for my or Alan's intervention.
&lt;/p&gt;
&lt;p&gt;
I expect this would take abount an hour to set up and another hour to document and help people understand it.
&lt;/p&gt;
&lt;p&gt;
There would be no additional cost to the TN because backup space is already paid for.
&lt;/p&gt;
</description>
    <language>en-us</language>
    <image>
      <title>Transition Technology</title>
      <url>/trac/chrome/site/TransitionNetwork-Logo-Web-Small.jpg</url>
      <link>http://localhost:8080/trac/ticket/763</link>
    </image>
    <generator>Trac 0.12.5</generator>
    <item>
      
        <dc:creator>ed</dc:creator>

      <pubDate>Tue, 22 Jul 2014 09:04:35 GMT</pubDate>
      <title></title>
      <link>http://localhost:8080/trac/ticket/763#comment:1</link>
      <guid isPermaLink="false">http://localhost:8080/trac/ticket/763#comment:1</guid>
      <description>
        &lt;ol&gt;&lt;li&gt;I am happy that you set this up to enable others access to backups without extra charge
&lt;/li&gt;&lt;li&gt;I am concerned that the off-site backups aren't working; isn't it best to have off-site (rather than same-site) backups?
&lt;/li&gt;&lt;li&gt;
&lt;/li&gt;&lt;/ol&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>chris</dc:creator>

      <pubDate>Tue, 22 Jul 2014 09:47:44 GMT</pubDate>
      <title></title>
      <link>http://localhost:8080/trac/ticket/763#comment:2</link>
      <guid isPermaLink="false">http://localhost:8080/trac/ticket/763#comment:2</guid>
      <description>
        &lt;p&gt;
Replying to &lt;a href="http://localhost:8080/trac/ticket/763#comment:1" title="Comment 1 for Ticket #763"&gt;ed&lt;/a&gt;:
&lt;/p&gt;
&lt;blockquote class="citation"&gt;
&lt;ol&gt;&lt;li&gt;I am happy that you set this up to enable others access to backups without extra charge
&lt;/li&gt;&lt;/ol&gt;&lt;/blockquote&gt;
&lt;p&gt;
Great, I'll try to get this sorted today or tomorrow.
&lt;/p&gt;
&lt;blockquote class="citation"&gt;
&lt;ol start="2"&gt;&lt;li&gt;I am concerned that the off-site backups aren't working; isn't it best to have off-site (rather than same-site) backups?
&lt;/li&gt;&lt;/ol&gt;&lt;/blockquote&gt;
&lt;p&gt;
Yes, we should have both, the disk in the Manchester server has now been replaced and next we are going to rebuild it as a BSD/ZFS backup server and then start syncing data to it again.
&lt;/p&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>chris</dc:creator>

      <pubDate>Wed, 23 Jul 2014 14:50:08 GMT</pubDate>
      <title>hours, totalhours changed</title>
      <link>http://localhost:8080/trac/ticket/763#comment:3</link>
      <guid isPermaLink="false">http://localhost:8080/trac/ticket/763#comment:3</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;hours&lt;/strong&gt;
                changed from &lt;em&gt;0.0&lt;/em&gt; to &lt;em&gt;1.75&lt;/em&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;totalhours&lt;/strong&gt;
                changed from &lt;em&gt;0.0&lt;/em&gt; to &lt;em&gt;1.75&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
        &lt;p&gt;
Creating 3 accounts for backups, one per server, on &lt;tt&gt;store1.webarch.net&lt;/tt&gt;:
&lt;/p&gt;
&lt;pre class="wiki"&gt;sudo -i
bash
export USERNAME="tn-parrot"
zfs create tank/backupclients/$USERNAME
zfs set quota=100G tank/backupclients/$USERNAME
pw addgroup $USERNAME
pw useradd -n $USERNAME -s /usr/local/bin/rbash -d /tank/backupclients/$USERNAME -g $USERNAME
chmod 750 /tank/backupclients/$USERNAME
chown $USERNAME:$USERNAME /tank/backupclients/$USERNAME
vim /root/clients/backupstore/backupclients.yaml
#   - client: transitionnetwork.org
#     uid: tn-parrot
#     storage_path: tank/backupclients/tn-parrot
#     email: webproject@transitionnetwork.org
#     quota: 100G
vim /usr/local/etc/zfs-snapshot-mgmt.conf
#   tank/backupclients/tn-parrot:
#     recursive: false
#     # Create snapshots every 24 hours, starting at 06:00 UTC
#     creation_rule:
#       at_multiple: 1440
#       offset: 360
#     # Keep snapshots for 60 days
#     preservation_rules:
#       - { for_minutes: 86400, at_multiple: 1440, offset:  360 }
mkdir /tank/backupclients/$USERNAME/.ssh
chmod 700 /tank/backupclients/$USERNAME/.ssh
touch /tank/backupclients/$USERNAME/.ssh/authorized_keys
chmod 600 /tank/backupclients/$USERNAME/.ssh/authorized_keys
chown -R $USERNAME:$USERNAME /tank/backupclients/$USERNAME/.ssh
vim /tank/backupclients/$USERNAME/.ssh/authorized_keys
&lt;/pre&gt;&lt;p&gt;
I added everybodies ssh public keys and the servers root ssh public keys and then repeated the above for:
&lt;/p&gt;
&lt;pre class="wiki"&gt;export USERNAME="tn-penguin"
export USERNAME="tn-puffin"
&lt;/pre&gt;&lt;p&gt;
But gave the tn-puffin account a 300GB quota.
&lt;/p&gt;
&lt;p&gt;
On each server the &lt;tt&gt;/root/.ssh/config&lt;/tt&gt; files were edited and sshing to the backup server was tested:
&lt;/p&gt;
&lt;pre class="wiki"&gt;vim /root/.ssh/config
#Host *
#  CompressionLevel 9
#  CheckHostIP yes
#  StrictHostKeyChecking ask
#
#Host backup
#  Hostname store1.webarch.net
#  User tn-parrot
cat /root/.ssh/id_*.pub
ssh backup
&lt;/pre&gt;&lt;p&gt;
I have put a copy of the backup script on &lt;a class="wiki" href="http://localhost:8080/trac/wiki/AgileBackup"&gt;wiki:AgileBackup&lt;/a&gt; and it was deployed like this:
&lt;/p&gt;
&lt;pre class="wiki"&gt;wget https://svn.webarch.net/scripts/usr/local/bin/agile-backup -O /usr/local/bin/agile-backup --no-check-certificate
chmod 700 /usr/local/bin/agile-backup
mkdir /etc/agile/
chmod 700 /etc/agile/
vim /etc/agile/backup
chmod 600 /etc/agile/backup
&lt;/pre&gt;&lt;p&gt;
The things being backed up are listed in &lt;tt&gt;/etc/agile/backup&lt;/tt&gt; on each server, for &lt;a class="wiki" href="http://localhost:8080/trac/wiki/ParrotServer"&gt;wiki:ParrotServer&lt;/a&gt;:
&lt;/p&gt;
&lt;pre class="wiki"&gt;/root
/home
/etc
/usr/local
/var/backups/mysql/sqldump
/var/spool/cron/crontabs
&lt;/pre&gt;&lt;p&gt;
&lt;a class="wiki" href="http://localhost:8080/trac/wiki/PenguinServer"&gt;wiki:PenguinServer&lt;/a&gt;:
&lt;/p&gt;
&lt;pre class="wiki"&gt;/root
/home
/etc
/web
/var/backups/mysql/sqldump
/var/spool/cron/crontabs
&lt;/pre&gt;&lt;p&gt;
and &lt;a class="wiki" href="http://localhost:8080/trac/wiki/PuffinServer"&gt;wiki:PuffinServer&lt;/a&gt;:
&lt;/p&gt;
&lt;pre class="wiki"&gt;/root
/etc
/home
/data
/var/backups/mysql/sqldump
/var/spool/cron/crontabs
&lt;/pre&gt;&lt;p&gt;
procmail was installed on all 3 servers as it's used for the lockfile and the backups were run once manually to check everything is working.
&lt;/p&gt;
&lt;p&gt;
The backup tasks were have been setup to run each night via cron, on &lt;a class="wiki" href="http://localhost:8080/trac/wiki/PuffinServer"&gt;wiki:PuffinServer&lt;/a&gt; this has been done using my account as BOA clobbers the root crontab on upgrades.
&lt;/p&gt;
&lt;p&gt;
People should now be able to use SFTP to access the backups:
&lt;/p&gt;
&lt;pre class="wiki"&gt;sftp tn-puffin@store1.webarch.net
&lt;/pre&gt;&lt;p&gt;
The latest backups are in &lt;tt&gt;parrot.webarch.net&lt;/tt&gt; and 60 days worth of snapshots are in &lt;tt&gt;~/.zfs/&lt;/tt&gt;, you can mount these backups locally, for example on Debian:
&lt;/p&gt;
&lt;pre class="wiki"&gt;aptitude install sshfs
mkdir -p /media/tn-puffin
chmod 700 /media/tn-puffin/
mkdir /media/tn-puffin/latest
mkdir /media/tn-puffin/archive
echo "sshfs#tn-puffin@store1.webarch.net:puffin.webarch.net /media/tn-puffin/latest fuse ro,nobootwait 0 0" &amp;gt;&amp;gt; /etc/fstab
echo "sshfs#tn-puffin@store1.webarch.net::.zfs/snapshot /media/tn-puffin/archive fuse ro,nobootwait 0 0" &amp;gt;&amp;gt; /etc/fstab
mount -a
&lt;/pre&gt;&lt;p&gt;
I have documented the backups:
&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;a class="wiki" href="http://localhost:8080/trac/wiki/PenguinServer#Backups"&gt;PenguinServer#Backups&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;&lt;a class="wiki" href="http://localhost:8080/trac/wiki/PuffinServer#Backups"&gt;PuffinServer#Backups&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;&lt;a class="wiki" href="http://localhost:8080/trac/wiki/ParrotServer#Backups"&gt;ParrotServer#Backups&lt;/a&gt;
&lt;/li&gt;&lt;/ul&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>chris</dc:creator>

      <pubDate>Tue, 02 Sep 2014 10:43:25 GMT</pubDate>
      <title>hours, totalhours changed</title>
      <link>http://localhost:8080/trac/ticket/763#comment:4</link>
      <guid isPermaLink="false">http://localhost:8080/trac/ticket/763#comment:4</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;hours&lt;/strong&gt;
                changed from &lt;em&gt;0.0&lt;/em&gt; to &lt;em&gt;0.25&lt;/em&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;totalhours&lt;/strong&gt;
                changed from &lt;em&gt;1.75&lt;/em&gt; to &lt;em&gt;2.0&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
        &lt;p&gt;
It looks like the way the space was devided wasn't ideal, the &lt;a class="wiki" href="http://localhost:8080/trac/wiki/PenguinServer"&gt;PenguinServer&lt;/a&gt; space is 95% used up:
&lt;/p&gt;
&lt;pre class="wiki"&gt;NAME                                 USED  AVAIL  REFER  MOUNTPOINT
tank/backupclients/tn-parrot        40.3G  59.7G  10.2G  /tank/backupclients/tn-parrot
tank/backupclients/tn-penguin       99.6G   416M  10.2G  /tank/backupclients/tn-penguin
tank/backupclients/tn-puffin         111G   189G  23.1G  /tank/backupclients/tn-puffin
&lt;/pre&gt;&lt;p&gt;
So adding 100GB to the space for penguin and removing 100GB from puffin:
&lt;/p&gt;
&lt;pre class="wiki"&gt;zfs set quota=200G tank/backupclients/tn-penguin
zfs set quota=200G tank/backupclients/tn-puffin
&lt;/pre&gt;&lt;p&gt;
And &lt;tt&gt;/root/clients/backupstore/backupclients.yaml&lt;/tt&gt; was edited:
&lt;/p&gt;
&lt;pre class="wiki"&gt;   - client: transitionnetwork.org
     uid: tn-parrot
     storage_path: tank/backupclients/tn-parrot
     email: webproject@transitionnetwork.org
     quota: 100G
   - client: transitionnetwork.org
     uid: tn-penguin
     storage_path: tank/backupclients/tn-penguin
     email: webproject@transitionnetwork.org
     quota: 200G
   - client: transitionnetwork.org
     uid: tn-puffin
     storage_path: tank/backupclients/tn-puffin
     email: webproject@transitionnetwork.org
     quota: 200G
&lt;/pre&gt;&lt;p&gt;
And now we have:
&lt;/p&gt;
&lt;pre class="wiki"&gt;NAME                                 USED  AVAIL  REFER  MOUNTPOINT
tank/backupclients/tn-parrot        40.3G  59.7G  10.2G  /tank/backupclients/tn-parrot
tank/backupclients/tn-penguin       99.6G   100G  10.2G  /tank/backupclients/tn-penguin
tank/backupclients/tn-puffin         111G  89.4G  23.1G  /tank/backupclients/tn-puffin
&lt;/pre&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>chris</dc:creator>

      <pubDate>Thu, 11 Dec 2014 10:00:58 GMT</pubDate>
      <title>hours, totalhours changed</title>
      <link>http://localhost:8080/trac/ticket/763#comment:5</link>
      <guid isPermaLink="false">http://localhost:8080/trac/ticket/763#comment:5</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;hours&lt;/strong&gt;
                changed from &lt;em&gt;0.0&lt;/em&gt; to &lt;em&gt;0.25&lt;/em&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;totalhours&lt;/strong&gt;
                changed from &lt;em&gt;2.0&lt;/em&gt; to &lt;em&gt;2.25&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
        &lt;p&gt;
The &lt;a class="wiki" href="http://localhost:8080/trac/wiki/PenguinServer"&gt;PenguinServer&lt;/a&gt; backup space is getting low:
&lt;/p&gt;
&lt;pre class="wiki"&gt;zfs list | grep 'tn\|NAME'
NAME                                 USED  AVAIL  REFER  MOUNTPOINT
tank/backupclients/tn-parrot        56.8G  43.2G  10.6G  /tank/backupclients/tn-parrot
tank/backupclients/tn-penguin        196G  3.64G  10.9G  /tank/backupclients/tn-penguin
tank/backupclients/tn-puffin         131G  69.3G  25.1G  /tank/backupclients/tn-puffin
&lt;/pre&gt;&lt;p&gt;
This is what was set in &lt;tt&gt;/root/clients/backupstore/backupclients.yaml&lt;/tt&gt;:
&lt;/p&gt;
&lt;pre class="wiki"&gt;  - client: transitionnetwork.org
    uid: tn-parrot
    storage_path: tank/backupclients/tn-parrot
    email: webproject@transitionnetwork.org
    quota: 100G
  - client: transitionnetwork.org
    uid: tn-penguin
    storage_path: tank/backupclients/tn-penguin
    email: webproject@transitionnetwork.org
    quota: 200G
  - client: transitionnetwork.org
    uid: tn-puffin
    storage_path: tank/backupclients/tn-puffin
    email: webproject@transitionnetwork.org
    quota: 200G
&lt;/pre&gt;&lt;p&gt;
So adding more space for &lt;a class="wiki" href="http://localhost:8080/trac/wiki/PenguinServer"&gt;PenguinServer&lt;/a&gt; and reducing the others:
&lt;/p&gt;
&lt;pre class="wiki"&gt;zfs set quota=180G tank/backupclients/tn-puffin
zfs set quota=80G tank/backupclients/tn-parrot
zfs set quota=240G tank/backupclients/tn-penguin
&lt;/pre&gt;&lt;p&gt;
So we now have the following in &lt;tt&gt;/root/clients/backupstore/backupclients.yaml&lt;/tt&gt;:
&lt;/p&gt;
&lt;pre class="wiki"&gt;  - client: transitionnetwork.org
    uid: tn-parrot
    storage_path: tank/backupclients/tn-parrot
    email: webproject@transitionnetwork.org
    quota: 80G
  - client: transitionnetwork.org
    uid: tn-penguin
    storage_path: tank/backupclients/tn-penguin
    email: webproject@transitionnetwork.org
    quota: 240G
  - client: transitionnetwork.org
    uid: tn-puffin
    storage_path: tank/backupclients/tn-puffin
    email: webproject@transitionnetwork.org
    quota: 180G
&lt;/pre&gt;&lt;p&gt;
So this is now the state of the quotas:
&lt;/p&gt;
&lt;pre class="wiki"&gt;zfs list | grep 'tn\|NAME'
NAME                                 USED  AVAIL  REFER  MOUNTPOINT
tank/backupclients/tn-parrot        56.8G  23.2G  10.6G  /tank/backupclients/tn-parrot
tank/backupclients/tn-penguin        196G  43.6G  10.9G  /tank/backupclients/tn-penguin
tank/backupclients/tn-puffin         131G  49.3G  25.1G  /tank/backupclients/tn-puffin
&lt;/pre&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>chris</dc:creator>

      <pubDate>Sat, 02 May 2015 09:21:38 GMT</pubDate>
      <title>cc changed</title>
      <link>http://localhost:8080/trac/ticket/763#comment:6</link>
      <guid isPermaLink="false">http://localhost:8080/trac/ticket/763#comment:6</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;cc&lt;/strong&gt;
              &lt;em&gt;ade&lt;/em&gt; added; &lt;em&gt;ed&lt;/em&gt; removed
            &lt;/li&gt;
          &lt;/ul&gt;
        &lt;p&gt;
Just an update to report that the nightly disk images of all three servers are once again (and have been for the last couple of months or so) being synced to a backup server in Manchester every night.
&lt;/p&gt;
      </description>
      <category>Ticket</category>
    </item>
 </channel>
</rss>