Featured posts Show

Move lots of files using rsync for fun and profit

Total epic hackers

Yeah, you're a total hacker.

I needed to backup my large collection of cat pictures today and realized how big of a pain moving 2TB of files is using the usual terminal copying tools. Luckily, moving around lots of files, and lots of large files, via terminal is really easy using rsync. Rsync has some nice tricks up it’s sleeve. It can perserve permissions, compress files on the fly, and do some filtering as it copies. Oh yeah, and if it’s interrupted you can always resume, unlike commands like cp, dd, and mv.

Backup one directory to another, recursively

$rsync -r /path/of/source /path/to/backup
Now, that’s fine and dandy if you’re working on a local machine but if you’re moving stuff remotely you need some extra help from nohup. Nohup is a command that means “no hang up”, as in, even if your session is disconnected nohup will keep running. You’ll also need an ampersand to deal with any output.

Backup directory recursively, perserving permissions, and ignoring terminal disconnects.

$nohup rsync -ra /path/of/source /path/to/backup &
Using this command with sudo is a bit tricky, you can’t just throw a sudo infront of it and let it run. Instead you have to do two commands

$sudo -i
#nohup rsync -ra /path/of/source /path/to/backup &

Move lots of files using rsync for fun and profit
Posted Friday, April 13, 2012
4
Comments disabled.