1. Aim of the Experiment
tar, gzip, rsync, and listing archive contents (indexing).
2. System & Tool Requirements
- Operating System: Any Linux Distribution (Ubuntu / Debian / RHEL / CentOS)
- Terminal: Command Line Interface (CLI) with standard privileges
- Directory Structure: Sample source files, logs, and a designated backup destination folder
- Core Utilities:
tar,gzip,rsync,cp,ls
3. Step-by-Step Procedure & Commands
SECTION A: Preparing Sample Source Files & Index
1. Create a workspace directory, generate test files, and build an initial file index (file_index.txt):
mkdir -p ~/ictsm_data/backup_destination
cd ~/ictsm_data
touch doc1.txt doc2.txt data_log.log
# Generate index file listing all source contents
ls -la doc1.txt doc2.txt data_log.log > file_index.txt
cat file_index.txt
SECTION B: Archiving & Compressing Files using tar & gzip
2. Bundle files and index into a compressed tarball archive:
tar -czvf system_backup.tar.gz *.txt *.log
# Verify and view indexed contents inside archive without extracting
tar -tzvf system_backup.tar.gz
SECTION C: Performing Synchronization & File Copy Backups
3. Copy archives and perform incremental directory backup using rsync:
cp system_backup.tar.gz ~/ictsm_data/backup_destination/
# Perform sync backup preserving permissions & timestamps
rsync -avz ~/ictsm_data/ ~/ictsm_data/backup_destination/
# Verify contents in target directory
ls -lh ~/ictsm_data/backup_destination/
4. Observation & Practical Log
| S.No | Task Objective | Command Executed | Status / Output Observation |
|---|---|---|---|
| 1 | Generate File Index | ls -la > file_index.txt |
Index file created listing file names & permissions |
| 2 | Create Tar Archive | tar -czvf system_backup.tar.gz ... |
Compressed archive created successfully |
| 3 | List Archive Contents | tar -tzvf system_backup.tar.gz |
Archive file index displayed on terminal |
| 4 | Copy Backup File | cp system_backup.tar.gz ~/backup_destination/ |
Archive moved to secondary folder |
| 5 | Directory Sync Backup | rsync -avz ~/ictsm_data/ ~/backup_destination/ |
Incremental file backup completed cleanly |
5. Viva-Voce / Oral Examination Preparation
Q1. What do the flags -czvf stand for in the tar command?
Ans: -c creates a new archive, -z compresses it using gzip, -v enables verbose mode to display process details, and -f specifies the output filename.
Q2. How do you view the indexed list of files inside a .tar.gz file without extracting it?
Ans: By executing tar -tzvf filename.tar.gz, where the -t flag tells tar to list/index the contents of the archive.
Q3. Why is rsync preferred over cp for large file system backups?
Ans: rsync uses a delta-transfer algorithm to copy only modified or new files (incremental backup), saving network bandwidth, time, and computational resources while preserving file metadata.
0 Comments
If you have any doubts, please let me know