Prochaine révision | Révision précédente |
elearning:workbooks:redhat:rh124en:l108 [2024/11/11 15:40] – created admin | elearning:workbooks:redhat:rh124en:l108 [2024/11/27 13:29] (Version actuelle) – admin |
---|
* Classic Backup Tools | * Classic Backup Tools |
* Preparation | * Preparation |
* The Tar Command | * The tar Command |
* Overview | * Overview |
* LAB #1 - Working with the tar command | * LAB #1 - Working with the tar command |
* The GPL tar command and compression | * The GPL tar command and compression |
* The cpio command | * The cpio Command |
* Overview | * Overview |
* LAB #2 - Working with the cpio command | * LAB #2 - Working with the cpio command |
* Multidirectional Backup Tools | * Multidirectional Backup Tools |
* Partition Backup Tools | * Partition Backup Tools |
* LAB #4 - What to Backup First | * LAB #4 - What to Backup First |
* Packet List Backup | * Package List Backup |
* Backing up the System Hard Disk Structure | * Backing up the System Hard Disk Structure |
* Backing up the System Hard Disk Mounting Points | * Backing up the System Hard Disk Mounting Points |
* Boot Loader Backup | * Boot Loader Backup |
* GRUB Legacy | * GRUB Legacy |
* GRUB 2 with BIOS | * GRUB 2 with BIOS |
* GRUB 2 with EFI | * GRUB 2 with EFI |
* User Directories Backups | * User Directories Backups |
* The Rsync Command | * The Rsync Command |
* Overview | * Overview |
* LAB #5 - Working with the rsync command | * LAB #5 - Working with the rsync command |
* Compression | * Compression |
* The gzip command | * The gzip command |
* LAB #7 - Working with the bzip2 command | * LAB #7 - Working with the bzip2 command |
* The xz command | * The xz command |
command * Overview | * Overview |
* LAB #8 - Working with the xz command | * LAB #8 - Working with the xz command |
* Other utilities | * Other utilities |
====Preparation==== | ====Preparation==== |
| |
To continue, we need to create a tree structure to be backed up: | Before proceeding further, you need to create some files and directories to backup and archive: |
| |
<code> | <code> |
</code> | </code> |
| |
====The tar command ==== | ====The tar Command ==== |
| |
===Overview=== | ===Overview=== |
The **tar** program was originally intended for backing up to magnetic tape, hence its name from **tape archiver**. | The **tar** program was originally intended for backing up to magnetic tape, hence its name from **tape archiver**. |
| |
The **tar** command can save to : | The **tar** command can be used to archive or back-up files to: |
| |
* a special file, for example the name of a tape drive, | * a special file, for example the name of a tape drive, |
* an ordinary file on disk, | * an ordinary file on disk, |
* standard output for use in a pipe. | * standard output for use in a pipe. |
| |
| ===LAB #1 - Working with the tar command=== |
| |
| You can now proceed with the back-up of the directory **test** and it's contents to an ordinary file: |
| |
| <code> |
| [root@redhat9 dirZ]# tar cvf /tmp/test.tar /test |
| tar: Removing leading `/' from member names |
| /test/ |
| /test/dirY/ |
| /test/dirY/Y1 |
| /test/dirY/Y2 |
| /test/dirY/Y3 |
| /test/dirZ/ |
| /test/dirZ/Z1 |
| /test/dirZ/Z2 |
| </code> |
| |
| To view the **table of contents** of your backup, use the following command: |
| |
| <code> |
| [root@redhat9 dirZ]# tar tvf /tmp/test.tar |
| drwxr-xr-x root/root 0 2024-09-27 07:51 test/ |
| drwxr-xr-x root/root 0 2024-09-27 07:51 test/dirY/ |
| -rw-r--r-- root/root 0 2024-09-27 07:51 test/dirY/Y1 |
| -rw-r--r-- root/root 0 2024-09-27 07:51 test/dirY/Y2 |
| -rw-r--r-- root/root 0 2024-09-27 07:51 test/dirY/Y3 |
| drwxr-xr-x root/root 0 2024-09-27 07:51 test/dirZ/ |
| -rw-r--r-- root/root 0 2024-09-27 07:51 test/dirZ/Z1 |
| -rw-r--r-- root/root 0 2024-09-27 07:51 test/dirZ/Z2 |
| </code> |
| |
| In order to create an incremental back-up, you now need to create an empty file to be used as a time reference file. All files modified or created after the creation of this file will be included in the incremental archive: |
| |
| <code> |
| [root@redhat9 dirZ]# touch /tmp/dateref |
| </code> |
| |
| Now modify two of the files in your **test** tree: |
| |
| <code> |
| [root@redhat9 dirZ]# echo ‘CentOS is great!’ > /test/dirY/Y1 |
| |
| [root@redhat9 dirZ]# echo ‘RHEL is wonderful!’ > /test/dirZ/Z1 |
| </code> |
| |
| To perform your incremental backup, you need to back up only the files modified or created since the creation of your **/tmp/dateref** file. |
| |
| Enter the following command: |
| |
| <code> |
| [root@redhat9 dirZ]# tar -cvf /tmp/incremental.tar -N /tmp/dateref /test |
| tar: Removing leading `/' from member names |
| /test/ |
| /test/dirY/ |
| /test/dirY/Y1 |
| tar: /test/dirY/Y2: file is unchanged; not dumped |
| tar: /test/dirY/Y3: file is unchanged; not dumped |
| /test/dirZ/ |
| /test/dirZ/Z1 |
| tar: /test/dirZ/Z2: file is unchanged; not dumped |
| </code> |
| |
| <WRAP center round important 60%> |
| **Important** - Note the use of the **-N** option with the **/tmp/dateref** argument, which identifies files modified or created since **/tmp/dateref** was created. |
| </WRAP> |
| |
| Now check the contents of the **/tmp/incremental.tar** archive: |
| |
| <code> |
| [root@redhat9 dirZ]# tar tvf /tmp/incremental.tar |
| drwxr-xr-x root/root 0 2024-09-27 07:51 test/ |
| drwxr-xr-x root/root 0 2024-09-27 07:51 test/dirY/ |
| -rw-r--r-- root/root 20 2024-09-27 07:58 test/dirY/Y1 |
| drwxr-xr-x root/root 0 2024-09-27 07:51 test/dirZ/ |
| -rw-r--r-- root/root 21 2024-09-27 07:58 test/dirZ/Z1 |
| </code> |
| |
| Now delete the contents of the **test** directory: |
| |
| <code> |
| [root@redhat9 dirZ]# rm -rf /test/* |
| </code> |
| |
| <WRAP center round important 60%> |
| **Important** - Note that the system allows you to delete the **/test/dirZ** directory, yet you are located in this very directory! |
| </WRAP> |
| |
| In order to restore the files from your first backup, go to the root of your system and restore the contents of your **test** directory by entering the following tar command: |
| |
| <code> |
| [root@redhat9 ~]# cd / |
| [root@redhat9 /]# tar xvf /tmp/test.tar |
| test/ |
| test/dirY/ |
| test/dirY/Y1 |
| test/dirY/Y2 |
| test/dirY/Y3 |
| test/dirZ/ |
| test/dirZ/Z1 |
| test/dirZ/Z2 |
| </code> |
| |
| Using the **ls** command, you can check that the contents of the **test** directory have been restored: |
| |
| <code> |
| root@redhat9 /]# ls -lR /test |
| /test: |
| total 0 |
| drwxr-xr-x. 2 root root 36 Sep 27 07:51 dirY |
| drwxr-xr-x. 2 root root 26 Sep 27 07:51 dirZ |
| |
| /test/dirY: |
| total 0 |
| -rw-r--r--. 1 root root 0 Sep 27 07:51 Y1 |
| -rw-r--r--. 1 root root 0 Sep 27 07:51 Y2 |
| -rw-r--r--. 1 root root 0 Sep 27 07:51 Y3 |
| |
| /test/dirZ: |
| total 0 |
| -rw-r--r--. 1 root root 0 Sep 27 07:51 Z1 |
| -rw-r--r--. 1 root root 0 Sep 27 07:51 Z2 |
| </code> |
| |
| <WRAP center round important 60%> |
| **Important** - Note that at this point the **/test/dirY/Y1** and **/test/dirZ/Z1** files are empty. |
| </WRAP> |
| |
| Now restore your incremental archive: |
| |
| <code> |
| [root@redhat9 /]# tar xvf /tmp/incremental.tar |
| test/ |
| test/dirY/ |
| test/dirY/Y1 |
| test/dirZ/ |
| test/dirZ/Z1 |
| </code> |
| |
| Using the **ls** command, you can check that the contents of incremental.tar have been restored: |
| |
| <code> |
| [root@redhat9 /]# ls -lR /test |
| /test: |
| total 0 |
| drwxr-xr-x. 2 root root 36 Sep 27 07:51 dirY |
| drwxr-xr-x. 2 root root 26 Sep 27 07:51 dirZ |
| |
| /test/dirY: |
| total 4 |
| -rw-r--r--. 1 root root 20 Sep 27 07:58 Y1 |
| -rw-r--r--. 1 root root 0 Sep 27 07:51 Y2 |
| -rw-r--r--. 1 root root 0 Sep 27 07:51 Y3 |
| |
| /test/dirZ: |
| total 4 |
| -rw-r--r--. 1 root root 21 Sep 27 07:58 Z1 |
| -rw-r--r--. 1 root root 0 Sep 27 07:51 Z2 |
| </code> |
| |
| <WRAP center round important 60%> |
| **Important** - Note that the **/test/dirY/Y1** and **/test/dirZ/Z1** files are now non-empty. |
| </WRAP> |
| |
| ===The GPL tar command and compression=== |
| |
| Lastly, the tar command can archive using compression algorithms: |
| |
| ^ Algorithm ^ tar command option ^ |
| | gzip | z | |
| | bzip2 | j | |
| | lzma | J | |
| |
===Command Line Switches=== | ===Command Line Switches=== |
| |
The options for the tar command are: | The command line switches for the tar command are: |
| |
<code> | <code> |
</code> | </code> |
| |
===LAB #1 - Working with the tar command=== | ====The cpio Command==== |
| |
You will now save your **test** folder and its contents to a file: | ===Overview=== |
| |
<code> | The **cpio** (Copy Input To Output) command. cpio can handle archives in **tar** format. The major difference between tar and cpio is that the latter stores the paths to the saved files at the same time as the files themselves. This means that if the absolute path was specified at the time of backup, it is impossible to restore a file to a location other than its original location. |
[root@redhat9 dirZ]# tar cvf /tmp/test.tar /test | |
tar: Removing leading `/' from member names | |
/test/ | |
/test/dirY/ | |
/test/dirY/Y1 | |
/test/dirY/Y2 | |
/test/dirY/Y3 | |
/test/dirZ/ | |
/test/dirZ/Z1 | |
/test/dirZ/Z2 | |
</code> | |
| |
To view the **table of contents** of your backup, use the following command: | You will now use the **cpio** software to perform backups and restores. |
| |
<code> | ===LAB #2 - Working with the cpio command=== |
[root@redhat9 dirZ]# tar tvf /tmp/test.tar | |
drwxr-xr-x root/root 0 2024-09-27 07:51 test/ | |
drwxr-xr-x root/root 0 2024-09-27 07:51 test/dirY/ | |
-rw-r--r-- root/root 0 2024-09-27 07:51 test/dirY/Y1 | |
-rw-r--r-- root/root 0 2024-09-27 07:51 test/dirY/Y2 | |
-rw-r--r-- root/root 0 2024-09-27 07:51 test/dirY/Y3 | |
drwxr-xr-x root/root 0 2024-09-27 07:51 test/dirZ/ | |
-rw-r--r-- root/root 0 2024-09-27 07:51 test/dirZ/Z1 | |
-rw-r--r-- root/root 0 2024-09-27 07:51 test/dirZ/Z2 | |
</code> | |
| |
In order to create an incremental backup, you need to create a file that will serve as a time reference: | As a first step, you need to use the **find** command to build a list of files to back up: |
| |
<code> | <code> |
[root@redhat9 dirZ]# touch /tmp/dateref | [root@redhat9 /]# find /test > /tmp/cpio.list |
| [root@redhat9 /]# cat /tmp/cpio.list |
| /test |
| /test/dirY |
| /test/dirY/Y2 |
| /test/dirY/Y3 |
| /test/dirY/Y1 |
| /test/dirZ |
| /test/dirZ/Z2 |
| /test/dirZ/Z1 |
</code> | </code> |
| |
Now modify two of the files in your **test** tree: | Now back up the files and directories referenced by the **/tmp/cpio.list** file: |
| |
<code> | <code> |
[root@redhat9 dirZ]# echo ‘CentOS is great!’ > /test/dirY/Y1 | [root@redhat9 /]# cpio -ov < /tmp/cpio.list > /tmp/test.cpio |
| /test |
[root@redhat9 dirZ]# echo ‘RHEL is wonderful!’ > /test/dirZ/Z1 | /test/dirY |
| /test/dirY/Y2 |
| /test/dirY/Y3 |
| /test/dirY/Y1 |
| /test/dirZ |
| /test/dirZ/Z2 |
| /test/dirZ/Z1 |
| 1 block |
</code> | </code> |
| |
To perform your incremental backup, you need to back up only the files modified or created since the creation of your **/tmp/dateref** file. | Now look at the **table of contents** of your backup: |
| |
So enter the following command: | |
| |
<code> | <code> |
[root@redhat9 dirZ]# tar -cvf /tmp/incremental.tar -N /tmp/dateref /test | [root@redhat9 /]# cpio -it < /tmp/test.cpio |
tar: Removing leading `/' from member names | /test |
/test/ | /test/dirY |
/test/dirY/ | /test/dirY/Y2 |
| /test/dirY/Y3 |
/test/dirY/Y1 | /test/dirY/Y1 |
tar: /test/dirY/Y2: file is unchanged; not dumped | /test/dirZ |
tar: /test/dirY/Y3: file is unchanged; not dumped | /test/dirZ/Z2 |
/test/dirZ/ | |
/test/dirZ/Z1 | /test/dirZ/Z1 |
tar: /test/dirZ/Z2: file is unchanged; not dumped | 1 block |
</code> | </code> |
| |
<WRAP center round important 60%> | Now delete the **/test/dirY** directory and its contents: |
**Important** - Note the use of the **-N** option with the **/tmp/dateref** argument, which identifies files modified or created since **/tmp/dateref** was created. | |
</WRAP> | |
| |
Now check the contents of the **/tmp/incremental.tar** archive: | |
| |
<code> | <code> |
[root@redhat9 dirZ]# tar tvf /tmp/incremental.tar | [root@redhat9 /]# rm -rf /test/dirY |
drwxr-xr-x root/root 0 2024-09-27 07:51 test/ | |
drwxr-xr-x root/root 0 2024-09-27 07:51 test/dirY/ | |
-rw-r--r-- root/root 20 2024-09-27 07:58 test/dirY/Y1 | |
drwxr-xr-x root/root 0 2024-09-27 07:51 test/dirZ/ | |
-rw-r--r-- root/root 21 2024-09-27 07:58 test/dirZ/Z1 | |
</code> | </code> |
| |
Now delete the contents of the **test** directory: | Check that the deletion is successful: |
| |
<code> | <code> |
[root@redhat9 ~]# rm -rf /test/* | [root@redhat9 /]# ls -lR /test |
</code> | |
| |
<WRAP center round important 60%> | |
**Important** - Note that the system allows you to delete the **/test/dirZ** directory, yet you are located in this very directory! | |
</WRAP> | |
| |
In order to restore the files from your first backup, go to the root of your system and restore the contents of your **test** directory by entering the following tar command: | |
| |
<code> | |
[root@redhat9 ~]# cd / | |
[root@redhat9 /]# tar xvf /tmp/test.tar | |
test/ | |
test/dirY/ | |
test/dirY/Y1 | |
test/dirY/Y2 | |
test/dirY/Y3 | |
test/dirZ/ | |
test/dirZ/Z1 | |
test/dirZ/Z2 | |
</code> | |
| |
Now note that the operation went well: | |
| |
<code> | |
root@redhat9 /]# ls -lR /test | |
/test: | /test: |
total 0 | total 0 |
drwxr-xr-x. 2 root root 36 Sep 27 07:51 dirY | |
drwxr-xr-x. 2 root root 26 Sep 27 07:51 dirZ | drwxr-xr-x. 2 root root 26 Sep 27 07:51 dirZ |
| |
/test/dirY: | |
total 0 | |
-rw-r--r--. 1 root root 0 Sep 27 07:51 Y1 | |
-rw-r--r--. 1 root root 0 Sep 27 07:51 Y2 | |
-rw-r--r--. 1 root root 0 Sep 27 07:51 Y3 | |
| |
/test/dirZ: | /test/dirZ: |
total 0 | total 4 |
-rw-r--r--. 1 root root 0 Sep 27 07:51 Z1 | -rw-r--r--. 1 root root 21 Sep 27 07:58 Z1 |
-rw-r--r--. 1 root root 0 Sep 27 07:51 Z2 | -rw-r--r--. 1 root root 0 Sep 27 07:51 Z2 |
</code> | </code> |
| |
<WRAP center round important 60%> | Restore the deleted files with the following command: |
**Important** - Note that at this point the **/test/dirY/Y1** and **/test/dirZ/Z1** files are empty. | |
</WRAP> | |
| |
Now restore your incremental archive: | |
| |
<code> | <code> |
[root@redhat9 /]# tar xvf /tmp/incremental.tar | [root@redhat9 /]# cpio -ivdum ‘/test/dirY/*’ < /tmp/test.cpio |
test/ | /test/dirY/Y2 |
test/dirY/ | /test/dirY/Y3 |
test/dirY/Y1 | /test/dirY/Y1 |
test/dirZ/ | 1 block |
test/dirZ/Z1 | |
</code> | </code> |
| |
Now note that the operation has gone well: | <WRAP center round important 60%> |
| **Important** - Note the use of the string **‘/test/dirY/*’** which searches only the **dirY** directory as well as the **Y1**, **Y2** and **Y3** files in the test.cpio archive. |
| </WRAP> |
| |
| Using the **ls** command, you can check that the contents of repY have been restored: |
| |
<code> | <code> |
/test: | /test: |
total 0 | total 0 |
drwxr-xr-x. 2 root root 36 Sep 27 07:51 dirY | drwxr-xr-x. 2 root root 36 Sep 27 08:10 dirY |
drwxr-xr-x. 2 root root 26 Sep 27 07:51 dirZ | drwxr-xr-x. 2 root root 26 Sep 27 07:51 dirZ |
| |
-rw-r--r--. 1 root root 0 Sep 27 07:51 Z2 | -rw-r--r--. 1 root root 0 Sep 27 07:51 Z2 |
</code> | </code> |
| |
<WRAP center round important 60%> | |
**Important** - Note that the **/test/dirY/Y1** and **/test/dirZ/Z1** files are now non-empty. | |
</WRAP> | |
| |
===The GPL tar command and compression=== | |
| |
Lastly, the tar command can archive using compression algorithms: | |
| |
^ Algorithm ^ tar command option ^ | |
| gzip | z | | |
| bzip2 | j | | |
| lzma | J | | |
| |
====The cpio command==== | |
| |
===Introduction=== | |
| |
The **cpio** (Copy Input To Output) command. cpio can handle archives in **tar** format. The major difference between tar and cpio is that the latter stores the paths to the saved files at the same time as the files themselves. This means that if the absolute path was specified at the time of backup, it is impossible to restore a file to a location other than its original location. | |
| |
You will now use the **cpio** software to perform backups and restores. | |
| |
===Command Line Switches=== | ===Command Line Switches=== |
| |
The options for the **cpio** command are: | The command line switches for the **cpio** command are: |
| |
<code> | <code> |
</code> | </code> |
| |
===LAB #2 - Working with the cpio command=== | ====The dd command ==== |
| |
As a first step, you need to use the **find** command to build a list of files to back up: | ===Overview=== |
| |
<code> | The **dd** command is not actually a backup command. |
[root@redhat9 /]# find /test > /tmp/cpio.list | |
[root@redhat9 /]# cat /tmp/cpio.list | |
/test | |
/test/dirY | |
/test/dirY/Y2 | |
/test/dirY/Y3 | |
/test/dirY/Y1 | |
/test/dirZ | |
/test/dirZ/Z2 | |
/test/dirZ/Z1 | |
</code> | |
| |
Now back up the files and directories referenced by the **/tmp/cpio.list** file: | The **dd** command copies the file passed as input to the output file, limiting the number of bytes copied by using two command line switches: |
| |
<code> | * **count** |
[root@redhat9 /]# cpio -ov < /tmp/cpio.list > /tmp/test.cpio | * the number of blocks |
/test | * **bs** |
/test/dirY | * the size of each block |
/test/dirY/Y2 | |
/test/dirY/Y3 | |
/test/dirY/Y1 | |
/test/dirZ | |
/test/dirZ/Z2 | |
/test/dirZ/Z1 | |
1 block | |
</code> | |
| |
Now look at the **table of contents** of your backup: | ===LAB #3 - Working with the dd command=== |
| |
<code> | You will now use **dd** to make a backup of your MBR and partition table. |
[root@redhat9 /]# cpio -it < /tmp/test.cpio | |
/test | |
/test/dirY | |
/test/dirY/Y2 | |
/test/dirY/Y3 | |
/test/dirY/Y1 | |
/test/dirZ | |
/test/dirZ/Z2 | |
/test/dirZ/Z1 | |
1 block | |
</code> | |
| |
Now delete the **/test/dirY** directory and its contents: | Make a backup of your MBR, which is located in the first 446 bytes of your **/dev/sda** disk: |
| |
<code> | <code> |
[root@redhat9 /]# rm -rf /test/dirY | [root@redhat9 /]# dd if=/dev/sda of=/tmp/mbr.save bs=1 count=446 |
| 446+0 records in |
| 446+0 records out |
| 446 bytes copied, 0.00114645 s, 389 kB/s |
</code> | </code> |
| |
Check that the deletion is successful: | Now make a backup of your partition table which is in the 64 bytes after the 446 previously saved: |
| |
<code> | <code> |
[root@redhat9 /]# ls -lR /test | [root@redhat9 /]# dd if=/dev/sda of=/tmp/tblpart.save bs=1 count=64 skip=446 |
/test: | 64+0 records in |
total 0 | 64+0 records out |
drwxr-xr-x. 2 root root 26 Sep 27 07:51 dirZ | 64 bytes copied, 0.000282251 s, 227 kB/s |
| |
/test/dirZ: | |
total 4 | |
-rw-r--r--. 1 root root 21 Sep 27 07:58 Z1 | |
-rw-r--r--. 1 root root 0 Sep 27 07:51 Z2 | |
</code> | </code> |
| |
Restore deleted files: | <WRAP center round important 60%> |
| **Important** - Note the use of the **skip** option, which positions the start of the backup at the 447th byte. |
<code> | |
[root@redhat9 /]# cpio -ivdum ‘/test/dirY/*’ < /tmp/test.cpio | |
/test/dirY/Y2 | |
/test/dirY/Y3 | |
/test/dirY/Y1 | |
1 block | |
</code> | |
| |
<WRAP centre round important 60%> | |
**Important** - Note the use of the string **‘/test/dirY/*’** which searches only the **dirY** directory as well as the **Y1**, **Y2** and **Y3** files in the test.cpio archive. | |
</WRAP> | </WRAP> |
| |
Check that the status: | |
| |
<code> | |
[root@redhat9 /]# ls -lR /test | |
/test: | |
total 0 | |
drwxr-xr-x. 2 root root 36 Sep 27 08:10 dirY | |
drwxr-xr-x. 2 root root 26 Sep 27 07:51 dirZ | |
| |
/test/dirY: | |
total 4 | |
-rw-r--r--. 1 root root 20 Sep 27 07:58 Y1 | |
-rw-r--r--. 1 root root 0 Sep 27 07:51 Y2 | |
-rw-r--r--. 1 root root 0 Sep 27 07:51 Y3 | |
| |
/test/dirZ: | |
total 4 | |
-rw-r--r--. 1 root root 21 Sep 27 07:58 Z1 | |
-rw-r--r--. 1 root root 0 Sep 27 07:51 Z2 | |
</code> | |
| |
====The dd command ==== | |
| |
===Presentation=== | |
| |
The **dd** command is not actually a backup command. | |
| |
The **dd** command copies the file passed as input to the output file, limiting the number of bytes copied by using two options: | |
| |
* **count** | |
* the number | |
* **bs** | |
* the size of the block to be copied | |
| |
===Command Line Switches=== | ===Command Line Switches=== |
or available locally via: info ‘(coreutils) dd invocation’ | or available locally via: info ‘(coreutils) dd invocation’ |
</code> | </code> |
| |
===LAB #3 - Working with the dd command=== | |
| |
You will now use **dd** to make a backup of your MBR and partition table. | |
| |
Make a backup of your MBR, which is located in the first 446 bytes of your **/dev/sda** disk: | |
| |
<code> | |
[root@redhat9 /]# dd if=/dev/sda of=/tmp/mbr.save bs=1 count=446 | |
446+0 records in | |
446+0 records out | |
446 bytes copied, 0.00114645 s, 389 kB/s | |
</code> | |
| |
Now make a backup of your partition table which is in the 64 bytes after the 446 previously saved: | |
| |
<code> | |
[root@redhat9 /]# dd if=/dev/sda of=/tmp/tblpart.save bs=1 count=64 skip=446 | |
64+0 records in | |
64+0 records out | |
64 bytes copied, 0.000282251 s, 227 kB/s | |
</code> | |
| |
<WRAP centre round important 60%> | |
**Important** - Note the use of the **skip** option, which positions the start of the backup at the 447th byte. | |
</WRAP> | |
| |
====Dump and restore commands ==== | ====Dump and restore commands ==== |
| **[[https://en.wikipedia.org/wiki/Partimage|partimage]]** | C | GPL | 0.6.9 | 25/07/2010 | {{ :elearning:workbooks:debian:6:senior:accept.png?nolink |}} | {{ :elearning:workbooks:debian:6:senior:accept.png?nolink |}} | {{ :elearning:workbooks:debian:6:senior:cancel.png?nolink |}} | **[[http://www.partimage.org/|Partimage]]** | | | **[[https://en.wikipedia.org/wiki/Partimage|partimage]]** | C | GPL | 0.6.9 | 25/07/2010 | {{ :elearning:workbooks:debian:6:senior:accept.png?nolink |}} | {{ :elearning:workbooks:debian:6:senior:accept.png?nolink |}} | {{ :elearning:workbooks:debian:6:senior:cancel.png?nolink |}} | **[[http://www.partimage.org/|Partimage]]** | |
| |
====LAB #4 - What to Backup First ==== | ====LAB #4 - What to Backup ==== |
| |
===Backup the Package List=== | ===Backup the Package List=== |
</code> | </code> |
| |
To save the list of packages identically in terms of version, use the RPM command: | To backup a list of the installed RPM packages, use the following command: |
| |
<code> | <code> |
</code> | </code> |
| |
Check out the contents of this file: | Consult the contents of the file: |
| |
<code> | <code> |
</WRAP> | </WRAP> |
| |
In order to restore the backups, retrieve the two files **package-list_*** and **$(hostname).rpmdatabase.tar.gz** from the external media at the root of the file system: | In order to restore the backups, retrieve the two files **package-list_*** and **$(hostname).rpmdatabase.tar.gz** from the external media and place them at the root of the file system: |
| |
<code> | <code> |
</code> | </code> |
| |
Use YUM to restore packages: | Use dnf to restore packages: |
| |
<code> | <code> |
</WRAP> | </WRAP> |
| |
===Backing up the System Hard Disk Mounting Points=== | ===Backing up the System Hard Disk Mount Points=== |
| |
Enter the following command: | Enter the following command: |
| |
<code> | <code> |
[root@redhat9 ~]# df -h | grep ‘^/dev/’ > montages.list | [root@redhat9 ~]# df -h | grep "^/dev/" > mounts.list |
[root@redhat9 ~]# cat montages.list | [root@redhat9 ~]# cat mounts.list |
/dev/mapper/rhel-root 44G 7.8G 37G 18% / | /dev/mapper/rhel-root 44G 7.8G 37G 18% / |
/dev/sda1 1014M 398M 617M 40% /boot | /dev/sda1 1014M 398M 617M 40% /boot |
</code> | </code> |
| |
<WRAP center round important 60%> | <WRAP center round important 60%> |
**Important** - The **mountings.list** file should then be saved on external media. | **Important** - The **mounts.list** file should then be saved on external media. |
</WRAP> | </WRAP> |
| |
/home/trainee/.config/evolution/sources' -> ’./home/trainee/.config/evolution/sources | /home/trainee/.config/evolution/sources' -> ’./home/trainee/.config/evolution/sources |
/home/trainee/.config/evolution/sources/system-proxy.source' -> ’./home/trainee/.config/evolution/sources/system-proxy.source | /home/trainee/.config/evolution/sources/system-proxy.source' -> ’./home/trainee/.config/evolution/sources/system-proxy.source |
/home/trainee/.config/gtk-3.0' -> ’./home/trainee/.config/gtk-3.0 | ... |
‘/home/trainee/.config/gtk-3.0/bookmarks’ -> ‘./home/trainee/.config/gtk-3.0/bookmarks | |
‘/home/trainee/.config/.gsd-keyboard.settings-ported’ -> ‘./home/trainee/.config/.gsd-keyboard.settings-ported’ | |
‘/home/trainee/.config/gnome-initial-setup-done’ -> ‘./home/trainee/.config/gnome-initial-setup-done’ | |
/home/trainee/.config/goa-1.0' -> ’./home/trainee/.config/goa-1.0 | |
/home/trainee/.config/pulse' -> ’./home/trainee/.config/pulse | |
/home/trainee/.config/pulse/cookie' -> ’./home/trainee/.config/pulse/cookie | |
/home/trainee/.config/dconf' -> ’./home/trainee/.config/dconf | |
/home/trainee/.config/dconf/user' -> ’./home/trainee/.config/dconf/user | |
/home/trainee/codes' -> ’./home/trainee/codes | |
/home/trainee/codes/exit.txt' -> ’./home/trainee/codes/exit.txt | |
/home/trainee/.local' -> ’./home/trainee/.local | |
/home/trainee/.local/share' -> ’./home/trainee/.local/share | |
/home/trainee/.local/share/evolution' -> ’./home/trainee/.local/share/evolution | |
‘/home/trainee/.local/share/evolution/addressbook’ -> ‘./home/trainee/.local/share/evolution/addressbook’ | |
/home/trainee/.local/share/evolution/addressbook/system' -> ’./home/trainee/.local/share/evolution/addressbook/system | |
‘/home/trainee/.local/share/evolution/addressbook/system/contacts.db’ -> ‘./home/trainee/.local/share/evolution/addressbook/system/contacts.db | |
‘/home/trainee/.local/share/evolution/addressbook/system/photos’ -> ‘./home/trainee/.local/share/evolution/addressbook/system/photos’ | |
/home/trainee/.local/share/evolution/addressbook/trash' -> ’./home/trainee/.local/share/evolution/addressbook/trash | |
/home/trainee/.local/share/evolution/mail' -> ’./home/trainee/.local/share/evolution/mail | |
/home/trainee/.local/share/evolution/mail/trash' -> ’./home/trainee/.local/share/evolution/mail/trash | |
/home/trainee/.local/share/evolution/tasks' -> ’./home/trainee/.local/share/evolution/tasks | |
‘/home/trainee/.local/share/evolution/tasks/system’ -> ‘./home/trainee/.local/share/evolution/tasks/system’ | |
/home/trainee/.local/share/evolution/tasks/system/tasks.ics' -> ’./home/trainee/.local/share/evolution/tasks/system/tasks.ics | |
/home/trainee/.local/share/evolution/tasks/trash' -> ’./home/trainee/.local/share/evolution/tasks/trash | |
/home/trainee/.local/share/evolution/calendar' -> ’./home/trainee/.local/share/evolution/calendar | |
/home/trainee/.local/share/evolution/calendar/trash' -> ’./home/trainee/.local/share/evolution/calendar/trash | |
‘/home/trainee/.local/share/evolution/calendar/system’ -> ‘./home/trainee/.local/share/evolution/calendar/system’ | |
/home/trainee/.local/share/evolution/calendar/system/calendar.ics' -> ’./home/trainee/.local/share/evolution/calendar/system/calendar.ics | |
‘/home/trainee/.local/share/evolution/memos’ -> ‘./home/trainee/.local/share/evolution/memos’ | |
/home/trainee/.local/share/evolution/memos/trash' -> ’./home/trainee/.local/share/evolution/memos/trash | |
/home/trainee/.local/share/applications' -> ’./home/trainee/.local/share/applications | |
/home/trainee/.local/share/icc' -> ’./home/trainee/.local/share/icc | |
‘/home/trainee/.local/share/icc/edid-bb6ad72dc802b000932c73ad20996ae5.icc’ -> ‘./home/trainee/.local/share/icc/edid-bb6ad72dc802b000932c73ad20996ae5.icc’ | |
/home/trainee/.local/share/sounds' -> ’./home/trainee/.local/share/sounds | |
/home/trainee/.local/share/flatpak' -> ’./home/trainee/.local/share/flatpak | |
/home/trainee/.local/share/flatpak/repo' -> ’./home/trainee/.local/share/flatpak/repo | |
‘/home/trainee/.local/share/flatpak/repo/refs’ -> ‘./home/trainee/.local/share/flatpak/repo/refs’ | |
‘/home/trainee/.local/share/flatpak/repo/refs/heads’ -> ‘./home/trainee/.local/share/flatpak/repo/refs/heads’ | |
/home/trainee/.local/share/flatpak/repo/refs/mirrors' -> ’./home/trainee/.local/share/flatpak/repo/refs/mirrors | |
/home/trainee/.local/share/flatpak/repo/refs/remotes' -> ’./home/trainee/.local/share/flatpak/repo/refs/remotes | |
/home/trainee/.local/share/flatpak/repo/objects' -> ’./home/trainee/.local/share/flatpak/repo/objects | |
‘/home/trainee/.local/share/flatpak/repo/config’ -> ‘./home/trainee/.local/share/flatpak/repo/config’ | |
/home/trainee/.local/share/flatpak/repo/tmp' -> ’./home/trainee/.local/share/flatpak/repo/tmp | |
/home/trainee/.local/share/flatpak/repo/tmp/cache' -> ’./home/trainee/.local/share/flatpak/repo/tmp/cache | |
/home/trainee/.local/share/flatpak/repo/extensions' -> ’./home/trainee/.local/share/flatpak/repo/extensions | |
/home/trainee/.local/share/flatpak/repo/state' -> ’./home/trainee/.local/share/flatpak/repo/state | |
/home/trainee/.local/share/flatpak/.changed' -> ’./home/trainee/.local/share/flatpak/.changed | |
/home/trainee/.local/share/flatpak/db' -> “./home/trainee/.local/share/flatpak/db” | |
/home/trainee/.local/share/pki' -> ’./home/trainee/.local/share/pki | |
/home/trainee/.local/share/pki/nssdb' -> ’./home/trainee/.local/share/pki/nssdb | |
/home/trainee/.local/share/keyrings' -> ’./home/trainee/.local/share/keyrings | |
/home/trainee/.local/share/keyrings/login.keyring' -> ’./home/trainee/.local/share/keyrings/login.keyring | |
/home/trainee/.local/share/keyrings/user.keystore' -> ’./home/trainee/.local/share/keyrings/user.keystore | |
/home/trainee/.local/share/gnome-shell' -> ’./home/trainee/.local/share/gnome-shell | |
‘/home/trainee/.local/share/gnome-shell/gnome-overrides-migrated’ -> ‘./home/trainee/.local/share/gnome-shell/gnome-overrides-migrated’ | |
/home/trainee/.local/share/gnome-shell/application_state' -> ’./home/trainee/.local/share/gnome-shell/application_state | |
/home/trainee/.local/share/gvfs-metadata' -> ’./home/trainee/.local/share/gvfs-metadata | |
/home/trainee/.local/share/gvfs-metadata/home' -> ’./home/trainee/.local/share/gvfs-metadata/home | |
/home/trainee/.local/share/gvfs-metadata/root' -> ’./home/trainee/.local/share/gvfs-metadata/root | |
‘/home/trainee/.local/share/gvfs-metadata/home-6f6e2002.log’ -> ‘./home/trainee/.local/share/gvfs-metadata/home-6f6e2002.log’ | |
‘/home/trainee/.local/share/gvfs-metadata/root-47507e37.log’ -> ‘./home/trainee/.local/share/gvfs-metadata/root-47507e37.log’ | |
/home/trainee/.local/share/gnome-settings-daemon' -> ’./home/trainee/.local/share/gnome-settings-daemon | |
/home/trainee/.local/share/gnome-settings-daemon/input-sources-converted' -> ’./home/trainee/.local/share/gnome-settings-daemon/input-sources-converted | |
/home/trainee/.local/state' -> ’./home/trainee/.local/state | |
/home/trainee/.local/state/wireplumber' -> ’./home/trainee/.local/state/wireplumber | |
/home/trainee/.local/state/wireplumber/restore-stream' -> ’./home/trainee/.local/state/wireplumber/restore-stream | |
/home/trainee/Downloads' -> ’./home/trainee/Downloads | |
/home/trainee/Music' -> ’./home/trainee/Music | |
/home/trainee/.cache' -> ’./home/trainee/.cache | |
‘/home/trainee/.cache/event-sound-cache.tdb.5a35a3eb625c45cea1d33535723e791f.x86_64-redhat-linux-gnu’ -> ‘./home/trainee/.cache/event-sound-cache.tdb.5a35a3eb625c45cea1d33535723e791f.x86_64-redhat-linux-gnu’ | |
/home/trainee/.cache/gstreamer-1.0' -> ’./home/trainee/.cache/gstreamer-1.0 | |
/home/trainee/.cache/gstreamer-1.0/registry.x86_64.bin' -> ’./home/trainee/.cache/gstreamer-1.0/registry.x86_64.bin | |
/home/trainee/.cache/appstream' -> ’./home/trainee/.cache/appstream | |
/home/trainee/.cache/mesa_shader_cache' -> ’./home/trainee/.cache/mesa_shader_cache | |
/home/trainee/.cache/mesa_shader_cache/35' -> ’./home/trainee/.cache/mesa_shader_cache/35 | |
‘/home/trainee/.cache/mesa_shader_cache/35/fdf1af19fe3030e69e8f1eb8e8b27af5336130’ -> ‘./home/trainee/.cache/mesa_shader_cache/35/fdf1af19fe3030e69e8f1eb8e8b27af5336130’ | |
‘/home/trainee/.cache/mesa_shader_cache/37’ -> ‘./home/trainee/.cache/mesa_shader_cache/37’ | |
‘/home/trainee/.cache/mesa_shader_cache/37/e5792d1d01536d5334b02004e37fb0e4447734’ -> ‘./home/trainee/.cache/mesa_shader_cache/37/e5792d1d01536d5334b02004e37fb0e4447734’ | |
/home/trainee/.cache/mesa_shader_cache/db' -> “./home/trainee/.cache/mesa_shader_cache/db” | |
‘/home/trainee/.cache/mesa_shader_cache/db/61eeaba3f7216beef1a6584479498f1a1bcc6e’ -> ‘./home/trainee/.cache/mesa_shader_cache/db/61eeaba3f7216beef1a6584479498f1a1bcc6e’ | |
‘/home/trainee/.cache/mesa_shader_cache/89’ -> ‘./home/trainee/.cache/mesa_shader_cache/89’ | |
‘/home/trainee/.cache/mesa_shader_cache/89/e5753098f3e9b475aea4ee27559d24e8a477cd’ -> ‘./home/trainee/.cache/mesa_shader_cache/89/e5753098f3e9b475aea4ee27559d24e8a477cd’ | |
‘/home/trainee/.cache/mesa_shader_cache/89/f6154a1a3badafdf80810f15b7fcdcf76055f7’ -> ‘./home/trainee/.cache/mesa_shader_cache/89/f6154a1a3badafdf80810f15b7fcdcf76055f7’ | |
/home/trainee/.cache/mesa_shader_cache/29' -> ’./home/trainee/.cache/mesa_shader_cache/29 | |
‘/home/trainee/.cache/mesa_shader_cache/29/192c9c298ee4c8c9fbf0ec63ef2235bd284281’ -> ‘./home/trainee/.cache/mesa_shader_cache/29/192c9c298ee4c8c9fbf0ec63ef2235bd284281’ | |
‘/home/trainee/.cache/mesa_shader_cache/ba’ -> ‘./home/trainee/.cache/mesa_shader_cache/ba’ | |
‘/home/trainee/.cache/mesa_shader_cache/ba/c8c6c30bb2fd3a6ad51b81489fba57176bdb63’ -> ‘./home/trainee/.cache/mesa_shader_cache/ba/c8c6c30bb2fd3a6ad51b81489fba57176bdb63’ | |
‘/home/trainee/.cache/mesa_shader_cache/80’ -> ‘./home/trainee/.cache/mesa_shader_cache/80’ | |
‘/home/trainee/.cache/mesa_shader_cache/80/51554895958b09bfcc357550bff8c7c91d3f13’ -> ‘./home/trainee/.cache/mesa_shader_cache/80/51554895958b09bfcc357550bff8c7c91d3f13’ | |
/home/trainee/.cache/mesa_shader_cache/de' -> ’./home/trainee/.cache/mesa_shader_cache/de | |
‘/home/trainee/.cache/mesa_shader_cache/de/594a26def33b0ccfc9b9af4ee0d1f15e01af73’ -> ‘./home/trainee/.cache/mesa_shader_cache/de/594a26def33b0ccfc9b9af4ee0d1f15e01af73’ | |
‘/home/trainee/.cache/mesa_shader_cache/2c’ -> ‘./home/trainee/.cache/mesa_shader_cache/2c’ | |
‘/home/trainee/.cache/mesa_shader_cache/2c/58c677aeedca2646d85af2feeaa58bcaba11cd’ -> ‘./home/trainee/.cache/mesa_shader_cache/2c/58c677aeedca2646d85af2feeaa58bcaba11cd’ | |
‘/home/trainee/.cache/mesa_shader_cache/66’ -> ‘./home/trainee/.cache/mesa_shader_cache/66’ | |
‘/home/trainee/.cache/mesa_shader_cache/66/189cc50668aeaf9534cda7798d819feafd56c7’ -> ‘./home/trainee/.cache/mesa_shader_cache/66/189cc50668aeaf9534cda7798d819feafd56c7’ | |
‘/home/trainee/.cache/mesa_shader_cache/6e’ -> ‘./home/trainee/.cache/mesa_shader_cache/6e’ | |
‘/home/trainee/.cache/mesa_shader_cache/6e/590e396934a1b10561cef716c8f8e4ab789a36’ -> ‘./home/trainee/.cache/mesa_shader_cache/6e/590e396934a1b10561cef716c8f8e4ab789a36’ | |
‘/home/trainee/.cache/mesa_shader_cache/ed’ -> ‘./home/trainee/.cache/mesa_shader_cache/ed’ | |
‘/home/trainee/.cache/mesa_shader_cache/ed/48dbafa506e7835391085c2b2979ffad8a8940’ -> ‘./home/trainee/.cache/mesa_shader_cache/ed/48dbafa506e7835391085c2b2979ffad8a8940’ | |
‘/home/trainee/.cache/mesa_shader_cache/56’ -> ‘./home/trainee/.cache/mesa_shader_cache/56’ | |
‘/home/trainee/.cache/mesa_shader_cache/56/520536fab9c4bd7b65662bdcc0099f3d1fd090’ -> ‘./home/trainee/.cache/mesa_shader_cache/56/520536fab9c4bd7b65662bdcc0099f3d1fd090’ | |
‘/home/trainee/.cache/mesa_shader_cache/7b’ -> ‘./home/trainee/.cache/mesa_shader_cache/7b’ | |
‘/home/trainee/.cache/mesa_shader_cache/7b/b2b9a86dde20d2ffe0c14d344d36dfae760c54’ -> ‘./home/trainee/.cache/mesa_shader_cache/7b/b2b9a86dde20d2ffe0c14d344d36dfae760c54’ | |
/home/trainee/.cache/mesa_shader_cache/17' -> ’./home/trainee/.cache/mesa_shader_cache/17 | |
‘/home/trainee/.cache/mesa_shader_cache/17/7d02a06d53b04eae8fb946e8bff91c951d8dc3’ -> ‘./home/trainee/.cache/mesa_shader_cache/17/7d02a06d53b04eae8fb946e8bff91c951d8dc3’ | |
/home/trainee/.cache/mesa_shader_cache/2e' -> “./home/trainee/.cache/mesa_shader_cache/2e” | |
‘/home/trainee/.cache/mesa_shader_cache/2f/5b6e06b2728ebe3fa7976bcea3474fed301b2b’ -> ‘./home/trainee/.cache/mesa_shader_cache/2f/5b6e06b2728ebe3fa7976bcea3474fed301b2b’ | |
‘/home/trainee/.cache/mesa_shader_cache/d0’ -> ‘./home/trainee/.cache/mesa_shader_cache/d0’ | |
‘/home/trainee/.cache/mesa_shader_cache/d0/6fca52ab2f687b8e6f4c135e084e39bcb0c859’ -> ‘./home/trainee/.cache/mesa_shader_cache/d0/6fca52ab2f687b8e6f4c135e084e39bcb0c859’ | |
‘/home/trainee/.cache/mesa_shader_cache/9e’ -> ‘./home/trainee/.cache/mesa_shader_cache/9e’ | |
‘/home/trainee/.cache/mesa_shader_cache/9e/d50ad4e45ed562c3e7b4570526c4cc8154f214’ -> ‘./home/trainee/.cache/mesa_shader_cache/9e/d50ad4e45ed562c3e7b4570526c4cc8154f214’ | |
/home/trainee/.cache/mesa_shader_cache/6c' -> ’./home/trainee/.cache/mesa_shader_cache/6c | |
‘/home/trainee/.cache/mesa_shader_cache/6c/2e2e9047a693755c7cfdc286874dc0e3e30b4e’ -> ‘./home/trainee/.cache/mesa_shader_cache/6c/2e2e9047a693755c7cfdc286874dc0e3e30b4e’ | |
‘/home/trainee/.cache/mesa_shader_cache/6c/3101d0fdf7a12f96507b4ac96b83de38448541’ -> ‘./home/trainee/.cache/mesa_shader_cache/6c/3101d0fdf7a12f96507b4ac96b83de38448541’ | |
‘/home/trainee/.cache/mesa_shader_cache/d3’ -> ‘./home/trainee/.cache/mesa_shader_cache/d3’ | |
‘/home/trainee/.cache/mesa_shader_cache/d3/075b420db4b80da890c1576f69ba7758421738’ -> ‘./home/trainee/.cache/mesa_shader_cache/d3/075b420db4b80da890c1576f69ba7758421738’ | |
‘/home/trainee/.cache/mesa_shader_cache/e2’ -> ‘./home/trainee/.cache/mesa_shader_cache/e2’ | |
‘/home/trainee/.cache/mesa_shader_cache/e2/eda2c17a911182ce0675a982c19d7ec332fe48’ -> ‘./home/trainee/.cache/mesa_shader_cache/e2/eda2c17a911182ce0675a982c19d7ec332fe48’ | |
‘/home/trainee/.cache/mesa_shader_cache/3c’ -> ‘./home/trainee/.cache/mesa_shader_cache/3c’ | |
‘/home/trainee/.cache/mesa_shader_cache/3c/5cfbfcea5eaa35a106d2bad38d8d89c7da4759’ -> ‘./home/trainee/.cache/mesa_shader_cache/3c/5cfbfcea5eaa35a106d2bad38d8d89c7da4759’ | |
‘/home/trainee/.cache/mesa_shader_cache/61’ -> ‘./home/trainee/.cache/mesa_shader_cache/61’ | |
‘/home/trainee/.cache/mesa_shader_cache/61/d347702600b207e1d67f23f11f089553172512’ -> ‘./home/trainee/.cache/mesa_shader_cache/61/d347702600b207e1d67f23f11f089553172512’ | |
‘/home/trainee/.cache/mesa_shader_cache/03’ -> ‘./home/trainee/.cache/mesa_shader_cache/03’ | |
‘/home/trainee/.cache/mesa_shader_cache/03/d956db16f83ba111f7e395ca2e6b7b3f83ff46’ -> ‘./home/trainee/.cache/mesa_shader_cache/03/d956db16f83ba111f7e395ca2e6b7b3f83ff46’ | |
‘/home/trainee/.cache/mesa_shader_cache/a4’ -> ‘./home/trainee/.cache/mesa_shader_cache/a4’ | |
‘/home/trainee/.cache/mesa_shader_cache/a4/a2550d53877cc1471892b1bec5444abc719ef8’ -> ‘./home/trainee/.cache/mesa_shader_cache/a4/a2550d53877cc1471892b1bec5444abc719ef8’ | |
‘/home/trainee/.cache/mesa_shader_cache/ab’ -> ‘./home/trainee/.cache/mesa_shader_cache/ab’ | |
‘/home/trainee/.cache/mesa_shader_cache/ab/d56ebc4a54bcc4e49aa3dde4fddb884ff797c1’ -> ‘./home/trainee/.cache/mesa_shader_cache/ab/d56ebc4a54bcc4e49aa3dde4fddb884ff797c1’ | |
‘/home/trainee/.cache/mesa_shader_cache/b1’ -> ‘./home/trainee/.cache/mesa_shader_cache/b1’ | |
‘/home/trainee/.cache/mesa_shader_cache/b1/8414b51e1825350f6af7ba143d082ba6e91338’ -> ‘./home/trainee/.cache/mesa_shader_cache/b1/8414b51e1825350f6af7ba143d082ba6e91338’ | |
‘/home/trainee/.cache/mesa_shader_cache/c8’ -> ‘./home/trainee/.cache/mesa_shader_cache/c8’ | |
‘/home/trainee/.cache/mesa_shader_cache/c8/d3f9f8d81fa2bafb1e8e03193e8861047adcde’ -> ‘./home/trainee/.cache/mesa_shader_cache/c8/d3f9f8d81fa2bafb1e8e03193e8861047adcde’ | |
‘/home/trainee/.cache/mesa_shader_cache/df’ -> ‘./home/trainee/.cache/mesa_shader_cache/df’ | |
‘/home/trainee/.cache/mesa_shader_cache/df/ad5863cff76ca47fcea0a47b9f8d81bf57c605’ -> ‘./home/trainee/.cache/mesa_shader_cache/df/ad5863cff76ca47fcea0a47b9f8d81bf57c605’ | |
/home/trainee/.cache/mesa_shader_cache/index' -> “./home/trainee/.cache/mesa_shader_cache/index” | |
‘/home/trainee/.cache/mesa_shader_cache/fc’ -> ‘./home/trainee/.cache/mesa_shader_cache/fc’ | |
‘/home/trainee/.cache/mesa_shader_cache/fc/0a9b98f3ab91773422fdf596d8b90aa3f0319f’ -> ‘./home/trainee/.cache/mesa_shader_cache/fc/0a9b98f3ab91773422fdf596d8b90aa3f0319f’ | |
/home/trainee/.cache/mesa_shader_cache/0f' -> “./home/trainee/.cache/mesa_shader_cache/0f” | |
‘/home/trainee/.cache/mesa_shader_cache/0f/30c6ae612cca20f942383cf6c3d207a5fa23cc’ -> ‘./home/trainee/.cache/mesa_shader_cache/0f/30c6ae612cca20f942383cf6c3d207a5fa23cc’ | |
‘/home/trainee/.cache/mesa_shader_cache/0f/10bb2c604d0ef8a698a506a297cc7a72885e1f’ -> ‘./home/trainee/.cache/mesa_shader_cache/0f/10bb2c604d0ef8a698a506a297cc7a72885e1f’ | |
‘/home/trainee/.cache/mesa_shader_cache/9a’ -> ‘./home/trainee/.cache/mesa_shader_cache/9a’ | |
‘/home/trainee/.cache/mesa_shader_cache/9a/32ee45d4531554f10a8184bf639fdf0a072fba’ -> ‘./home/trainee/.cache/mesa_shader_cache/9a/32ee45d4531554f10a8184bf639fdf0a072fba’ | |
‘/home/trainee/.cache/mesa_shader_cache/9a/3061c95eb9135ea46575ef514f2fae7f4711cc’ -> ‘./home/trainee/.cache/mesa_shader_cache/9a/3061c95eb9135ea46575ef514f2fae7f4711cc’ | |
‘/home/trainee/.cache/mesa_shader_cache/06’ -> ‘./home/trainee/.cache/mesa_shader_cache/06’ | |
‘/home/trainee/.cache/mesa_shader_cache/06/3c901c6133c1b0568bb9b8ff1d4a35af6d8df4’ -> ‘./home/trainee/.cache/mesa_shader_cache/06/3c901c6133c1b0568bb9b8ff1d4a35af6d8df4’ | |
‘/home/trainee/.cache/mesa_shader_cache/7c’ -> ‘./home/trainee/.cache/mesa_shader_cache/7c’ | |
‘/home/trainee/.cache/mesa_shader_cache/7c/40694e298e691a0e7ac606cb160097a65c5fe9’ -> ‘./home/trainee/.cache/mesa_shader_cache/7c/40694e298e691a0e7ac606cb160097a65c5fe9’ | |
‘/home/trainee/.cache/mesa_shader_cache/77’ -> ‘./home/trainee/.cache/mesa_shader_cache/77’ | |
‘/home/trainee/.cache/mesa_shader_cache/77/390cf9430a3344e71ec336b898ff0af5362f27’ -> ‘./home/trainee/.cache/mesa_shader_cache/77/390cf9430a3344e71ec336b898ff0af5362f27’ | |
‘/home/trainee/.cache/mesa_shader_cache/57’ -> ‘./home/trainee/.cache/mesa_shader_cache/57’ | |
‘/home/trainee/.cache/mesa_shader_cache/57/b7f8fa574271b61ecbd67cfdbf0fbfa4e7309f’ -> ‘./home/trainee/.cache/mesa_shader_cache/57/b7f8fa574271b61ecbd67cfdbf0fbfa4e7309f’ | |
/home/trainee/.cache/mesa_shader_cache/78' -> ’./home/trainee/.cache/mesa_shader_cache/78 | |
‘/home/trainee/.cache/mesa_shader_cache/78/37d600b50e8a23efed7bcb298703d700c4bdde’ -> ‘./home/trainee/.cache/mesa_shader_cache/78/37d600b50e8a23efed7bcb298703d700c4bdde’ | |
‘/home/trainee/.cache/mesa_shader_cache/08’ -> ‘./home/trainee/.cache/mesa_shader_cache/08’ | |
‘/home/trainee/.cache/mesa_shader_cache/08/c25769e6f0d114ee11363b6a006276457ba0fe’ -> ‘./home/trainee/.cache/mesa_shader_cache/08/c25769e6f0d114ee11363b6a006276457ba0fe’ | |
‘/home/trainee/.cache/mesa_shader_cache/52’ -> ‘./home/trainee/.cache/mesa_shader_cache/52’ | |
‘/home/trainee/.cache/mesa_shader_cache/52/675f8b2f5bf87b675ae31f54f2b3c412721c24’ -> ‘./home/trainee/.cache/mesa_shader_cache/52/675f8b2f5bf87b675ae31f54f2b3c412721c24’ | |
/home/trainee/.cache/mesa_shader_cache/72' -> ’./home/trainee/.cache/mesa_shader_cache/72 | |
‘/home/trainee/.cache/mesa_shader_cache/72/6f5d4d61d416fbce8e03f0ba6f3be83b7617ef’ -> ‘./home/trainee/.cache/mesa_shader_cache/72/6f5d4d61d416fbce8e03f0ba6f3be83b7617ef’ | |
‘/home/trainee/.cache/mesa_shader_cache/1d’ -> ‘./home/trainee/.cache/mesa_shader_cache/1d’ | |
‘/home/trainee/.cache/mesa_shader_cache/1d/16707620c6d057cc29f510df219eae84cb9433’ -> ‘./home/trainee/.cache/mesa_shader_cache/1d/16707620c6d057cc29f510df219eae84cb9433’ | |
‘/home/trainee/.cache/mesa_shader_cache/da’ -> ‘./home/trainee/.cache/mesa_shader_cache/da’ | |
‘/home/trainee/.cache/mesa_shader_cache/da/35509cf05c257db6419f61347e3abcbfb47931’ -> ‘./home/trainee/.cache/mesa_shader_cache/da/35509cf05c257db6419f61347e3abcbfb47931’ | |
‘/home/trainee/.cache/mesa_shader_cache/b2’ -> ‘./home/trainee/.cache/mesa_shader_cache/b2’ | |
‘/home/trainee/.cache/mesa_shader_cache/b2/cfbf371328300a5b5d686da17d3722ea1ea680’ -> ‘./home/trainee/.cache/mesa_shader_cache/b2/cfbf371328300a5b5d686da17d3722ea1ea680’ | |
‘/home/trainee/.cache/mesa_shader_cache/3d’ -> ‘./home/trainee/.cache/mesa_shader_cache/3d’ | |
‘/home/trainee/.cache/mesa_shader_cache/3d/e830f90f2d4d3d79bba17a59903ad4aa4736ed’ -> ‘./home/trainee/.cache/mesa_shader_cache/3d/e830f90f2d4d3d79bba17a59903ad4aa4736ed’ | |
‘/home/trainee/.cache/mesa_shader_cache/53’ -> ‘./home/trainee/.cache/mesa_shader_cache/53’ | |
‘/home/trainee/.cache/mesa_shader_cache/53/5db4be69e145c6708f2d30c70b5a292464c990’ -> ‘./home/trainee/.cache/mesa_shader_cache/53/5db4be69e145c6708f2d30c70b5a292464c990’ | |
‘/home/trainee/.cache/mesa_shader_cache/e7’ -> ‘./home/trainee/.cache/mesa_shader_cache/e7’ | |
‘/home/trainee/.cache/mesa_shader_cache/e7/b2552c608263fa6b536e5aba787ce66bbb222b’ -> ‘./home/trainee/.cache/mesa_shader_cache/e7/b2552c608263fa6b536e5aba787ce66bbb222b’ | |
‘/home/trainee/.cache/mesa_shader_cache/59’ -> ‘./home/trainee/.cache/mesa_shader_cache/59’ | |
‘/home/trainee/.cache/mesa_shader_cache/59/87c57c825b5080423c1f92ee06f23998a21164’ -> ‘./home/trainee/.cache/mesa_shader_cache/59/87c57c825b5080423c1f92ee06f23998a21164’ | |
‘/home/trainee/.cache/mesa_shader_cache/04’ -> ‘./home/trainee/.cache/mesa_shader_cache/04’ | |
‘/home/trainee/.cache/mesa_shader_cache/04/7e399922091e12b6b1038ffd9d65cb8a8d4e52’ -> ‘./home/trainee/.cache/mesa_shader_cache/04/7e399922091e12b6b1038ffd9d65cb8a8d4e52’ | |
‘/home/trainee/.cache/mesa_shader_cache/5e’ -> ‘./home/trainee/.cache/mesa_shader_cache/5e’ | |
‘/home/trainee/.cache/mesa_shader_cache/5e/c3362db3becd652b156ef7cef7b65a14000175’ -> ‘./home/trainee/.cache/mesa_shader_cache/5e/c3362db3becd652b156ef7cef7b65a14000175’ | |
‘/home/trainee/.cache/mesa_shader_cache/4b’ -> ‘./home/trainee/.cache/mesa_shader_cache/4b’ | |
‘/home/trainee/.cache/mesa_shader_cache/4b/c7bfac6ba6440df22b676247a760ea33ef00e9’ -> ‘./home/trainee/.cache/mesa_shader_cache/4b/c7bfac6ba6440df22b676247a760ea33ef00e9’ | |
/home/trainee/.cache/mesa_shader_cache/38' -> ’./home/trainee/.cache/mesa_shader_cache/38 | |
‘/home/trainee/.cache/mesa_shader_cache/38/ab4c0ec5a2678353a62e2adb585cac57621027’ -> ‘./home/trainee/.cache/mesa_shader_cache/38/ab4c0ec5a2678353a62e2adb585cac57621027’ | |
‘/home/trainee/.cache/mesa_shader_cache/f0’ -> ‘./home/trainee/.cache/mesa_shader_cache/f0’ | |
‘/home/trainee/.cache/mesa_shader_cache/f0/23c0293a789bd41028bbe52116a8050da78300’ -> ‘./home/trainee/.cache/mesa_shader_cache/f0/23c0293a789bd41028bbe52116a8050da78300’ | |
‘/home/trainee/.cache/mesa_shader_cache/f0/fe14587cf5f14504a4d663d50b842ab6708459’ -> ‘./home/trainee/.cache/mesa_shader_cache/f0/fe14587cf5f14504a4d663d50b842ab6708459’ | |
/home/trainee/.cache/mesa_shader_cache/0a' -> “./home/trainee/.cache/mesa_shader_cache/0a” | |
‘/home/trainee/.cache/mesa_shader_cache/0a/2e07fbab5189565440428bc82a0b3716f1c7f9’ -> ‘./home/trainee/.cache/mesa_shader_cache/0a/2e07fbab5189565440428bc82a0b3716f1c7f9’ | |
‘/home/trainee/.cache/mesa_shader_cache/21’ -> ‘./home/trainee/.cache/mesa_shader_cache/21’ | |
‘/home/trainee/.cache/mesa_shader_cache/21/f7c9c648eaf6ad5386e464adf635c5fcbda019’ -> ‘./home/trainee/.cache/mesa_shader_cache/21/f7c9c648eaf6ad5386e464adf635c5fcbda019’ | |
‘/home/trainee/.cache/mesa_shader_cache/41’ -> ‘./home/trainee/.cache/mesa_shader_cache/41’ | |
‘/home/trainee/.cache/mesa_shader_cache/41/c7d27f4328971dfae62cbeeb047f4051f58de2’ -> ‘./home/trainee/.cache/mesa_shader_cache/41/c7d27f4328971dfae62cbeeb047f4051f58de2’ | |
‘/home/trainee/.cache/mesa_shader_cache/2b’ -> ‘./home/trainee/.cache/mesa_shader_cache/2b’ | |
‘/home/trainee/.cache/mesa_shader_cache/2b/a8165b2be71340b0d73b74a10311320d6c8cf2’ -> ‘./home/trainee/.cache/mesa_shader_cache/2b/a8165b2be71340b0d73b74a10311320d6c8cf2’ | |
/home/trainee/.cache/mesa_shader_cache/13' -> ’./home/trainee/.cache/mesa_shader_cache/13 | |
‘/home/trainee/.cache/mesa_shader_cache/13/b31a6f63cea64dc9bbe84ea28710f135184274’ -> ‘./home/trainee/.cache/mesa_shader_cache/13/b31a6f63cea64dc9bbe84ea28710f135184274’ | |
‘/home/trainee/.cache/mesa_shader_cache/c4’ -> ‘./home/trainee/.cache/mesa_shader_cache/c4’ | |
‘/home/trainee/.cache/mesa_shader_cache/c4/9bbd97238c5299a3e74ac9606194a6bbe48334’ -> ‘./home/trainee/.cache/mesa_shader_cache/c4/9bbd97238c5299a3e74ac9606194a6bbe48334’ | |
‘/home/trainee/.cache/mesa_shader_cache/63’ -> ‘./home/trainee/.cache/mesa_shader_cache/63’ | |
‘/home/trainee/.cache/mesa_shader_cache/63/9e6e421d46d0b2e7802b4919b10a7c3cfb5a57’ -> ‘./home/trainee/.cache/mesa_shader_cache/63/9e6e421d46d0b2e7802b4919b10a7c3cfb5a57’ | |
/home/trainee/.cache/ibus' -> ’./home/trainee/.cache/ibus | |
/home/trainee/.cache/flatpak' -> ’./home/trainee/.cache/flatpak | |
/home/trainee/.cache/flatpak/system-cache' -> ’./home/trainee/.cache/flatpak/system-cache | |
/home/trainee/.cache/evolution' -> ’./home/trainee/.cache/evolution | |
/home/trainee/.cache/evolution/addressbook' -> ’./home/trainee/.cache/evolution/addressbook | |
/home/trainee/.cache/evolution/addressbook/trash' -> ’./home/trainee/.cache/evolution/addressbook/trash | |
/home/trainee/.cache/evolution/mail' -> ’./home/trainee/.cache/evolution/mail | |
/home/trainee/.cache/evolution/mail/trash' -> ’./home/trainee/.cache/evolution/mail/trash | |
/home/trainee/.cache/evolution/sources' -> ’./home/trainee/.cache/evolution/sources | |
/home/trainee/.cache/evolution/sources/trash' -> ’./home/trainee/.cache/evolution/sources/trash | |
/home/trainee/.cache/evolution/calendar' -> ’./home/trainee/.cache/evolution/calendar | |
/home/trainee/.cache/evolution/calendar/trash' -> ’./home/trainee/.cache/evolution/calendar/trash | |
/home/trainee/.cache/evolution/memos' -> ’./home/trainee/.cache/evolution/memos | |
/home/trainee/.cache/evolution/memos/trash' -> ’./home/trainee/.cache/evolution/memos/trash | |
/home/trainee/.cache/evolution/tasks' -> ’./home/trainee/.cache/evolution/tasks | |
/home/trainee/.cache/evolution/tasks/trash' -> ’./home/trainee/.cache/evolution/tasks/trash | |
/home/trainee/.cache/gnome-software' -> ’./home/trainee/.cache/gnome-software | |
/home/trainee/.cache/gnome-software/appstream' -> ’./home/trainee/.cache/gnome-software/appstream | |
‘/home/trainee/.cache/gnome-software/appstream/components.xmlb’ -> ‘./home/trainee/.cache/gnome-software/appstream/components.xmlb’ | |
/home/trainee/.cache/gnome-software/flatpak-system-default' -> “./home/trainee/.cache/gnome-software/flatpak-system-default” | |
/home/trainee/.cache/gnome-software/flatpak-system-default/components.xmlb' -> “./home/trainee/.cache/gnome-software/flatpak-system-default/components.xmlb” | |
‘/home/trainee/.cache/gnome-software/flatpak-user-user’ -> ‘./home/trainee/.cache/gnome-software/flatpak-user-user’ | |
/home/trainee/.cache/gnome-software/flatpak-user-user/components.xmlb' -> “./home/trainee/.cache/gnome-software/flatpak-user-user/components.xmlb” | |
/home/trainee/.cache/gnome-software/odrs' -> ’./home/trainee/.cache/gnome-software/odrs | |
‘/home/trainee/.cache/gnome-software/odrs/ratings.json’ -> ‘./home/trainee/.cache/gnome-software/odrs/ratings.json’ | |
/home/trainee/.bash_logout' -> ’./home/trainee/.bash_logout | |
/home/trainee/.exrc' -> ’./home/trainee/.exrc | |
/home/trainee/.viminfo' -> ’./home/trainee/.viminfo | |
/home/trainee/vitext' -> ’./home/trainee/vitext | |
/home/trainee/aac' -> ’./home/trainee/aac | |
/home/trainee/abc' -> ’./home/trainee/abc | |
/home/trainee/bca' -> ’./home/trainee/bca | |
‘/home/trainee/xyz’ -> ‘./home/trainee/xyz | |
/home/trainee/.lesshst' -> ’./home/trainee/.lesshst | |
/home/trainee/errorlog' -> ’./home/trainee/errorlog | |
/home/trainee/file' -> ’./home/trainee/file | |
/home/trainee/file1' -> ’./home/trainee/file1 | |
/home/trainee/file2' -> ’./home/trainee/file2 | |
/home/trainee/list' -> ’./home/trainee/list | |
/home/trainee/typescript' -> ’./home/trainee/typescript | |
/home/trainee/Templates' -> ’./home/trainee/Templates | |
/home/trainee/Pictures' -> ’./home/trainee/Pictures | |
/home/trainee/.bash_profile' -> ’./home/trainee/.bash_profile | |
/home/trainee/.bashrc' -> ’./home/trainee/.bashrc | |
/home/trainee/.bash_history' -> ’./home/trainee/.bash_history | |
/home/trainee/Public' -> ’./home/trainee/Public | |
/home/trainee/Videos' -> ’./home/trainee/Videos | |
/home/trainee/.mozilla' -> ’./home/trainee/.mozilla | |
/home/trainee/.mozilla/extensions' -> ’./home/trainee/.mozilla/extensions | |
‘/home/trainee/.mozilla/plugins’ -> ‘./home/trainee/.mozilla/plugins’ | |
</code> | </code> |
| |
====The Rsync command==== | ====The Rsync command==== |
| |
===Presentation=== | ===Overview=== |
| |
**Rsync** or //Remote Sync// is a file synchronisation utility that uses an algorithm that minimises the amount of data copied by only copying the parts of files that have been modified. | **Rsync** or //Remote Sync// is a file synchronisation utility that uses an algorithm that minimises the amount of data copied by only copying the parts of files that have been modified. |
</code> | </code> |
| |
Now run the following command and see the result: | Execute the following command and check the result: |
| |
<code> | <code> |
| |
<WRAP center round important 60%> | <WRAP center round important 60%> |
**Important** - Note that in this case, the **/** character is missing after **dirA** in the **rsync -a /test/dirA /test/dirB** command. The result is synchronisation of the **directory** **/test/dirA** to **/test/dirB**. | **Important** - Note that in this case, the **/** character is missing after **dirA** in the **rsync -a /test/dirA /test/dirB** command. The result is the synchronisation of the **directory** **/test/dirA** to **/test/dirB**. |
</WRAP> | </WRAP> |
| |
To avoid errors, the **rsync** command allows you to view the result of your command without executing the command by using the **-n** and **-r** options. | In order to test a synchronisation, rsync allows the use of dry runs by using the **-n** and **-r** switches. |
| |
Again, delete the files in the **/test/dirB** directory: | Again, delete the files in the **/test/dirB** directory: |
</code> | </code> |
| |
Run the command below: | Now execute the following command: |
| |
<code> | <code> |
</WRAP> | </WRAP> |
| |
Now run the command below: | Now execute the following command: |
| |
<code> | <code> |
===Command Line Switches=== | ===Command Line Switches=== |
| |
The options for the rsync command are: | The command line switches for the rsync command are: |
| |
<code> | <code> |
| |
The **gzip** command is a compression utility under GNU/Linux. The **gunzip** command is a GNU/Linux decompression utility. | The **gzip** command is a compression utility under GNU/Linux. The **gunzip** command is a GNU/Linux decompression utility. |
| |
| ===LAB #6 - Working with the gzip command=== |
| |
| Use **gzip** to compress your tar file: |
| |
| <code> |
| [root@redhat9 ~]# gzip /tmp/test.tar |
| </code> |
| |
| Note the size of the **test.tar.gz** file: |
| |
| <code> |
| [root@redhat9 ~]# ls -l /tmp/test.tar.gz |
| -rw-r--r--. 1 root root 222 Sep 27 07:57 /tmp/test.tar.gz |
| </code> |
| |
| <WRAP center round important 60%> |
| **Important** - Note that the compressed file was created in the same directory as the source file and that the source file has disappeared. |
| </WRAP> |
| |
| Decompress the test.tar.gz file: |
| |
| <code> |
| [root@redhat9 ~]# gunzip /tmp/test.tar.gz |
| </code> |
| |
===Command Line Switches=== | ===Command Line Switches=== |
</code> | </code> |
| |
The options for the **gunzip** command are: | The command line switches for the **gunzip** command are: |
| |
<code> | <code> |
</code> | </code> |
| |
===LAB #6 - Working with the gzip command=== | ====The bzip2 command==== |
| |
Use **gzip** to compress your tar file: | ===Overview=== |
| |
| The **bzip2** command is a compression utility under GNU/Linux. The **bunzip2** command is a decompression utility under GNU/Linux. |
| |
| |
| ===LAB #7 - Working with the bzip2 command=== |
| |
| Use **bzip2** to compress your tar file: |
| |
<code> | <code> |
[root@redhat9 ~]# gzip /tmp/test.tar | [root@redhat9 ~]# bzip2 /tmp/test.tar |
</code> | </code> |
| |
Note the size of the **test.tar.gz** file: | Note the size of the **tar.bz2** file: |
| |
<code> | <code> |
[root@redhat9 ~]# ls -l /tmp/test.tar.gz | [root@redhat9 ~]# ls -l /tmp | grep test.tar.bz |
-rw-r--r--. 1 root root 222 Sep 27 07:57 /tmp/test.tar.gz | -rw-r--r--. 1 root root 207 Sep 27 07:57 test.tar.bz2 |
</code> | </code> |
| |
<WRAP center round important 60%> | <WRAP center round important 60%> |
**Important** - Note that the compressed file was created in the same directory as the source file and that the source file has disappeared. | **Important** - Note that the compressed file was created in the same directory as the source file and the source file has disappeared. |
</WRAP> | </WRAP> |
| |
Unzip the test.tar.gz file: | Decompress the tar.bz2 file: |
| |
<code> | <code> |
[root@redhat9 ~]# gunzip /tmp/test.tar.gz | [root@redhat9 ~]# bunzip2 /tmp/test.tar.bz2 |
</code> | </code> |
| |
====The bzip2 command==== | |
| |
===Overview=== | |
| |
The **bzip2** command is a compression utility under GNU/Linux. The **bunzip2** command is a decompression utility under GNU/Linux. | |
| |
===Command Line Switches=== | ===Command Line Switches=== |
| |
The options for the **bzip2** command are: | The command line switches for the **bzip2** command are: |
| |
<code> | <code> |
</code> | </code> |
| |
The options for the **bunzip2** command are: | The command line switches for the **bunzip2** command are: |
| |
<code> | <code> |
from standard input to standard output. You can combine | from standard input to standard output. You can combine |
short flags, so `-v -4' means the same as -v4 or -4v, &c.0 | short flags, so `-v -4' means the same as -v4 or -4v, &c.0 |
</code> | |
| |
===LAB #7 - Working with the bzip2 command=== | |
| |
Use **bzip2** to compress your tar file: | |
| |
<code> | |
[root@redhat9 ~]# bzip2 /tmp/test.tar | |
</code> | |
| |
Note the size of the **tar.bz2** file: | |
| |
<code> | |
[root@redhat9 ~]# ls -l /tmp | grep test.tar.bz | |
-rw-r--r--. 1 root root 207 Sep 27 07:57 test.tar.bz2 | |
</code> | |
| |
<WRAP center round important 60%> | |
**Important** - Note that the compressed file was created in the same directory as the source file and the source file has disappeared. | |
</WRAP> | |
| |
Unzip the tar.bz2 file: | |
| |
<code> | |
[root@redhat9 ~]# bunzip2 /tmp/test.tar.bz2 | |
</code> | </code> |
| |
The **xz** command is a compression utility under GNU/Linux. Other commands are: | The **xz** command is a compression utility under GNU/Linux. Other commands are: |
| |
**unxz** - equivalent to **xz --decompress**. | * **unxz** - equivalent to **xz --decompress**. |
**xzcat** - equivalent to **xz --decompress --stdout**. | * **xzcat** - equivalent to **xz --decompress --stdout**. |
**lzma** - equivalent to **xz --format=lzma**. | * **lzma** - equivalent to **xz --format=lzma**. |
* unlzma** - equivalent to **xz --format=lzma --decompress**. | * **unlzma** - equivalent to **xz --format=lzma --decompress**. |
**lzcat** - equivalent to **xz --format=lzma --decompress --stdout**. | * **lzcat** - equivalent to **xz --format=lzma --decompress --stdout**. |
| |
The xz command will not compress the file if : | The xz command will not compress the file if : |
| |
* the file does not have an .xz or .lzma extension | * the file does not have an .xz or .lzma extension |
| |
===Command Line Switches=== | |
| |
The options for the **xz** command are: | |
| |
<code> | |
[root@redhat9 ~]# xz --help | |
Usage: xz [OPTION]... [FILE]... | |
Compress or decompress FILEs in the .xz format. | |
| |
-z, --compress force compression | |
-d, --decompress force decompression | |
-t, --test test compressed file integrity | |
-l, --list list information about .xz files | |
-k, --keep keep (don't delete) input files | |
-f, --force force overwrite of output file and (de)compress links | |
-c, --stdout write to standard output and don't delete input files | |
-0 ... -9 compression preset; default is 6; take compressor *and* | |
decompressor memory usage into account before using 7-9! | |
-e, --extreme try to improve compression ratio by using more CPU time; | |
does not affect decompressor memory requirements | |
-T, --threads=NUM use at most NUM threads; the default is 1; set to 0 | |
to use as many threads as there are processor cores | |
-q, --quiet suppress warnings; specify twice to suppress errors too | |
-v, --verbose be verbose; specify twice for even more verbose | |
-h, --help display this short help and exit | |
-H, --long-help display the long help (lists also the advanced options) | |
-V, --version display the version number and exit | |
| |
With no FILE, or when FILE is -, read standard input. | |
| |
Report bugs to <lasse.collin@tukaani.org> (in English or Finnish). | |
XZ Utils home page: <https://tukaani.org/xz/> | |
</code> | |
| |
===LAB #8 - Working with the xz command=== | ===LAB #8 - Working with the xz command=== |
</WRAP> | </WRAP> |
| |
Unzip the test.tar.xz file: | Decompress the test.tar.xz file: |
| |
<code> | <code> |
-rw-r--r--. 1 root root 512 Sep 27 08:08 test.cpio | -rw-r--r--. 1 root root 512 Sep 27 08:08 test.cpio |
-rw-r--r--. 1 root root 10240 Sep 27 07:57 test.tar | -rw-r--r--. 1 root root 10240 Sep 27 07:57 test.tar |
| </code> |
| |
| ===Command Line Switches=== |
| |
| The command line switches for the **xz** command are: |
| |
| <code> |
| [root@redhat9 ~]# xz --help |
| Usage: xz [OPTION]... [FILE]... |
| Compress or decompress FILEs in the .xz format. |
| |
| -z, --compress force compression |
| -d, --decompress force decompression |
| -t, --test test compressed file integrity |
| -l, --list list information about .xz files |
| -k, --keep keep (don't delete) input files |
| -f, --force force overwrite of output file and (de)compress links |
| -c, --stdout write to standard output and don't delete input files |
| -0 ... -9 compression preset; default is 6; take compressor *and* |
| decompressor memory usage into account before using 7-9! |
| -e, --extreme try to improve compression ratio by using more CPU time; |
| does not affect decompressor memory requirements |
| -T, --threads=NUM use at most NUM threads; the default is 1; set to 0 |
| to use as many threads as there are processor cores |
| -q, --quiet suppress warnings; specify twice to suppress errors too |
| -v, --verbose be verbose; specify twice for even more verbose |
| -h, --help display this short help and exit |
| -H, --long-help display the long help (lists also the advanced options) |
| -V, --version display the version number and exit |
| |
| With no FILE, or when FILE is -, read standard input. |
| |
| Report bugs to <lasse.collin@tukaani.org> (in English or Finnish). |
| XZ Utils home page: <https://tukaani.org/xz/> |
</code> | </code> |
| |