文件系統(tǒng)
部件-A
問題一。寫一個(gè)shell程序輸入名稱的目錄,在目錄中顯示出來,擴(kuò)展名為“所有txt文件的內(nèi)容。”。
A1。
問題二。證明的聲明:“Linux日志文件系統(tǒng)的支持。”
A2。文件系統(tǒng)是操作系統(tǒng)中最重要的部分之一。該文件系統(tǒng)存儲和管理磁盤驅(qū)動器上的用戶數(shù)據(jù),并確保從存儲中讀取的數(shù)據(jù)與原先寫的是相同的。除了在文件中存儲用戶數(shù)據(jù),文件系統(tǒng)還創(chuàng)建和管理有關(guān)文件和關(guān)于自己的信息。除了保證所有數(shù)據(jù)的完整性,文件系統(tǒng)也將是非常可靠的,并且具有非常良好的性能。
在過去的幾年中,ext2事實(shí)上已經(jīng)成為Linux機(jī)器的文件系統(tǒng)。這是強(qiáng)大的,可靠的,適合大多數(shù)部署。然而,作為Linux在越來越多的大型服務(wù)器和計(jì)算環(huán)境漸漸取代UNIX等操作系統(tǒng),EXT2被推到了極限。
The file system
PART-A
Q1. Write a Shell program that inputs the name of a directory and displays the contents of all files in that directory that have the extension ".txt".
A1.
Q2. Justify the statement: "Linux supports journaling file systems."
A2. The file system is one of the most important parts of an operating system. The file system stores and manages user data on disk drives, and ensures that what's read from storage is identical to what was originally written. In addition to storing user data in files, the file system also creates and manages information about files and about itself. Besides guaranteeing the integrity of all that data, file systems are also expected to be extremely reliable and have very good performance.
For the past several years, Ext2 has been the de facto file system for most Linux machines. It's robust, reliable, and suitable for most deployments. However, as Linux displaces Unix and other operating systems in more and more large server and computing environments, Ext2 is being pushed to its limits. In fact, many now common requirements - large hard-disk partitions, quick recovery from crashes, high-performance I/O, and the need to store thousands and thousands of files representing terabytes of data - exceed the abilities of Ext2.
Fortunately, a number of other Linux file systems take up where Ext2 leaves off. Indeed, Linux now offers four alternatives to Ext2: Ext3, ReiserFS, XFS, and JFS. In addition to meeting some or all of the requirements listed above, each of these alternative file systems also supportsjournaling, a feature certainly demanded by enterprises, but beneficial to anyone running Linux. A journaling file system can simplify restarts, reduce fragmentation, and accelerate I/O.#p#分頁標(biāo)題#e#
Q3. Demonstrate the use of "chmod" and "chown" commands with suitable examples. Also demonstrate how applications/commands can be configured to run with administrative level privileges under non-administrative user account.
A3. CHMOD command is used to change file access permission such as read, write and execute and to change the access mode of a file. This command comes in many flavors but we will be talking primarily about one of them.
Chmod who=permissions filename
This gives "who" the specified permission for a given filename.
CHOWN command is used to change file owner and group information. For example, the following command will setup user and group ownership to root user only for backup directory:
# chown root:root /backup
Set user ownership to root user and allow any member of ftp group to access file.txt (provided that they have sufficient read/write rights).
#chown root:ftp /home/data/file.txt
Giving administrative level privileges to non-administrative user accountsè
In Linux based systems, root is the main user of the system and root can execute all commands. From system administration point of view, it is never recommended that you should work as a root user, as any wrong command executed can corrupt your whole configuration. In Linux, the root user is disabled by default for the security reasons, this is wheresudocomes in - it allows authorized users to run root commands without having to know the root password. But only those users can run sudo commands or can perform system administration tasks that has the privileges to do so. Lets see how can add any administrator user in Linux.
Go toSystem > Administration > Users and Groups. This is the dialogue box from where you can add or delete any user and you can also manage the groups settings from here.
Now, select the user you want to assign administrative privileges and clickProperties.For the example, I want to assign the administrative privileges to thetestuser.Account Propertiesbox will be opened, you can set password for this user from here.
Now, click theUser Privilegestab and checkAdminister the systemoption.
PART-B
Q4. Once a removable disk is inserted into the disk drive and is mounted, the eject button of the drive stops working. Suggest some way to get out of this problem. Also, write commands or steps to configure/load a USB Drive.
A4. Here, we take the example of a CDROM that we have inserted. It gets mounted on the system. Let's suppose that the mount point of the disk is /mnt/cdrom. We will have to apply the following command in order to unmount the diskà#p#分頁標(biāo)題#e#
Umount /mnt/cdrom
The basic ides behind this command is that we have to tell the system to unmount the device on the stated mount point.
Steps to configure a USB drive:-
?First log in as a root user.
?Then make a mounting directory for the USB drive by command:-
# Mkdir /mnt/flash
?Use on of the following commands to mount the USB drive:-
# mount -a -t msdos /dev/sda1 /mnt/flash
Or
# mount -t vfat /dev/sda1 /mnt/flash
Q5. Compare the facilities of the "find" command in Linux to those of the "find" command in DOS.
A5.
Q6. Demonstrate the purpose and usage of the "fsck" utility and related tools.
A6. The system utilityfsck(for "filesystemcheck") is a tool for checking the consistency of afile systeminUnixandUnix-like operating systemssuch asLinux.
Generally, fsck is run automatically at boot time when the operating system detects that a file system is in an inconsistent state, indicating a non-graceful shutdown, such as acrashor power loss. As the command must be tailored specifically to the design of the file system, the exact behavior of various fsck implementations will vary. Typically, fsck utilities provide options for either interactively repairing damaged file systems (the user must decide how to fix specific problems), automatically deciding how to fix specific problems (so the user doesn't have to answer any questions), or reviewing the problems that need to be resolved on a file system without actually fixing them.
Asystem administratorcan also runfsckmanually if there is believed to be a problem with the file system. Because running fsck to repair a file system which is mounted for read/write operations can potentially cause severe data corruption/loss, the file system is normally checked while unmounted, mounted read-only, or with the system in a special maintenance mode that limits the risk of such damage.
Ajournaling file systemis designed such that tools such as fsck do not need to be run after unclean shutdown (i.e. crash). TheUFS2Filesystem inFreeBSDhas background fsck, so it is usually not necessary to wait for fsck to finish before accessing the disk.
TheMicrosoftequivalent programs areCHKDSKandSCANDISK.