{"id":1759,"date":"2012-12-30T18:39:37","date_gmt":"2012-12-30T18:39:37","guid":{"rendered":"http:\/\/salientsoft.co.uk\/?p=1759"},"modified":"2018-10-13T09:59:34","modified_gmt":"2018-10-13T09:59:34","slug":"imedia-embedded-linux-backup-using-tar","status":"publish","type":"post","link":"https:\/\/salientsoft.co.uk\/?p=1759","title":{"rendered":"Imedia Embedded Linux &ndash; Backup using tar"},"content":{"rendered":"<p>This article <a href=\"https:\/\/help.ubuntu.com\/community\/BackupYourSystem\/TAR\">here<\/a> discusses how to perform Linux backups and restores using tar ( I have also saved a pdf of the post in the Linux section of the repository).<\/p>\n<p>I wanted to at least backup my system so that I had all the custom configuration and shell scripts backed up.<\/p>\n<p>I was not looking to do a full restore \u2013 if I lost the system I would reinstall from CD and then probably pull from the backup piecemeal manually as required.<\/p>\n<p>As an Imedia system is so small (mine is only 2GB), I backed up to a FAT32 flash drive and then archived the backup elsewhere. Imedia does a good job of handling USB drives, but will need FAT32 rather than NTFS.<\/p>\n<p>tar appears to do a pretty good job of backups \u2013 symbolic links are handled correctly by default (it backs up the links rather than following to the files), and permissions etc. are backed up as per the above article.<\/p>\n<p>The following example shows my backup script, generated with the help of the above article:-<\/p>\n<pre style=\"padding-left: 30px;\">#!\/bin\/bash\r\n\r\nif [ -z $1 ]; then read -p \"Enter Backup Name:\" name;\u00a0\u00a0\u00a0\u00a0 else name=$1; fi\r\nif [ -z $2 ]; then read -p \"Enter output directory:\" dir; else dir=$2; fi\r\n\r\nfile=\"${name}_`date +%Y-%m-%d_%H-%M-%S`\"\r\nif [[ $dir != *\/ ]]; then dir=$dir\/; fi\r\nfile=$dir$file\r\n\r\necho Backup: $name started at: `date +\"%d-%m-%Y %H:%M:%S\"` &gt; $file.log\r\necho Output File: $file.tar.gz &gt;&gt; $file.log\r\necho &gt;&gt; $file.log\r\n\r\ntar -cvpzf $file.tar.gz --exclude=$file.* --exclude=\/proc --exclude=\/lost+found --exclude=\/sys \\\r\n    --exclude=\/mnt --exclude=\/media --exclude=\/dev --exclude=\/var --exclude=\/tmp \/ &gt;&gt; $file.log 2&gt;&amp;1\r\n\r\necho &gt;&gt; $file.log\r\necho Backup: $name completed at: `date +\"%d-%m-%Y %H:%M:%S\"` &gt;&gt; $file.log<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>This article here discusses how to perform Linux backups and restores using tar ( I have also saved a pdf of the post in the Linux section of the repository). I wanted to at least backup my system so that I had all the custom configuration and shell scripts backed up. I was not looking [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[45],"tags":[57,159,186],"_links":{"self":[{"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/1759"}],"collection":[{"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1759"}],"version-history":[{"count":7,"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/1759\/revisions"}],"predecessor-version":[{"id":2218,"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/1759\/revisions\/2218"}],"wp:attachment":[{"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1759"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1759"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1759"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}