<?xml version="1.0" encoding="UTF-8"?> <rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" ><channel><title>JackKozik.com &#187; linux</title> <atom:link href="http://jackkozik.com/tag/linux/feed" rel="self" type="application/rss+xml" /><link>http://jackkozik.com</link> <description>Web Programming, Home Networking and Personal Travel</description> <lastBuildDate>Mon, 04 Sep 2023 14:26:56 +0000</lastBuildDate> <language>en-US</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.9.2</generator> <item><title>Buffalo Linkstation for linux backup.</title><link>http://jackkozik.com/buffalo-linkstation-for-linux-backup-use-rsync-and-samba-mount/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=buffalo-linkstation-for-linux-backup-use-rsync-and-samba-mount</link> <comments>http://jackkozik.com/buffalo-linkstation-for-linux-backup-use-rsync-and-samba-mount/#comments</comments> <pubDate>Thu, 06 Dec 2012 04:10:51 +0000</pubDate> <dc:creator><![CDATA[Jack Kozik]]></dc:creator> <category><![CDATA[Web Programming]]></category> <category><![CDATA[backup]]></category> <category><![CDATA[Buffalo Linkstation]]></category> <category><![CDATA[linux]]></category> <category><![CDATA[rsync]]></category> <category><![CDATA[samba]]></category><guid isPermaLink="false">http://jackkozik.com/?p=186</guid> <description><![CDATA[<p>It&#8217;s time to expand the usage of my Buffalo Linkstation for linux backup.  I have been using my Linkstation Network Attached Storage box for backup of my home PCs and MACs.  I have a couple of linux servers so I thought I&#8217;d see if I could use my Buffalo Linkstation for linux backup. Summary: create [&#8230;]</p><p>The post <a rel="nofollow" href="http://jackkozik.com/buffalo-linkstation-for-linux-backup-use-rsync-and-samba-mount/">Buffalo Linkstation for linux backup.</a> appeared first on <a rel="nofollow" href="http://jackkozik.com">JackKozik.com</a>.</p> ]]></description> <content:encoded><![CDATA[<div id="attachment_187" style="width: 190px" class="wp-caption alignleft"><a href="http://buffalo.nas-central.org/wiki/Category:LS-WXL" target="_blank"><img class=" wp-image-187 " title="Ls-wxl_r1_o1_large" src="http://jackkozik.com/wp-content/uploads/2012/11/Ls-wxl_r1_o1_large-300x225.jpg" alt="Buffalo Linkstation WXL" width="180" height="135" /></a><p class="wp-caption-text">Buffalo Linkstation WXL</p></div><p>It&#8217;s time to expand the usage of my Buffalo Linkstation for linux backup.  I have been using my Linkstation Network Attached Storage box for backup of my home PCs and MACs.  I have a couple of linux servers so I thought I&#8217;d see if I could use my Buffalo Linkstation for linux backup.</p><h2>Summary: create tar files and ftp them to Linkstation</h2><p>The short version of the story is that I wrote a Buffalo Linkstation for linux backup script that created tar files of my user directories and ftp&#8217;d them to the Buffalo Linkstation.  I tried samba mounting the Linkstation and rsyncing to it.  ext4&lt;-&gt;ntfs file system incompatibilities won&#8217;t let that work.</p><h2>Buffalo Linkstation for linux backup tar / ftp script approach</h2><p>I use the following command to backup a user&#8217;s directory:</p><pre># tar cvzf backupfile.tar.gz --exclude='.*' /home/$USER/</pre><p>This is a traditional tar command where I exclude the hidden files.</p><p>Next, in researching this problem, the <a href="http://forum.buffalo.nas-central.org">Buffalo Linkstation Forum</a> has lots of powerful tips.  The ftp program ncftp is a favorite to use in scripts.  My fedora distribution didn&#8217;t have it, so I installed it.</p><pre># yum install ncftp</pre><p>This lets me very easily copy my tar file to my Linkstation; on it, I make a separate share for each home computer:</p><pre># ncftpput 192.168.1.40 /array1/share/fedora backupfile.tar.gz</pre><p>For personal reasons, I want to do backups per user login. That way, I have control over frequency of backup; some content changes frequently, some changes rarely. From this, here&#8217;s a per-user Fedora Linux to Buffalo Linkstation backup script:</p><pre class="brush: bash; title: ; notranslate">
#!/bin/bash
## userbck.sh
## usage userbck.sh username
##    /home/$username much exist, else exit
USER=$1
echo &quot;Test for /home/$USER&quot;
if [ -d &quot;/home/$USER&quot; ] ; then
   echo &quot;/home/$USER is valid user directory&quot;;
else
   echo &quot;/home/$USER is not a valid user directory... Exiting&quot;;
   exit 1
fi

DATE=`/bin/date +%Y%m%d`
TIME=`/bin/date +%H`
BCKUPFILE=&quot;/tmp/userbck/$USER.$DATE.$TIME.tar.gz&quot;
tar cvzf $BCKUPFILE  --exclude='.*' /home/$USER/
ncftpput 192.168.1.40 /array1/share/fedora $BCKUPFILE
</pre><p>I run user backups once per week, except one backup I run monthly. The backup tar files are on the order of 10M each. I also have a script to backup mysql (borrowing from <a href="http://www.celticproductions.net/articles/2/linux/remote+server+backup+%28ncftp%29.html">link</a>):</p><pre class="brush: bash; title: ; notranslate">
#!/bin/bash
DATE=`/bin/date +%Y%m%d`
TIME=`/bin/date +%H`
BCKUPFILE=&quot;/tmp/sqlbck/alldatabases.$DATE.$TIME.sql&quot;
mysqldump --user root --all-databases &gt; $BCKUPFILE
ncftpput 192.168.1.40 /array1/share/fedora $BCKUPFILE
</pre><p>In my crontab, you can see the general workflow:</p><pre>0 3 * * * /home/jkozik/bin/bckupdrive.sh # rsync to the other 
                                         # hard drive in the PC
0 17 * * * /home/jkozik/bin/sqlbck.sh
0 16 * * 0 /home/jkozik/bin/userbck.sh nf
0 16 * * 1 /home/jkozik/bin/userbck.sh jkozik
0 16 * * 2 /home/jkozik/bin/userbck.sh lizkozik
0 16 * * 3 /home/jkozik/bin/userbck.sh weather
0 16 * * 4 /home/jkozik/bin/userbck.sh wjr
0 4 1 * * /home/jkozik/bin/userbck.sh family
~</pre><h2></h2><h2>I tried rsync between by linux server and Linkstation&#8230; no luck.</h2><p>For starters, my home network PCs are all backing up to my Linkstation now using its windows (samba/cifs) sharing service. The Linkstation, named LS-WXL9E3, is sitting on my home LAN and looks like any other host on my home LAN WORKGROUP.  Here&#8217;s what my home PCs see;</p><div style="width: 310px" class="wp-caption aligncenter"><a href="http://jackkozik.com/wp-content/uploads/2012/11/Win7BuffaloNetworkShare.png"><img title="Win7BuffaloNetworkShare" src="http://jackkozik.com/wp-content/uploads/2012/11/Win7BuffaloNetworkShare-300x131.png" alt="Buffalo Linkstation as a Windows 7 Share" width="300" height="131" /></a><p class="wp-caption-text">click for larger image</p></div><p>Setting up the Buffalo Linkstation console:  be sure to check the Windows box on the shared folders settings page:</p><p style="text-align: center;"><a href="http://jackkozik.com/wp-content/uploads/2012/11/BuffaloShareSettings.png"><img class="size-medium wp-image-183 aligncenter" title="BuffaloShareSettings" src="http://jackkozik.com/wp-content/uploads/2012/11/BuffaloShareSettings-300x166.png" alt="Share Folders Setting" width="300" height="166" /></a></p><p>And on the Network-&gt;Workgroup/Domain settings page, be sure to put in the right settings for your home workgroup.  My home workgroup is called WORKGROUP.  This is explicitly set on my PCs.</p><p style="text-align: center;"><a href="http://jackkozik.com/wp-content/uploads/2012/11/BuffaloWorkgroup.png"><img class="size-medium wp-image-184 aligncenter" title="BuffaloWorkgroup" src="http://jackkozik.com/wp-content/uploads/2012/11/BuffaloWorkgroup-300x217.png" alt="Network Workgroup/Domain Settings" width="300" height="217" /></a></p><p style="text-align: left;">So from my linux server, I mounted the Linkstation.  My fedora installation, included setting up CIFS/SAMBA, so all I had to do was mount:</p><pre style="text-align: left;"># mount -tcifs //192.168.1.40/share /mnt/ls-wxl93e \
                -o guest,user=guest</pre><p style="text-align: left;"> So from here, I ran a simple test rsync script.</p><pre style="text-align: left;"># rsync -av -L --modify-window=2 /home/jkozik   \
                                 /mnt/ls-wxl93e/fedora/home</pre><p style="text-align: left;">This worked.  Great (I thought)!   So I started setting up  some cronjobs.  I noticed that every time I ran my rsync, more than half of the files were re-backedup each run.  Rsync only backs up that have changed; but none of these files had changed.  Even after I added the &#8220;&#8211;modify-window=2&#8243; parameter to the rsync command, I was still backing up way too many files.   Similar to the issue found at<a href="http://www.linuxquestions.org/questions/linux-server-73/rsync-keeps-backing-up-same-folders-over-and-over-694917/"> link.</a>  Backing up an ext4 filesystem on my fedora linux server to the samba interface on the Linkstation wasn&#8217;t going to work for me.</p><h2 style="text-align: left;">Next step for me:  enable sshd on my Linkstation</h2><p style="text-align: left;">So, I learned that the Linkstation community follows a different approach to this issue.  There&#8217;s robust set of contributions on how to turn-on ssh access to let rsync run directly through the sshd on the Linkstation, sans samba/cifs. I found<a href="http://buffalo.nas-central.org/wiki/Category:LS-WXL#Gain_SSH_Access"> the wiki that covers this case</a>, and I&#8217;ll someday move to this approach; tar files are ok, but I want to eventually land into a rsync approach.</p><p>The post <a rel="nofollow" href="http://jackkozik.com/buffalo-linkstation-for-linux-backup-use-rsync-and-samba-mount/">Buffalo Linkstation for linux backup.</a> appeared first on <a rel="nofollow" href="http://jackkozik.com">JackKozik.com</a>.</p> ]]></content:encoded> <wfw:commentRss>http://jackkozik.com/buffalo-linkstation-for-linux-backup-use-rsync-and-samba-mount/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> </channel> </rss>