about summary refs log tree commit diff stats
path: root/tools/tar.html
diff options
context:
space:
mode:
Diffstat (limited to 'tools/tar.html')
-rw-r--r--tools/tar.html119
1 files changed, 119 insertions, 0 deletions
diff --git a/tools/tar.html b/tools/tar.html
new file mode 100644
index 0000000..876065a
--- /dev/null
+++ b/tools/tar.html
@@ -0,0 +1,119 @@
+<!DOCTYPE html>
+<html dir="ltr" lang="en">
+    <head>
+        <meta charset='utf-8'>
+        <title>1. Tar</title>
+    </head>
+    <body>
+
+        <a href="index.html">Systolls Index</a>
+        <h1>2. Tar</h1>
+
+
+        <h2 id="tarbkup">2.1. Create Backup</h2>
+
+        <p>Script in core/scripts/<a href="scripts/backup-system.sh">backup-system.sh</a> use tldp
+        <a href="http://tldp.org/LDP/lame/LAME/linux-admin-made-easy/server-backup.html">server backup</a>
+        and <a href="http://tldp.org/LDP/lame/LAME/linux-admin-made-easy/server-restore.html">restore</a>
+        as a reference.</p>
+
+        <pre>
+        #!/bin/sh
+
+        echo -n "root directory you want backup (/mnt/): "
+        read ROOT_DIR
+
+        echo -n "where you want to save (/home/user): "
+        read DEST_DIR
+
+        echo -n "backup name (system_name): "
+        read BCK_NAME
+
+        echo $DES_DIR
+        echo $ROOT_DIR
+
+        tar --xattrs -zcpf $DEST_DIR/$BCK_NAME-`date '+%Y-%j-%H-%M-%S'`.tar.gz \
+            --directory=$ROOT_DIR \
+            --exclude=srv \
+            --exclude=var/ports \
+            --exclude=var/run \
+            --exclude=usr/src \
+            --exclude=mnt \
+            --exclude=home \
+            --exclude=dev \
+            --exclude=run \
+            --exclude=tmp \
+            --exclude=proc \
+            --exclude=sys .
+        </pre>
+
+        <h2 id="tarview">1.2. View content of tar</h2>
+
+        <p>List files inside tar;</p>
+
+        <pre>
+        $tar -tvf backup.tar.gz
+        </pre>
+
+        <p>To restore is better to use first t flag and then x,
+        this prevents any --absolute-paths problem;<p>
+
+        <pre>
+        $ tar -ztvpf full-backup-11-November-2045.tar.gz &gt; file.lst
+        </pre>
+
+        <h2 id="tarextract">1.3. Extract content from tar</h2>
+
+        <p>If you want to extrat to different directory;</p>
+
+        <pre>
+        $ tar xf full-backup-11-November-2045.tar.gz --directory=/mnt
+        </pre>
+
+        <p>If path is fine, extract everything;</p>
+
+        <pre>
+        $ tar --xattrs -xpvf full-backup-11-November-2045.tar.gz
+        </pre>
+
+        <p>Extract just one file;</p>
+
+        <pre>
+        $ tar --extract --file=core.tar.gz libidn#1.32-1.pkg.tar.gz
+        </pre>
+
+        <h2 id="taradd">1.4. Add content to tar</h2>
+
+        <p>Only uncompressed tar can append files without having
+        to extract and compress again.</p>
+
+        <p>First create a tar with all files in the current directory;</p>
+
+        <pre>
+        $ tar cpf core.tar *.tar.gz
+        </pre>
+
+        <p>List files before appending new file and after;</p>
+
+        <pre>
+        $ tar -tvf core.tar
+        $ tar --append --file=core.tar libidn#1.32-1.pkg.tar.gz
+        $ tar -tvf core.tar
+        </pre>
+
+        <h2 id="tarrm">1.5. Remove content of tar</h2>
+
+        <pre>
+        $ tar -tvf core.tar
+        $ tar --delete --file=core.tar libidn#1.32-1.pkg.tar.gz
+        $ tar -tvf core.tar
+        </pre>
+
+        <a href="index.html">Systolls Index</a>
+        <p>
+        This is part of the c9-doc Manual.
+        Copyright (C) 2016
+        Silvino Silva.
+        See the file <a href="../fdl-1.3-standalone.html">Gnu Free Documentation License</a> for copying conditions.</p>
+    </body>
+</html>