文件系统
部件-A
问题一。写一个shell程序输入名称的目录,在目录中显示出来,扩展名为“所有txt文件的内容。”。
A1。
问题二。证明的声明:“Linux日志文件系统的支持。”
A2。文件系统是操作系统中最重要的部分之一。该文件系统存储和管理磁盘驱动器上的用户数据,并确保从存储中读取的数据与原先写的是相同的。除了在文件中存储用户数据,文件系统还创建和管理有关文件和关于自己的信息。除了保证所有数据的完整性,文件系统也将是非常可靠的,并且具有非常良好的性能。
在过去的几年中,ext2事实上已经成为Linux机器的文件系统。这是强大的,可靠的,适合大多数部署。然而,作为Linux在越来越多的大型服务器和计算环境渐渐取代UNIX等操作系统,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#分页标题#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#分页标题#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.