1. 백업/ 복구 명령어 종류
백업 명령어의 특징
- 디렉토리 단위의 백업
- tar 명령어 : 마운트된 파일 시스템 내에서 백업하는 명령어
- cpio 명령어 : 마운트된 파일 시스템 내에서 백업하는 명령어
- 파일 시스템 단위의 백업
- dump/ restore : 명령어 파일 시스템 단위 (파티션 단위)로 백업하는 명령어
- 디스크 단위의 백업
- dd 명령어 : 디스크 마이그레이션 (Migration)하는 명령어
2. tar (Tape ARchive) 명령어
∇ tar 명령어 기본 형식
# tar cvf file.tar file1 file2 file3 ( # tar cvf /dev/rmt0 /home)
# tar tvf file.tar
# tar xvf file.tar
∇ (백업/복구 방법) 백업 시 상대경로/ 절대 경로
※ (주의) - 백업 받을 당시에 되도록 상대경로를 통해 백업을 진행할 것을 권장
- (상대경로) 백업 시 상대경로를 사용하는 경우와 복원 방법
: 현재 폴더를 파일로 만들겠다!
# cd /home
# tar cf /mnt/backup/home-backup.tar . ( # tar cfz /mnt/backup/home-backup.tar.gz .)
# cd /home
# tar xf /mnt/backup/home-backup.tar
- (절대경로) 백업 시 절대 경로를 사용하는 경우와 복원 방법
# tar cf /mnt/backup/home-backup.tar /home
복원할 때 최상위 폴더로 가서 복원을 해주어야 같은 위치에 복원이 됨
#cd /
# tar xf /mnt/backup/home-backup.tar
== 상대경로로 백업하면 상대경로로 풀고, 절대 경로로 백업하면 절대경로로 풀면 된다
∇ tar 명령어 옵션
| OPTIONS -c, --create create a new archive -f, --file=ARCHIVE use archive file or device ARCHIVE -z, --gzip, --gunzip, --ungzip filter the archive through gzip -t, --list list the contents of an archive -x, --extract, --get extract files from an archive -g, --listed-incremental=FILE handle new GNU-format incremental backup -G, --incremental handle old GNU-format incremental backup -j, --bzip2 filter the archive through bzip2 -p, --preserve-permissions, extract permissions information --same-permissions |
3. tar 명령어를 이용한 풀 백업(Full Backup) & 증분 백업 (Incremental Backup)
매일 증가하는 데이터가 큰 서버에서 풀 백업을 매일 같이 받는 방법은 좋은 방법이 아님
중간에 적당히 증분 백업을 섞어 쓰는 방법이 좋음
∇ tar 명령어를 통해 풀 백업과 증분 백업을 적당하게 섞어 쓰는 방법
Target Directory : /home
# tar cvzf /bakcup/home _'date + %m%d'.tar.gz /home
(백업 방법)
- 풀백업 (Full Backup) 방법
# cd /home
# tar -g /backup/2021-09-15.list -cvzf /backup/2021-09-14-full.tar.gz .
- 증분백업 (Incremental Backup) 방법
# cd /home
# tar -g /bakcup/2021-09-14.list -czvf /bakcup/2021-09-14.tar.gz .
(복구 방법)
- 풀백업 (Full Backup) 복구 방법
# cd /home
# tar -g /backup/2021-09-14.list -xzvf /backup/2021-09-14/full.tar.gz
- 증분백업 (Incremental Backup) 복구 방법
# cd /home
# tar -g /backup/2021-09-14.list -xzvf /backup/2021-09-14.tar.gz
'Linux > 2) 리눅스 서버 관리자 과정' 카테고리의 다른 글
| 12_2 백업과 복구 - 백업 종류 (Backup Type) (0) | 2021.09.15 |
|---|---|
| 12_1 백업과 복구 - 백업의 개요 (0) | 2021.09.15 |
| 10_01-10 User & Group Administration - useradd 명령어 실행 시 사용되는 기본 설정 값 변경 (0) | 2021.08.31 |
| 10_01-09 User & Group Administration - 다중 사용자 추가 스크립트 제작 (0) | 2021.08.31 |
| 10_01-08 User & Group Administration - 홈계정 생성 시 참조되는 디렉토리 (/etc/skel) 및 파일 (0) | 2021.08.31 |