1.xfsrestore - XFS filesystem incremental restore utilitysession
[root@study ~]# xfsrestore -I dom
[root@study ~]# xfsrestore [-f 備份檔] [-L S_label] [-s] 待復原目錄工具
[root@study ~]# xfsrestore [-f 備份文件] -r 待復原目錄ui
[root@study ~]# xfsrestore [-f 備份文件] -i待復原目錄命令行
-I :跟xfsdump相同的輸出!可查詢備份數據,包括 Label 名稱與備份時間等
-L :就是 Session 的 Label name 喔!可用 -I 查詢到的數據,在這個選項後輸入!
-r :若是是用檔案來儲存備份數據,那這個就不須要使用。若是是一個磁帶內有多個檔案,須要這東西來達成累積復原
-i:進入互動模式,進階管理員使用的!通常咱們不太須要操做它!
[root@localhost mnt]# xfsrestore -I
fs id: f598c75c-bd26-4543-af2f-8192841c4c8b
mount point: localhost.localdomain:/mnt/sda3
device: localhost.localdomain:/dev/sda3
time: Tue Mar 31 20:42:51 2020
session label: "dump_sda3_20200331"
session id: b2315293-f79f-43b2-9276-157268eea187
media id: 23a27bd0-e47b-4bee-9005-d530e6303f63
mount point: localhost.localdomain:/mnt/sda3
device: localhost.localdomain:/dev/sda3
time: Tue Mar 31 20:47:58 2020
session label: "dump_sda3_20200331-1"
session id: 989e4ade-b8c3-40be-9714-10c648f6b46c
media id: 42121b62-abf0-4e26-98f1-48d50f01b633
mount point: localhost.localdomain:/mnt/sda3
device: localhost.localdomain:/dev/sda3
time: Tue Mar 31 20:56:34 2020
session label: "dump_sda3_20200331-2"
session id: 1a6e946b-fd0e-4e70-bb00-b82c04291de7
media id: f410ea13-eada-4566-87c8-844b1a939ce1
[root@localhost mnt]# rm -f sda3/*
[root@localhost mnt]# ls sda3/
[root@localhost mnt]# xfsrestore -f /tmp/sda3 /mnt/sda3/
xfsrestore: using file dump (drive_simple) strategy
xfsrestore: version 3.1.3 (dump format 3.0) - type ^C for status and control
xfsrestore: searching media for dump
xfsrestore: examining media file 0
xfsrestore: hostname: localhost.localdomain
xfsrestore: mount point: /mnt/sda3
xfsrestore: session time: Tue Mar 31 20:42:51 2020
xfsrestore: session label: "dump_sda3_20200331"
xfsrestore: media label: "sda3"
xfsrestore: file system id: f598c75c-bd26-4543-af2f-8192841c4c8b
xfsrestore: session id: b2315293-f79f-43b2-9276-157268eea187
xfsrestore: media id: 23a27bd0-e47b-4bee-9005-d530e6303f63
xfsrestore: using online session inventory
xfsrestore: searching media for directory dump
xfsrestore: reading directories
xfsrestore: 1 directories and 1 entries processed
xfsrestore: directory post-processing
xfsrestore: restoring non-directory files
xfsrestore: restore complete: 0 seconds elapsed
xfsrestore: stream 0 /tmp/sda3 OK (success)
xfsrestore: Restore Status: SUCCESS
[root@localhost mnt]# ls sda3/
[root@localhost mnt]# xfsrestore -f /tmp/sda3-1 /mnt/sda3/
[root@localhost mnt]# ls sda3/
[root@localhost mnt]# xfsrestore -f /tmp/sda3-2 /mnt/sda3/
[root@localhost mnt]# ls sda3/
1.txt 2.txt 3.txt 4.txt 5.txt 6.txt
[root@localhost mnt]# xfsrestore -f /tmp/sda3-2 -i /mnt/sda3/
xfsrestore: using file dump (drive_simple) strategy
xfsrestore: version 3.1.3 (dump format 3.0) - type ^C for status and control
xfsrestore: searching media for dump
xfsrestore: examining media file 0
xfsrestore: hostname: localhost.localdomain
xfsrestore: mount point: /mnt/sda3
xfsrestore: session time: Tue Mar 31 20:56:34 2020
xfsrestore: session label: "dump_sda3_20200331-2"
xfsrestore: media label: "sda3"
xfsrestore: file system id: f598c75c-bd26-4543-af2f-8192841c4c8b
xfsrestore: session id: 1a6e946b-fd0e-4e70-bb00-b82c04291de7
xfsrestore: media id: f410ea13-eada-4566-87c8-844b1a939ce1
xfsrestore: using online session inventory
xfsrestore: searching media for directory dump
xfsrestore: reading directories
xfsrestore: 1 directories and 6 entries processed
xfsrestore: directory post-processing
================= subtree selection dialog ==================
the following commands are available:
-> add 2.txt #本條無效,由於2.txt不在本次備份文件中
--------------------------------- end dialog ---------------------------------
xfsrestore: restoring non-directory files
xfsrestore: restore complete: 97 seconds elapsed
xfsrestore: stream 0 /tmp/sda3-2 OK (success)
xfsrestore: Restore Status: SUCCESS
[root@localhost mnt]# ls sda3/
若是隻想要復原某一個目錄或檔案的話,直接加上『 -s 目錄』這個選項與參數便可!前提是你要知道被還原的文檔名。
[root@localhost mnt]# xfsrestore -f /tmp/sda3-2 -s 6.txt /mnt/sda3
[root@localhost mnt]# ls sda3/
[root@study ~]# dd if="input_file" of="output_file" bs="block_size" count="number"
bs :規劃的一個 block 的大小,若未指定則預設是 512 bytes(一個 sector 的大小)
[root@localhost ~]# dd if=/dev/hdb of=/dev/hdd
(2)將/dev/hdb全盤數據備份到指定路徑的image文件
[root@localhost ~]# dd if=/dev/hdb of=/root/image
[root@localhost ~]# dd if=/root/image of=/dev/hdb
[root@localhost ~]# dd if=/dev/hda of=/root/image count=1 bs=512
[root@localhost ~]# dd if=/root/image of=/dev/had
把/dev/null看做"黑洞", 它等價於一個只寫文件,全部寫入它的內容都會永遠丟失.,而嘗試從它那兒讀取內容則什麼也讀不到。然而, /dev/null對命令行和腳本都很是的有用。
[root@localhost ~]# echo "aaaa"
[root@localhost ~]# echo "aaaa" >/dev/null
cat: aaaaa: No such file or directory
[root@localhost ~]# cat aaaaa 2>/dev/null
[root@localhost tmp]# cat root
[root@localhost tmp]# cat calf
cat: calf: No such file or directory
[root@localhost tmp]# cat root calf >/dev/null 2>/dev/null
[root@localhost tmp]# cat /dev/null >root
[root@localhost tmp]# cat root
/dev/zero也是一個僞文件, 但它實際上產生接二連三的null的流(二進制的零流,而不是ASCII型的)。 /dev/zero主要的用處是用來建立一個指定長度用於初始化的空文件,就像臨時交換文件。
[root@localhost tmp]# dd if=/dev/zero of=test bs=1M count=10
10485760 bytes (10 MB) copied, 0.021191 s, 495 MB/s
l 壓縮指令爲透過一些運算方法去將本來的檔案進行壓縮,以減小檔案所佔用的磁盤容量。
l 壓縮文件案的擴展名大可能是:『*.gz, *.bz2, *.xz, *.tar, *.tar.gz, *.tar.bz2, *.tar.xz』
l 常見的壓縮指令有 gzip, bzip2, xz。壓縮率最佳的是 xz。