Buffalo Linkstation

Buffalo Linkstation for linux backup.

Buffalo Linkstation WXL

Buffalo Linkstation WXL

It’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’d see if I could use my Buffalo Linkstation for linux backup.

Summary: create tar files and ftp them to Linkstation

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’d them to the Buffalo Linkstation.  I tried samba mounting the Linkstation and rsyncing to it.  ext4<->ntfs file system incompatibilities won’t let that work.

Buffalo Linkstation for linux backup tar / ftp script approach

I use the following command to backup a user’s directory:

# tar cvzf backupfile.tar.gz --exclude='.*' /home/$USER/

This is a traditional tar command where I exclude the hidden files.

Next, in researching this problem, the Buffalo Linkstation Forum has lots of powerful tips.  The ftp program ncftp is a favorite to use in scripts.  My fedora distribution didn’t have it, so I installed it.

# yum install ncftp

This lets me very easily copy my tar file to my Linkstation; on it, I make a separate share for each home computer:

# ncftpput /array1/share/fedora backupfile.tar.gz

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’s a per-user Fedora Linux to Buffalo Linkstation backup script:

## userbck.sh
## usage userbck.sh username
##    /home/$username much exist, else exit
echo "Test for /home/$USER"
if [ -d "/home/$USER" ] ; then
   echo "/home/$USER is valid user directory";
   echo "/home/$USER is not a valid user directory... Exiting";
   exit 1

DATE=`/bin/date +%Y%m%d`
TIME=`/bin/date +%H`
tar cvzf $BCKUPFILE  --exclude='.*' /home/$USER/
ncftpput /array1/share/fedora $BCKUPFILE

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 link):

DATE=`/bin/date +%Y%m%d`
TIME=`/bin/date +%H`
mysqldump --user root --all-databases > $BCKUPFILE
ncftpput /array1/share/fedora $BCKUPFILE

In my crontab, you can see the general workflow:

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

I tried rsync between by linux server and Linkstation… no luck.

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’s what my home PCs see;

Buffalo Linkstation as a Windows 7 Share

click for larger image

Setting up the Buffalo Linkstation console:  be sure to check the Windows box on the shared folders settings page:

Share Folders Setting

And on the Network->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.

Network Workgroup/Domain Settings

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:

# mount -tcifs // /mnt/ls-wxl93e \
                -o guest,user=guest

 So from here, I ran a simple test rsync script.

# rsync -av -L --modify-window=2 /home/jkozik   \

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 “–modify-window=2″ parameter to the rsync command, I was still backing up way too many files.   Similar to the issue found at link.  Backing up an ext4 filesystem on my fedora linux server to the samba interface on the Linkstation wasn’t going to work for me.

Next step for me:  enable sshd on my Linkstation

So, I learned that the Linkstation community follows a different approach to this issue.  There’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 the wiki that covers this case, and I’ll someday move to this approach; tar files are ok, but I want to eventually land into a rsync approach.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>