![tar로 생성된 백업 아카이브에서 /home 폴더가 누락되는 이유는 무엇입니까?](https://rvso.com/image/1317149/tar%EB%A1%9C%20%EC%83%9D%EC%84%B1%EB%90%9C%20%EB%B0%B1%EC%97%85%20%EC%95%84%EC%B9%B4%EC%9D%B4%EB%B8%8C%EC%97%90%EC%84%9C%20%2Fhome%20%ED%8F%B4%EB%8D%94%EA%B0%80%20%EB%88%84%EB%9D%BD%EB%90%98%EB%8A%94%20%EC%9D%B4%EC%9C%A0%EB%8A%94%20%EB%AC%B4%EC%97%87%EC%9E%85%EB%8B%88%EA%B9%8C%3F.png)
따라서 다음 명령을 사용하여(물론 루트로) VPS의 전체 백업을 수행하고 있습니다.
tar czvf 20120604.tar.gz /
모든 것이 괜찮은 것 같고 모든 파일이 목록에 나타나는 것 같습니다. /home
VPS에 총 11GB의 데이터가 있기 때문에 아카이브 크기는 6Gb이고 gunzip 버전은 을 포함하는 11Gb입니다 . 하지만 실제로 아카이브의 압축을 풀거나 mc 또는 WinRAR을 사용하여 열려고 하면 /home 폴더가 없습니다. 그리고 WinRAR은 20120604.tar.gz - TAR+GZIP archive, unpacked size 894 841 346 bytes
. 를 입력 tar xzvf 20120604.tar.gz
해도 /home
폴더의 압축이 풀리지 않기 때문에 WinRAR의 버그일 수 없습니다 .
/home
내 아카이브에서 폴더가 누락된 이유는 무엇입니까 ? 그리고 그것을 거기에 포함시키려면 어떻게 해야 합니까?
tar --version
다음을 출력합니다:tar (GNU tar) 1.15.1
답변1
/home
tar 백업에서 디렉토리를 제외하는 것은 루트(루트의 홈 디렉토리)로 실행한 결과라고 의심됩니다 /root/
. 매뉴얼 페이지 살펴보기(다음에서 가져옴)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 명령은 유연하고 강력하지 않으면 아무 것도 아닙니다. 제한된 파일 시스템 구조의 테스트 상자를 사용하여 이러한 옵션 각각을 연구하고 사용하려는 배포판을 실행하면 원하는 정확한 결과를 생성하기 위해 스크립트에 포함할 정확한 조합을 찾을 수 있을 것입니다.
공동 지식을 구축하기 위해 원하는 동작을 제공하는 솔루션을 다시 게시해 주시겠습니까?