How to Backup Your Files Over SMB in Linux
1:47 PMI just recently acquired a Zyxel media server, which I wanted to use to backup my files over the network. The only problem was that there are no Linux backup programs (that I know of) capable of backing up over SMB, which meant I would have to write a script that could accomplish this. In my research I found a lot of hints at what could be done to backup over SMB but no real step by step guides on how to do it. That's why, now that I have gotten it accomplished thanks to some help from the guys over at LinuxQuestions, I'm writing an article on how you can backup your files over SMB automatically in Linux. Hopefully this will help someone out there that may not be tech savvy but can follow some simple instructions.
- The IP address of the server you want to save your backups to
- The directory on the server you want to save your backups to
- The username/password of an account on the server that has full read/write access to the server
mkdir /mnt/backup
mount -o username=admin,password=password
mount -o username=admin,password=password //192.168.1.9/music /
mount -o username=admin,password=sedated1 //192.168.1.9/music /mnt/backup
mount -o username=admin,password=password //192.168.1.9/music /mnt/backup && rsync -av /home/jonquil/Music /mnt/backup
#!/bin/sh
#!/bin/sh
mount -o username=admin,password=password //192.168.1.9/music /mnt/backup && rsync -av /home/jonquil/Music /mnt/backup
chmod 500 backup.sh
crontab -e
0 1 * * 3 root run-parts /home/jonquil/backup.sh
****UPDATE**** I found out that Deja Dup carries the ability to backup files over SMB. However, it backs up files in its own compressed format, so this is still the only way I know of automatically backing up files over SMB uncompressed.
3 comments
Isnt there an opensource project called backuppc?
ReplyDeleteYou could use backuppc http://backuppc.sourceforge.net/ which can do backups locally, over ssh and over SMB. It will also deduplicate and compress the data.
ReplyDeleteThank you for mentioning Backuppc, because I had forgotten about it. I did try this tool, however the interface is very complicated and it seems to be more of a system administrator's tool than a common user's tool. I wanted something very simple to do, and unfortunately it was simpler to go about the backup process this way than it was to use Backuppc.
ReplyDeleteThanks for the tip about automount. It's not really necessary to keep the drive always mounted, but I'm sure someone else will be able to put that valuable info to use. :)