
そこで、次のコマンドを使用して VPS の完全バックアップを実行しています (もちろん、root として)。
tar czvf 20120604.tar.gz /
すべて問題ないようです。すべてのファイルがリストに表示されているようです。アーカイブのサイズは 6 Gb で、gunzip されたバージョンは 11 Gb です/home
。これには が含まれます。VPS には合計 11 Gb のデータがあるからです。しかし、実際にアーカイブを解凍しようとしたり、mc または WinRAR を使用して開こうとすると、/home フォルダーがありません。そして、WinRAR は と表示します。 と入力しても、フォルダーは解凍されない20120604.tar.gz - TAR+GZIP archive, unpacked size 894 841 346 bytes
ので、これは WinRAR のバグではあり得ません。tar xzvf 20120604.tar.gz
/home
/home
アーカイブからフォルダーが消えたのはなぜですか? フォルダーをアーカイブに含めるにはどうすればよいですか?
tar --version
出力は次のようになります。tar (GNU tar) 1.15.1
答え1
/home
tar でバックアップしたディレクトリが除外されているのは、root として実行した結果である可能性が高いと思います(root のホームディレクトリは です/root/
)。man ページをざっと見てみると (http://linux.die.net/man/1/tar)、次のオプション5月状況の原因/解決/デバッグの可能性:
Main operation mode:
-C, --directory=DIR
change to directory DIR
-p, --preserve-permissions
extract information about file permissions (default for superuser)
-v, --verbose
verbosely list files processed
Operation modifiers:
-g, --listed-incremental=FILE
handle new GNU-format incremental backup
-G, --incremental
handle old GNU-format incremental backup
Handling of file attributes:
--group=NAME
force NAME as group for added files
--mode=CHANGES
force (symbolic) mode CHANGES for added files
--no-same-owner
extract files as yourself (default for ordinary users)
--no-same-permissions
apply the user's umask when extracting permissions from the archive (default for ordinary users)
--no-xattrs
Don't extract the user/root xattrs from the archive
--numeric-owner
always use numbers for user/group names
--owner=NAME
force NAME as owner for added files
-p, --preserve-permissions, --same-permissions
extract information about file permissions (default for superuser)
--same-owner
try extracting files with the same ownership as exists in the archive (default for superuser)
--xattrs
Save the user/root xattrs to the archive
Device selection and switching:
--force-local
archive file is local even if it has a colon
Archive format selection:
-H, --format=FORMAT
create archive of the given format--FORMAT is one of the following:
gnu, oldgnu, pax, posix, ustar, v7, --old-archive, --portability,
--pax-option=keyword[[:]=value][,keyword[[:]=value]]... , --posix,
-V, --label=TEXT
<see webpage/ man page for details>
Local file selection:
--add-file=FILE
add given FILE to the archive (useful if its name starts with a dash)
-C, --directory=DIR
change to directory DIR
-h, --dereference
follow symlinks; archive and dump the files they point to
--hard-dereference
follow hard links; archive and dump the files they refer to
-K, --starting-file=MEMBER-NAME
begin at member MEMBER-NAME in the archive
--one-file-system
stay in local file system when creating archive
-P, --absolute-names
don't strip leading '/'s from file names
--recursion
recurse into directories (default)
File name transformations:
--no-anchored
patterns match after any '/' (default for exclusion)
--no-ignore-case
case sensitive matching (default)
--no-wildcards
verbatim string matching
--no-wildcards-match-slash
wildcards do not match '/'
--wildcards
use wildcards (default)
--wildcards-match-slash
wildcards match '/' (default for exclusion)
Informative output:
--index-file=FILE
send verbose output to FILE
-l, --check-links
print a message if not all links are dumped
--show-defaults
show tar defaults
--show-omitted-dirs
when listing or extracting, list each directory that does not match search criteria
--show-transformed-names, --show-stored-names
show file or archive names after transformation
-v, --verbose
verbosely list files processed
-w, --interactive, --confirmation
ask for confirmation for every action
確かに考慮すべきことはたくさんありますが、Linux コマンドは柔軟で強力です。制限されたファイルシステム構造を持つテスト ボックスを使用して、使用する予定のディストリビューションを実行し、これらの各オプションを調査すると、スクリプトに含める正確な組み合わせがわかり、希望どおりの結果が得られると思います。
共通の知識を構築するために、希望する動作を実現する解決策を投稿していただけますか?