{"id":552,"date":"2012-04-13T22:02:27","date_gmt":"2012-04-14T05:02:27","guid":{"rendered":"http:\/\/todaywasawesomecom.local\/?p=552"},"modified":"2012-04-13T22:08:58","modified_gmt":"2012-04-14T05:08:58","slug":"move-lots-of-files-using-rsync-for-fun-and-profit","status":"publish","type":"post","link":"https:\/\/todaywasawesomecom.local\/move-lots-of-files-using-rsync-for-fun-and-profit\/","title":{"rendered":"Move lots of files using rsync for fun and profit"},"content":{"rendered":"

\"Total<\/a>

Yeah, you're a total hacker.<\/p><\/div>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.<\/p>\n

Backup one directory to another, recursively<\/h2>\n

$rsync -r \/path\/of\/source \/path\/to\/backup<\/code>
\nNow, 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\u00a0ampersand\u00a0to deal with any output.<\/p>\n

Backup directory recursively, perserving permissions, and ignoring terminal disconnects.<\/h2>\n

$nohup rsync -ra \/path\/of\/source \/path\/to\/backup &<\/code>
\nUsing 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<\/p>\n

$sudo -i
\n#nohup rsync -ra \/path\/of\/source \/path\/to\/backup &<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"

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. […]<\/p>\n","protected":false},"author":2,"featured_media":559,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[83],"tags":[102,103,104,54,100,101],"psp_head":"Move lots of files using rsync for fun and profit \u2013 Today Was Awesome<\/title>\r\n<meta name=\"description\" content=\"Rsync is really easy to use, but using sudo with nohup requires a little extra juice. Check it out.\" \/>\r\n<meta name=\"robots\" content=\"index,follow\" \/>\r\n<link rel=\"canonical\" href=\"https:\/\/todaywasawesomecom.local\/move-lots-of-files-using-rsync-for-fun-and-profit\/\" \/>\r\n","_links":{"self":[{"href":"https:\/\/todaywasawesomecom.local\/wp-json\/wp\/v2\/posts\/552"}],"collection":[{"href":"https:\/\/todaywasawesomecom.local\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/todaywasawesomecom.local\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/todaywasawesomecom.local\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/todaywasawesomecom.local\/wp-json\/wp\/v2\/comments?post=552"}],"version-history":[{"count":10,"href":"https:\/\/todaywasawesomecom.local\/wp-json\/wp\/v2\/posts\/552\/revisions"}],"predecessor-version":[{"id":564,"href":"https:\/\/todaywasawesomecom.local\/wp-json\/wp\/v2\/posts\/552\/revisions\/564"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/todaywasawesomecom.local\/wp-json\/wp\/v2\/media\/559"}],"wp:attachment":[{"href":"https:\/\/todaywasawesomecom.local\/wp-json\/wp\/v2\/media?parent=552"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/todaywasawesomecom.local\/wp-json\/wp\/v2\/categories?post=552"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/todaywasawesomecom.local\/wp-json\/wp\/v2\/tags?post=552"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}