I use a small headless Debian system as file server for all family photos, videos, documents, etc. Its hostname is “bubba”. I have recently set it up to run backups to an external harddrive, using cron and rsync.
The external disk is a 500G laptop SATA disk in an USB/eSATA enclosure. It requires no separate power supply. So far I have only got it to work over USB. Somehow the eSATA does not work for me on Debian 6 (aka “squeeze”), even though the file server has an eSATA port.
NTFS mount/unmount with sudo
I use NTFS as the filesystem on the backup disk because we wanted it to be compatible with MS Windows. The Debian Linux on the file server uses ntfs-3g for mounting the disk read-write. Unfortunately that only works well with root rights, so I configured sudo to permit myself password-less mounting and unmounting of the device.
oliver ALL = NOPASSWD: /bin/mount /mnt/backup, \ /bin/umount /mnt/backup
The nightly backup process itself is a simple non-destructive local rsync command, wrapped by mount and unmount commands, to make sure that we can unplug the external disk anytime we want (just not around midnight).
oliver@bubba:~$ crontab -l
0 0 * * * /home/oliver/shared/scripts/backup.sh
The backup.sh script
#! /bin/sh if mountpoint /mnt/backup; then sudo umount /mnt/backup fi sudo mount /mnt/backup if [ $? -eq 0 ]; then rsync -avvih --progress \ --exclude /downloads \ --exclude /movies \ /home/storage/ /home/oliver/backup \ > /tmp/cron_output.log 2>&1 fi sudo umount /mnt/backup
Symlinks and fstab
Symlink in my home for convenience:
oliver@bubba:~$ ls -l /home/oliver/backup
lrwxrwxrwx 1 oliver users 11 Aug 7 21:38 /home/oliver/backup -> /mnt/backup/
Entry in /etc/fstab:
oliver@bubba:~$ grep "/mnt/backup" /etc/fstab
/usr/local/share/backup /mnt/backup ntfs-3g defaults 0 0
Device symlink /usr/local/share/backup:
oliver@bubba:~$ ls -l /usr/local/share/backup
lrwxrwxrwx 1 root staff 84 Jun 23 01:51 /usr/local/share/backup -> /dev/disk/by-id/usb-WDC_WD50_00BPVT-00HXZT3_FDC0FD500000000FD0FF61A6103926-0:0-part1
Room for improvement
The symlink to the device file is the ugliest part of the whole solution. Currently I have to plug the disk directly into a USB slot on the file server because if I connect it via a USB hub, it will appear under a different name in /dev/disk/by-id and my symlink won’t work. I would like to use a udev rule instead that automatically creates an identical symlink no matter how the the disk is plugged in.
I would also like to implement a 2-way backup so that files we put on the external disk, for example photos from a trip to relatives, will be mirrored to the file server. It should be just another rsync command going in the opposite reaction.
Maybe I would also like the backup process to start right away when the disk is plugged in, in addition to the nightly cron job. This would probably require another udev rule.
The site explainshell.com provides explanations for concrete Linux shell commands, specifically for the options used.
- Close any running IntelliJ IDEA instances
- Add this line to your idea.properties file:
- Start IntelliJ, go to File – Settings – HTTP Proxy, select “Auto-detect proxy settings”.
I recently exported my IntelliJ code inspections profile for Java projects from IntelliJ 12.1.6 Community Edition to share it with whoever might be interested.
These highly customized code inspections are based on industry standards like the official Java code conventions, various best practices from the Java community and my experience over many years as Java developer and team lead, trying to ensure code quality and maintainability.
Feel free to download and save it as a local XML file. Then you can import it into any of your IntelliJ projects via Analyze – Inspect Code – Inspection profile – [...] button – Import:
In many ways it is a step in a good direction that many companies use internal “collaboration portals’ with chat forums, wikis, etc. But it also segregates these corporate communities from the public web. Certainly, company-internal proprietary knowledge and business discussions belong behind the firewall, but that is only a fraction of the knowledge sharing going on at work.
It is unfortunate that even non-proprietary conversations about Open Source tools and technologies get separated from the public internet. I think at least the so-called “personal blogs” that many corporate collaboration portals offer belong into the worldwide “blogosphere”, not on intranets or other “walled gardens” systems.
Judging from my own experience with odoepner.wordpress.com, bloggers and professional software developers actually benefit from using public blogging services. Platforms like WordPress are very good at making articles findable via search engines like Google, allow categorization, attachment management, feed update notifications into Twitter, LinkedIn, etc. And on the whole, a public blog generates more useful feedback and discussions than limiting the same thing to the people who happen to work for the same employer.
To directly notify coworkers about new posts on my blog, I simply post the link (i.e. the hopefully permanent URL) on my employers collaboration site, not the content itself.
And if I ever change jobs, I will still have access to my own posts. That certainly helps an older guy like me, with a weak memory for details …
I own an Excito Bubba/2 file and print server, running Debian Squeeze. Mostly I am quite happy with it.
Now recently the CTO of the Swedish manufacturer announced that Excito is shifting focus, the Bubba/3 product is not marketed on the main excito.com website anymore, but sold off at discount prices on their web store.
This shift seems to be a logical step given the split of the originally 4 founders of the company a few years ago and Excito’s ongoing struggle to support the versatile Debian based Bubba servers.
Tor Krill and PA Nilsson, the two founders who left Excito a while ago formed OpenProducts and were planning to take over support of the B3, but recently decided to cancel that takeover.
It is uncertain if Excito’s Bubba product line and its customized Debian distribution will survive. Open-sourcing their proprietary Debian packages would certainly be nice. There is an ongoing discussion on the Excito forums about all this.
You need ssh logins without password and the sshfs package:
sudo apt-get install sshfs
The scripts below ensure automatic mounting and unmounting as your network comes up or goes down. Use chmod ugo+x to make sure they are executable.
#! /bin/sh cd /home for user in *; do script="/home/$user/.sshfs/mount.sh" if [ -x "$script" ]; then su $user -c "$script" fi done
#! /bin/sh OLDIFS=$IFS IFS=' ' for mount in $(mount | grep " type fuse.sshfs "); do dir=$(echo $mount | cut -f3 -d' ') userid=$(echo $mount | grep -o "user_id=[0-9]*" | cut -f2 -d'=') user=$(getent passwd $userid | cut -f1 -d':') su $user -c "fusermount -u $dir" done IFS=$OLDIFS
If you use the network-manager package, also symlink the script from if-post-down.d:
cd /etc/network/if-post-down.d sudo ln -s ../if-down.d/unmount-sshfs
For each user, this script may contain the sshfs invocations that the user wants to be auto-executed. It will be invoked automatically from /etc/network/if-up.d/mount-sshfs using the users permissions. Users who don’t need sshfs mounts, simply don’t create the file at all.
It is up to the individual user to create this file and make it executable:
chmod ugo+x $HOME/.sshfs/mount.sh
The following is just an example taken from my desktop and laptop at home. We use an Excito Bubba/2 mini server that hosts shared storage for the whole family (/home/storage) and backup space for personal files (/home/oliver). I mount each of those server locations locally under /home/oliver/bubba.
I mount the shared storage read-only to prevent accidental data loss (-o ro) and my personal files as read-write (-o rw), with ownership mapping by username to ensure that “oliver” on the server is mapped to the local “oliver” (idmap=user):
#! /bin/sh sshfs -o ro oliver@bubba:/home/storage ~/bubba/storage sshfs -o rw -o idmap=user oliver@bubba:/home/oliver ~/bubba/oliver