tFixed a list formatting - monochromatic - monochromatic blog: http://blog.z3bra.org
HTML git clone git://z3bra.org/monochromatic
DIR Log
DIR Files
DIR Refs
---
DIR commit b773f39025d5ac4f1ef936559e691315a61423af
DIR parent 3755c3ccd69a9e487483af924a946ca69959bc4b
HTML Author: z3bra <willy@mailoo.org>
Date: Tue, 30 Sep 2014 18:39:47 +0200
Fixed a list formatting
Diffstat:
M 2014/09/backup-someone.txt | 42 ++++++++++++++++----------------
1 file changed, 21 insertions(+), 21 deletions(-)
---
DIR diff --git a/2014/09/backup-someone.txt b/2014/09/backup-someone.txt
t@@ -15,10 +15,10 @@ data... And you'll experience some of them, trust me !
Anyway, back to the topic ! In this post, I'm gonna tell you a *simple* way to
backup your data. All you need is the following:
- * A external storage support (USB key, hard drive, tapes, ...)
- * An archiver (cpio, tar, ar, ...)
- * A compressor (gzip, bzip2, xz, ...)
- * Some shell glue
+* A external storage support (USB key, hard drive, tapes, ...)
+* An archiver (cpio, tar, ar, ...)
+* A compressor (gzip, bzip2, xz, ...)
+* Some shell glue
### Preparation
t@@ -26,7 +26,7 @@ First, you need to figure out what you want to backup: configs ? multimedia ?
code ? For the purpose of this article, Let's say I want to backup all my
images, located in `/data/img`. Let's figure out the size of this directory:
- ─── du -sh /data/img
+ ── du -sh /data/img
5.5G /data/img/
This could fit on my USB key. Let's mount and prepare it. In the meantime, we
t@@ -68,7 +68,7 @@ the archive while it's created. A good thing with it is that it will only use
512 bytes at a time, then wait for the data to be processed, and so on... YOu
can check your pipe buffer with `ulimit -a`. Anyways:
- ─── find /data/img -type f | cpio -o | gzip -c > /mnt/backup/images.cpio.gz
+ ── find /data/img -type f | cpio -o | gzip -c > /mnt/backup/images.cpio.gz
And the archive is created and compressed ! Pretty easy isn't it ? Let's see how
to manage them now.
t@@ -174,12 +174,12 @@ number limit is reached. Here it is:
Now, to "archive" a file, all you need to do is :
- ─── cd /mnt/backup
- ─── backup.sh -r images.cpio.gz
+ ── cd /mnt/backup
+ ── backup.sh -r images.cpio.gz
And it will create the following tree:
- ─── ls /mnt/backup
+ ── ls /mnt/backup
images.cpio.gz images.cpio.gz.3.BAK images.cpio.gz.7.BAK
images.cpio.gz.0.BAK images.cpio.gz.4.BAK images.cpio.gz.8.BAK
images.cpio.gz.1.BAK images.cpio.gz.5.BAK images.cpio.gz.9.BAK
t@@ -204,12 +204,12 @@ your last trip. Before they arrive, you decide to cleanup the directory, and
notice a `.filedb-47874947392` created by your camera in the said directory.
Let's remove it:
- ─── cd /data/img/2014/trip_to_sahara/
- ─── ls -a .filedb-*
+ ── cd /data/img/2014/trip_to_sahara/
+ ── ls -a .filedb-*
.filedb-47874947392
- ─── rm -f .filedb- *
+ ── rm -f .filedb- *
rm: can't remove '.filedb-': No such file or directory
- ─── ls -la .
+ ── ls -la .
total 0
drwxr-xr-x 1 z3bra users 402 Sep 24 00:41 .
drwxr-xr-x 1 z3bra users 402 Sep 24 00:41 ..
t@@ -221,9 +221,9 @@ fuck your presentation up !
Hopefully, you made a backup this morning at 2 am... Let's restore your whole
directory from it:
- ─── mount /dev/sdd1 /mnt
- ─── cd /mnt/backup
- ─── ls -la
+ ── mount /dev/sdd1 /mnt
+ ── cd /mnt/backup
+ ── ls -la
total 0
drwxr-xr-x 1 z3bra users 402 Sep 10 00:41 .
drwxr-xr-x 1 z3bra users 402 Sep 10 00:41 ..
t@@ -242,7 +242,7 @@ latest is the one without any number.
`cpio` allow extracting files from an archive using the following syntax
- ─── cpio -i -d < archive.cpio
+ ── cpio -i -d < archive.cpio
`-i` ask for an extraction, while `-d` tells `cpio` to recreate the directory
tree if it does not exists. Check the [wikipedia
t@@ -252,11 +252,11 @@ So, to restore our lost directory you'd proceed like this:
# archive was created from absolute path, and cpio restor files from current
# directory, so let's move to root, to restore files directly
- ─── cd /
+ ── cd /
# you can pass globbing patterns to cpio, so that it only restores what you
# want. Don't forget to decompress the archive first
- ─── gzip -cd /mnt/backup/images.cpio.gz | cpio -ivd data/img/2014/trip_to_sahara/*
+ ── gzip -cd /mnt/backup/images.cpio.gz | cpio -ivd data/img/2014/trip_to_sahara/*
data/img/2014/trip_to_sahara/IMG-0001.JPG
data/img/2014/trip_to_sahara/IMG-0002.JPG
data/img/2014/trip_to_sahara/IMG-0003.JPG
t@@ -266,12 +266,12 @@ So, to restore our lost directory you'd proceed like this:
data/img/2014/trip_to_sahara/.filedb-47874947392
23 blocks
- ─── ls /data/img/2014/trip_to_sahara
+ ── ls /data/img/2014/trip_to_sahara
IMG-0001.JPG IMG-0003.JPG IMG-0005.JPG
IMG-0002.JPG IMG-0004.JPG IMG-0006.JPG
# be careful this time !
- ─── rm /data/img/2014/trip_to_sahara/.filedb-47874947392
+ ── rm /data/img/2014/trip_to_sahara/.filedb-47874947392
And it's all good ! Don't forget to keep your drive safe, and duplicate it if
you can, just in case.