Categories
Linux Networking Software VM

Hint of the day: @digitalocean and not mounting sshfs at boot

In /etc/fstab, be sure to add the option:

_netdev

As it will attempt to start the network mounted sshfs before networking has been started.

The entire line looks like this:

[email protected]:/some/dir /local/path fuse.sshfs defaults,idmap=user,_netdev  0 0

From the man pages:

_netdev

The filesystem resides on a device that requires network access (used to prevent the system from attempting to mount these filesystems until the network has been enabled on the system).

Categories
Apple Linux Software

Rsync backups

My own simple rsync backup ‘script’.

You’ll need a rsync server, something to backup, and ssh-agent running to ease the process (or, fill in your password each time).

Add the following lines (using a terminal text editor) to a text file (“.rsync” for example, hidden files under Unix-like systems), and chmod +x $file.

1
2
3
rsync --archive -uv --exclude-from=/home/you/.rsync_exclude \
--rsh="ssh -p 222" --delete --stats --progress /Users/you/Documents/ \
you@remost.host.com:/home/you/remote-backup-directory

This will upload any files in /Users/you/Documents to /home/you/remote-backup-directory.

It will use ssh on port 222 to transfer the files.

Just execute ./.rsync (if that’s the name of your file) to run it.

If you make any changes (locally), and run this, the changes will be applied on the remote server (e.g. file changes, renames, deletes, …) — this will delete files on the remote server if you’ve deleted them locally!

The file .rsync_exclude is optional, it includes all files or directories that should NOT be uploaded

This is what I have in my .rsync_exclude:

1
2
Nazgul:~ yeri$ cat .rsync_exclude
Parallels/*

Simple as hell, and yet so handy!