Linux with Operating System Concepts



Download 5,65 Mb.
Pdf ko'rish
bet162/254
Sana22.07.2022
Hajmi5,65 Mb.
#840170
1   ...   158   159   160   161   162   163   164   165   ...   254
Bog'liq
Linux-with-Operating-System-Concepts-Fox-Richard-CRC-Press-2014

Option
Meaning
-c 
num
The number of blocks to scan at a time, the default is 64
-e 
num
Force badblocks to exit after 
num
bad blocks have been found (if your file system is truly damaged, 
you may not care to find all of the bad blocks, so -e 100 for instance would abort badblocks after 
100 bad blocks are found)
-i 
file
Scan for bad blocks but skip any block numbers that are stored in the file 
file
; this is useful if you 
already know of bad blocks and you want badblocks to avoid scanning those particular blocks
-p 
num
Force badblocks to make 
num
repeated passes; the default is 0
-s
Show the progress as a percentage of the file system completed
-w
Use write-mode to test for badblocks; badblocks writes some pattern to each block and then reads 
the block to see if it can obtain what was written


430

Linux with Operating System Concepts
would check file systems of type ext4, which are read-only and not synchronous. Additional 
options include
• -C—display progress.
• -M—do not check mounted file systems.
• -N—do not attempt repair, just report what should be done, -n does much the same 
thing but used in different file system checkers (see below).
• -R—skip the root file system if it is already mounted (this can be used in conjunction 
with -A, which performs all file system checks in a single run).
• -a—automatically repair the file system with no interaction with the user.
There are actually several different fsck programs available in Linux. These include 
e2fsck

fsck.ext2

fsck.ext3
, and 
fsck.ext4
. With multiple file system types now available in 
Linux, the fsck program, which was set up to use the ext style file system, will call upon these 
other file system checking programs to complete its task. Some of the above parameters will 
not work with various checking programs (thus, -N and -n are both available).
10.6.3 Protecting File Systems
The system administrator must make sure that the file system is protected so that it is avail-
able as needed. Timely backups are one approach to protecting the contents of the file sys-
tems. A backup, perhaps stored on tape or to a separate file system (e.g., a file server/remote 
hard disk) allows the system administrator to replace damaged data files by a simple resto-
ration process. An alternative is to provide redundancy of the files stored in the file space 
so that files and error correction information are both stored. This can be done using 
RAID
(redundant array of inexpensive disks).
To support backups and redundancy, Linux has a number of useful programs. Two 
common programs are 
dump
and 
restore
. These two programs perform backups and 
restoration of entire file systems (as opposed to individual files and directories). By default, 
dump compares the previous backup to the current state of the file system to determine 
which files need to be backed up. This looks at the last modification date of each file com-
paring it to the date of the last backup. Any file that has not been previously backed up is 
new (since the last dump) and so is automatically backed up. The restore program is able to 
restore a full backup, an incremental backup (e.g., files backed up since a particular modi-
fication date), a specific file system, directory, or even single file.
You are able to control the performance of dump by providing a backup level (0–9) where 
0 indicates a full backup. With any other number, dump will back up all files that have not 
been backed up since the last time dump was run on this file system with a smaller level. For 
instance, if you run dump with 6 in one week and then run dump with 7 in the next week, 
then only those files modified in the past week are backed up. If however you run dump with 
5, then all files modified since your last dump run at levels 0–4 are backed up.
The dump program produces backup files in 10 KB block sizes. You can override this by 
specifying 
–B 
blocksize
. The maximum block size is 64 KB. You can also specify that dump 


The Linux File System

431
compress the backup files as they are being saved. You are also able to alter dump’s behavior 
based on the target location of the backup (e.g., remote hard drive, mounted tape drive).
Prior to performing a full or even incremental backup, you should switch to a text-based 
single user mode and unmount the file system(s) you intend to back up. It would also be 
wise to run fsck on the file system(s) before the backup is attempted.
Older programs for performing backups of files are 
tar
and 
cpio
. The tar program, 
tape archive, was originally intended to copy files into an archive to be stored on tape for 
backup purposes. Today, tar is just as commonly used to bundle programs together for 
convenient transmission over the Internet. The tar program expects either 
–cf
or 
–xf
to 
specify that a new archive should be created (c) or a current archive should be extracted (x). 
The -f option indicates that the target or source is a file. When extracted from an archive, 
you only specify the archive name but when creating an archive, you specify both the file 
to be created and the files/directories to be archived.
Here are a couple of examples of creating archives. In the first example, we are tarring 
a collection of files. In the second example, we are tarring all items under the user foxr’s 
home directory, including the directory itself.
• 
tar –cf archive.tar file1.txt file2.txt file3.txt *.dat
• 
tar –cf archive2.tar /home/foxr
If we untar archive2.tar using 
tar –xf archive2.tar
, we not only get all of the 
files that were placed in the tar file, but also the directory foxr. We would only untar this in 
some other directory, not /home because the target foxr would already exist. The tar com-
mand has numerous options. Table 10.7 describes some of the more common ones.
In order to archive to some externally mounted device such as a tape (or a floppy disk), 
you would specify the device’s name in place of the destination file. For instance
• 
tar –cf /dev/tape0 /home/foxr
• 
tar –cfM /dev/df0 /home/foxr
In the second example, the M option specifies that there will be multiple floppy disks used 
so that, when one disk is full, tar will pause for the user to replace the disk with a new floppy.
TABLE 10.7 
Common Options for tar

Download 5,65 Mb.

Do'stlaringiz bilan baham:
1   ...   158   159   160   161   162   163   164   165   ...   254




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish