8. Disk and File System Management

¡Supera tus tareas y exámenes ahora con Quizwiz!

xz

-z Compresses a file. -d Decompresses a file -k Keeps the original file unchanged *This is the same as the tar -J command. e.g. xz fileCompresses the archive file and removes the original file. xz -k fileCompresses the archive file, but leaves the original file unchanged. xz -d file.gzDecompresses the archive file.

What is the file path and name of the directory that contains device files for hard drives, optical drives, and USB devices?

/dev The /dev directory contains device files for hard drives, optical drives, and USB devices. The /dev directory contains files for all types of devices, even those that do not exist on the system.

What is the typical default umask value?

022 The default umask value is typically 022 (but some distributions vary from this standard). A umask changes (removes) the default file and directory permissions. By default, files receive rw-rw-rw- (666) permissions, and directories receive rwxrwxrwx (777) permissions when they are created. In most cases, the default assignment gives excessive permission to files and directories.

bzip2

-z Compresses a file. -d Decompresses a file -k Keeps the original file unchanged *This is the same as the tar -j command. e.g. bzip2 file.tarCompresses the tar archive file and removes the original file. bzip2 -k file.tarCompresses the tar archive file, but leaves the original file unchanged. bzip2 -d file.tar.bz2Decompresses the tar archive.

Which of the following is the maximum number of GUID partitions that can be created using the gdisk utility? 8 128 64 32

128 If you use gdsik to manage GUID partitions on a Linux system, you can create up to 128 partitions on each hard disk.

8.1.5 Device Naming Facts

A Linux administrator should understand how a Linux system implements different types of storage devices. This lesson covers the following topics: Storage device types Linux storage device files

8.1.7 Practice Questions

CIST 2431

8.2.4 Practice Questions

CIST 2431

8.3.5 Practice Questions

CIST 2431

8.4.9 Practice Questions

CIST 2431

8.5.6 Practice Questions

CIST 2431

New Technology File System (NTFS)

Thefile system used by Microsoft operating systems.

Which of the following is the maximum number logical partitions allowed on an extended partition? 1 2 4 Unlimited

Unlimited Extended partitions can be subdivided into an unlimited amount of logical drives. There can be only be one extended partition on a single hard disk drive.

MBR Partition Tools

Use the following tools to create and manage partitions:

/dev/lpn

lp files identify parallel ports. Device numbering begins at 0. Files for subsequent parallel ports are represented by files that increment by one (for example, the file for parallel port two is /dev/lp1, and so on).

8.11 Special Permissions

As you study this section, answer the following questions: On which types of files should you configure the SUID and SGID bits? What is the purpose of setting the sticky bit? Which special permissions would be set using chmod 6421? In this section, you will learn to: Set or remove special permissions. Key terms for this section include the following:

8.9 Permissions

As you study this section, answer the following questions: What is a file mode? Which user accounts can change a file's mode? What permissions does 764 represent (when identifying permissions numerically)? What does the first dash represent in -rwxrw-r--? What are the default permissions for files and directories? In this section, you will learn to: Set directory permissions. Add file permissions. Set file permissions. Enable directory browsing. Key terms for this section include the following:

8.7 Disk Quotas

As you study this section, answer the following questions: What is the difference between a soft block limit and hard block limit? What is the difference between block quotas and inode quotas? What tool do you use to create the aquota.user and aquota.group files in the file system? How would you generate a quota report to display how much space is used by users on the system? In this section, you will learn to: Find the user quota. Generate a quota report. Turn quotas on and off. Edit quotas. Key terms for this section include the following:

8.10 The umask Command

As you study this section, answer the following questions: What is the function of umask? What does the umask value represent? In which file should you set the umask value to make it persistent? When configuring umask, what is the difference between using numbers or symbols? In this section, you will learn to: Change the umask settings to control access. Key terms for this section include the following:

8.12 Archive and Backup

As you study this section, answer the following questions: What type of file would the file marketing.tar.gz represent? Which tar command option decompresses a file? Which utilities can decompress a file with a .bz2 extension? When would you use the dd command to copy information instead of the cp command? In this section, you will learn to: Use tar to create a compressed tar file. Use tar to extract files from a tar file. Key terms for this section include the following:

quotaoff

Disables quotas for the mounted file system. e.g. quotaoff /home disables quotas for the /home directory.

About Disk Quotas

Disk quotas prevent a user or group from using a disproportionate amount of disk space on a volume.Quotas can be configured to: Limit the number of files and directories a user or group can create. Limit the amount of disk space a user or group can use. Quota types include the following: A soft limit allows the user to temporarily exceed a quota limit. A hard limit is a fixed limit that the user cannot exceed.

ls -l

Displays a long file listing. A long file listing shows the permissions for the files (among other information). e.g. drwsr-xr-x 22 root root 4096 Jun 19 15:01 sales (This is a script with 4755 as its mode and has the SUID set.)

Ownership

Every file is owned by a specific user (or UID) and a specific group (or GID).

File System Integrity Commands

Use the following commands to maintain file system integrity:

Managing Special Permissions

Use the following commands when managing special permissions:

Install quota package

Use yum, zypper, or apt-get to install the quota package on the system where quota limits will be set.

8.7.11 Edit Quotas 2

Users have complained that the seven-day default grace period for soft limits is too short. In this lab, your task is to: Increase the block and file (inode) grace period for users from 7 to 30 days. After you've finished, generate a quota report to confirm the changes. Complete this lab as follows: > At the prompt, type edquota -u -t and press Enter to open the user soft quota grace period file. > Press 1 and press Enter to open the editor. > Move the cursor under Block grace period, delete the 7. > Type 30. > Move the cursor under Inode grace period, delete the 7. > Type 30. > Press Ctrl + x to exit the editor. > Press the Y key to save your changes. > Press Enter. > Type repquota -a and press Enter to generate the report and confirm the changes.

Read

Letter Abbreviation: r Octal Value: 4 Allowed Actions on Files: Open and read the file Allowed Actions on Directories: List directory contents if the execute permission is also present

dumpe2fs

Prints super block and block information for an ext2, ext3, or ext4 file system. This includes information for each sector on the partition about sector type, block ranges, inode information, free blocks, and similar information. Command options include: -b prints blocks reserved as bad in the file system. -h prints only super block information. -x prints group information block numbers in hexadecimal format. e.g. dumpe2fs /dev/sda1Lists information for the first partition of the first hard drive.

ls -l

View a long listing of files and directories. A long listing displays the permissions assigned to files and directories (among other information) e.g. drwxr-xr-x 22 root root 4096 Jun 19 15:01 sales(This is a directory with 755 permissions assigned.)

ls -l

View a long listing of files and directories. The long listing shows the mode of each file and directory along with ownership information. e.g. drwxr-xr-x 22 root root 4096 Jun 19 15:01 sales(Root is the file owner and the group owner in this example.)

After creating the aquota.user and aquota.group files in the /home directory, what command should you enter to enable quotas for the /home directory?

quotaon /home quotaon /home enables quotas for the /home directory. Use quotaon to enable quotas for the mounted file system. -a enables all mounted file systems listed in /etc/mtab. -v runs the command in verbose mode.

Type the full device file name for the second partition on the hard drive with the lowest ID number.

/dev/sda2 /dev/sda2 is the second partition (2) on the hard drive with the lowest ID number (a). /dev/sdxn file names identify hard drives. A letter follows the sd designation and identifies the ID of the hard drive. At the end of the name, a number identifies the partition on the drive.

Which of the following directories is specified by Filesystem Hierarchy Standard (FHS) as a mount point for removable media, such as USB storage media, DVDs, CD-ROMs, and Zip disks? /media /mnt /mount /

/media /media is specified by Filesystem Hierarchy Standard (FHS) as a mount point for removable media, such as USB storage media, DVDs, CD-ROMs, and Zip disks. /mnt is often used for temporarily mounted filesystems. / represents the root directory of the Linux system and is not recommended as a mount point for removable media. /mount is not specified in the Filesystem Hierarchy Standard (FHS).

Bad blocks

A bad block is a section on a disk drive to which data can no longer be written to read from.

Differential backup

A differential backup copies all of the files that have been updated since the last full backup.

GUID

A globally unique identifier or number that is used to uniquely identify an object.

Partition

A region on a hard disk that can be managed by an operating system.

Logical partition

A partition contained in an extended partition.

Partition Types

A partition is a logical division of a storage device associated with a hard disk drive. A storage device using an MBR can have a single partition or multiple partitions. The most common partitioning scheme divides a disk into two different partition types:

Swap file

A partition that the operating system uses as virtual memory.

Logical volume

A portion of the volume group that can be formatted to accommodate a file system.

Image backup

A single computer file or set of files that contain the contents of a hard disk.

8.10.5 Practice Questions

CIST 2431

Create quota files

Create the aquota.user and aquota.group files in the directory where the partition is mounted.

About umask

Each file on your system has a set of permissions associated with it which are used to protect files. For example, file permissions determine which users may access that file, and what type of access they have to the file, such as being able to read, write, and execute the file. When a user creates a file or directory, it's created with a default set of permissions. In some cases the system defaults may be open or relaxed for the purpose in which the file or directory was created. For example, if a file has been given the default permissions of 666, then read/write permissions (rw-rw-rw-) have been granted to everyone. Similarly, a directory with the default permissions of 777 is granted the read/write/execute permissions (rwxrwxrwx) to everyone. A new file's permissions may be restricted by applying a permissions "mask" called the umask.

Storage Device Types

Linux systems accommodate many types of storage.

Physical volume

Physical block devices or other disk-like devices that LVM uses as the building blocks for volume groups.

SFTP

SFTP (SSH File Transfer Protocol or Secure File Transfer Protocol) is packaged with SSH, and works over a secure connection. It has the ability to leverage a secure connection to transfer files between the local and remote systems. SFTP is usually preferred over FTP because of its security features and ability to piggy-back on an SSH connection.

Permissions

The ability to grant a user read, write, and execute for a file and directory.

Free disk space

The area of a hard disk to which new data can be written.

Using dd

The dd command stands for "data duplicator" and is used to copy and covert data. The dd command can be used for tasks such as: Backing up and restoring the entire hard disk or partition Backing up the Master Boot Record (MBR) To copy and convert magnetic tape format To convert between ASCII and EBCDIC formats To convert lower case to upper case The syntax of dd is: dd options=value

rsync

The rsync tool can copy local files from/to a remote host using a remote shell - SSH - or a remote rsync daemon. It is a file copying tool with the capability of reducing the amount of data transferred, making replicas, copies and backups. To make it even more difficult for others to access your data, there's the option to harden SSH, improving security.

8.7.9 Turn Quotas Off

The system is running hard disk quotas for users and groups. In this lab, your task is to disable the quotas on the root directory (/). Complete this lab as follows: At the prompt, type quotaoff /. Press Enter to disable quotas on the root directory.

Disk Quotas Commands

The table below describes common commands for working with quotas:

umask

The value used to restrict the permissions for a file or directory.

Backup Types

There are different types of backup that you should be familiar with. Each type has their own pros and cons, so consider which scenario works best for you.

8.8.3 File Ownership Facts

This lesson covers how to change the ownership on files and directories.

quotacheck -mavug

To create the aquota.user and aquota.group files in the file system (after placing the quota entries in /etc/fstab). Common options include: -m updates the quota database even if other processes are running on the file system. -a updates the quota database. -v runs the command in verbose mode. -u and -g run the database updates for users and groups, respectively. e.g. quotacheck -mavug /home creates the aquota.user and aquota.group files in the root (/) directory.

8.7.8 Turn Quotas On

To prevent the users from using too much disk space, you've implemented hard and soft quotas on the root directory (/). Today, you noticed that the quotas are turned off. In this lab, your task is to re-enable quotas for users and groups on the root directory (/). Complete this lab as follows: At the prompt, type quotaon /. Press Enter to enable quotas for the root directory.

8.12.3 Create a Compressed tar File

You need to send a backup copy of the /etc directory across the network. To create the file, use the tar command with the -cf switches to create a new archive file. Use -z as the preceding option to compress the file. In this lab, your task is to: Create a compressed archive of the /sales directory and all its contents Name the file /salesbkp.tar.gz and save it in the root directory (/). Complete this lab as follows: At the prompt, type tar -zcf /salesbkp.tar.gz /sales. Press Enter to create the compressed tar file.

There is a directory called projects owned by the user cmarcela and the group rd. cmarcela has left the company. You need to give ownership of the projects directory, its files, and its subdirectories to the user ebates, who is a member of the mgmt group. Which of the following commands should you use to change the user ownership? chgrp -R mgmt projects chown ebates projects chown -R ebates projects chown .ebates projects chown -R ebates.mgmt projects

chown -R ebates projects The chown -R ebates projects command allows you to change the user ownership for the project directory recursively (-R). The chown ebates projects command changes ownership only for the projects directory, not for its files or subdirectories. The chgrp -R mgmt projects command changes the group ownership of the projects directory recursively. The chown -R ebates.mgmt projects command changes user and group ownership of the directory recursively.

Which command should you enter at the command prompt to change the quota settings for the gshant user?

edquota -u gshant Use edquota -u gshant to open and edit the quota file for the gshant user account. Use edquota to edit a user's quota, a group's quota, or change the grace period. Be aware of the following options: -u changes the user's quota. -g changes a group's quota. -t changes the grace period. Some distributions may omit the -u option. In that case, edquota gshant will also open the quota file for the gshant user account.

What is the name of the partition management utility that will both create GUID partitions and create file systems on those partitions?

parted The parted utility is a partition editor that allows you to create GUID partitions and then create file systems on those partitions. You can use gdisk to create partitions, but you cannot use it to create file systems.

You have added a third hard disk to your Linux system. What command would you use to initialize a physical volume on this disk for later use by the Logical Volume Manager?

pvcreate /dev/sdc Enter pvcreate /dev/sdc to initialize a physical volume on the third hard disk for later use by LVM.

You created a swap area on sda3, but it is not activated. What command will activate this swap partition?

swapon /dev/sda3 Use swapon /dev/sda3 to activate the swap partition. Use swapon -a to activate all swap partitions listed in /etc/fstab. (A swap partition is the location on the hard drive where an operating system writes memory information when it runs out of RAM.)

Sticky bit

t in the execute permission position of the other permissions e.g. rwxrw-rwt Octal Value: 1 This marks the file in such a way as to prevent the file's deletion from the system by anyone except the file owner. Setting the sticky bit works particularly well with shared files. Sticky bits can also be set on directories.

tar

-A Appends one tar file to another archive file. -c Creates a new archive. -d Identifies differences between the files in an archive file and the same files in the file system. -v Displays a list of all files being written into the archive. -f Specifies the file to create or unpack. Without this option, tar uses standard input and output as the destination. -x Extracts the files. If no destination directory is specified, then tar extracts the files to the current working directory. -z Compresses and decompresses a file using the gzip utility (normally named with a .gz extension). -j Compresses and decompresses a file using the bzip2 utility (normally named with a .bz2 extension). -J Compresses and decompresses a file using the xz utility (normally named with a .xz or .lzma extension. -C Changes to a specific directory to extract the files. -t Lists the contents of an archive. -P Tells tar to not strip the leading / from filenames as they are added to the archive. -r Adds files to the end of an existing tar archive. -u Adds files to the end of an existing tar archive only if they are newer than the existing files in an archive. -X file_name Causes tar to exclude the file names contained in the specified file when creating an archive file. e.g. tar -cf /root/tarbackups/oct17backup.tar /homeWrites a backup of the /home directory to the /root/tarbackups/oct17backup.tar file. tar -cvf /root/tarbackups/oct17backup.tar /homeWrites a backup of the /home directory to the /root/tarbackups/oct17backup.tar file with verbose output. tar -xvf /root/tarbackups/oct17backup.tar -C /homeExtracts the files and decompresses them to the /home directory.

Which of the following repquota options will give quota limits and disk usage for all file systems listed in /etc/mtab? -n -a -v -u

-a repquota -a gives information for all file systems listed in /etc/mtab. Be aware of the other common repquota options: -v reports all quotas, even if there is no usage. -n does not resolve user and group names to speed printing time. -u and -g report on users and groups respectively.

You are inspecting the superblocks and block information on your file system. You need dumpe2fs to display only the blocks that are reserved as bad in the file system. Which of the following options should you use? -x -h -b -f

-b Use dumpe2fs -b to print the blocks that are reserved as bad in the file system. dumpe2fs prints superblock and block information for an ext2, ext3, or ext4 file system. This includes information for each sector on the partition about sector type, block ranges, inode information, free blocks, and similar information. Other dump32fs command options include the following: -h prints only super block information. -f forces dumpe2fs to display a file system even though it may have some file system feature flags the system may not understand. -x prints group information block numbers in hexadecimal format.

Your ext3 file system has experienced a significant amount of corruption. To examine the file system, you want to use the debugfs utility. Which of the following debugfs options should you use to examine the file system? -f -w -V -c

-c Use debugfs -c to specify the file system should open in catastrophic mode. debugfs is useful for file systems with significant corruption. debugfs examines and changes the state of an ext2, ext3, or ext4 filesystem. It allows administrators to unlink directories, change inode blocks, find all inodes that point to a block, and several other similar functions. Other debugfs command options include the following: -w specifies the filesystem should open in read-write mode. -f executes commands in a text file. -Z prints the version number of debugfs and exits.

gzip

-c Writes the file to standard output. -d Decompresses the file. -l Displays information about files in an archive. -r Recursively compresses all files in directories and subdirectories. *This is the same as the tar -z command. e.g. gzip file.tarCompresses an archive file created with tar. The original uncompressed file is removed. gzip -c file.tar > file.tar.gzCompresses a tar archive, but leaves the original file unchanged. gzip -d file.tar.gzDecompresses the tar archive.

zip

-d Removes a file from the zip archive. When a zip archive includes multiple files, use this option to remove a file from the archive. -u Updates the file in the zip archive. The opposite of -d, meaning you can use this option to add a new file to the zip file already created. -m Deletes the original files after zipping. -r Lets you zip a directory recursively. -x Lets you exclude the files files while creating the zip of multiple files, such as a directory. -v Verbose mode or print diagnostic version information. e.g. zip -r my.zip mydirWill recursively zip the files in the mydir directory. The results are saved to the my.zip file. zip -m my.zip myfile.txtWill compress the myfile.txt file into the my.zip file. It will then delete the myfile.txt file.

You are compressing a file with the tar utility, but you need to ensure you can uncompress the file with the bzip2 utility. Which tar option should you use during the file compression? -j -z -v -x

-j Use tar -j to compress a file that can later be decompressed using the bzip2 utility (normally named with a .bz2 extension). Be aware of the other tar options: -v displays a list of all files being written into the archive. -z compresses/decompresses a file using the gzip utility (normally named with a .gz extension). -x extracts the files. If no destination directory is specified, tar extracts the files to the current working directory. -f specifies the file to create or unpack. Without this option, tar uses standard input and output as the source or destination. -c creates a new archive. -C changes to a specific directory to extract the files.

You need to view the files within /home/gshant/expfile.bz2, but you want to leave the compressed file unchanged. Which bzip2 option should you use?

-k Use bzip2 with the -k option to leave the compressed file unchanged.

cpio

-o Creates the archive in copy-out mode. -v Causes cpio to display verbose output, showing file names as they're added or removed.-iExtracts files by invoking copy-in mode. -u Overwrites existing files. -d Creates directory paths (if needed) during extraction. -t Displays archive contents without extracting files. -p Copies files to a new directory (copy-pass mode). e.g. ls ~/4archive | cpio -ov > filename.cpioCreates a cpio archive from the files in the ~/4archive directory. cpio -iv < filename.cpioExtracts the files from the cpio archive. ls ~/copyme | cpio -pvd ./newdirectoryCopies files from ~/copyme to ./newdirectory.

You suspect your /dev/sda3 partition is in need of repair. Which of the following e2fsck options will repair the errors without any interaction from you? -f -b -n -p

-p Use e2fsck -p to automatically repairs the ext2 file system without any interaction from you. Use e2fsck to check and optionally repair a second extended file system (ext2) or ext2 files systems containing a journal (ext3). Other e2fsck options include the following: -f forces a file system check, even when the file system appears clean. -n opens the file system as read-only and automatically answers all questions no. -y automatically answers all questions yes. -b uses an alternative superblock if the primary superblock is corrupt.

You have a critical file called yearend.xls. You have set the file permissions so that only the owner of the file can modify it and only group owners can read it. Which of the following file listings show that you have set the permissions correctly? -r--r--r-- 1 george acctg 26256 June 1 04:16 yearend.xls -r-xr-x--- 1 george acctg 26256 June 1 04:16 yearend.xls -rw-r----- 1 george acctg 26256 June 1 04:16 yearend.xls -rwxrwxr-- 1 george acctg 26256 June 1 04:16 yearend.xls

-rw-r----- 1 george acctg 26256 June 1 04:16 yearend.xls The permissions of -rw-r----- allows the user to read or write to the file, the group to only read the file, and nobody else any rights to the file. The permissions of -rwxrwx--- allows the user and group full rights to the file and no rights to anyone else. The permissions of -r-xr-x--- allows the user and group read and execute rights to the file and no rights to anyone else. The permissions of -r--r--r-- allows the user, group, and the world read-only rights to the file.

You have an application whose owner is root, but you want all users to execute the application with root user permissions. Which of the following examples shows correct usage of the SUID flag? -rwsr--r-- 3 root sys 73748 Nov 2 2005 /usr/bin/applicationx -rwxr-sr-- 3 root sys 73748 Nov 2 2005 /usr/bin/applicationx -rwxr-sr-s 3 root sys 73748 Nov 2 2005 /usr/bin/applicationx -rwxr--r-s 3 root sys 73748 Nov 2 2005 /usr/bin/applicationx

-rwsr--r-- 3 root sys 73748 Nov 2 2005 /usr/bin/applicationx Placing the s in the execute bit location for the owner's permissions , as shown in -rwsr--r--, means that anyone or any process that executes the application will do so with root user permissions.

You have an application whose group is sys, but you want all users, whether or not they are members of the sysadmin group, to execute the application with sysadmin group permissions. Which of the following examples shows correct usage of the SGID flag? -rwxr--r-s 3 root sysadmin 73748 Nov 2 2005 /usr/bin/applicationx -rwxr-sr-s 3 root sysadmin 73748 Nov 2 2005 /usr/bin/applicationx -rwsr--r-- 3 root sysadmin 73748 Nov 2 2005 /usr/bin/applicationx -rwxr-sr-- 3 root sysadmin 73748 Nov 2 2005 /usr/bin/applicationx

-rwxr-sr-- 3 root sysadmin 73748 Nov 2 2005 /usr/bin/applicationx Placing the s bit in the execute location for the group's permissions, as shown in -rwxr-sr--, means that anyone or any process that executes the application will do so with the sysadmin's group permissions.

You are preparing to mount a device local to your system. Which directory holds the device files? /local/dev /opt/dev /devices /dev

/dev The files for devices are always stored in /dev according to the FHS. The FHS does not define the directories /local/dev, /opt/dev or /devices for storing device files.

You need to configure your Linux system to allow only the root user account to mount the CD-ROM device. Which of the following options should you add to the /etc/fstab file? /dev/cdrom /media/cdrom -t iso9660 ro,user,noauto /dev/cdrom /media/cdrom -t iso9660 ro /dev/cdrom /media/cdrom -t iso9660 ro,users,noauto /dev/cdrom /media/cdrom -t iso9660 ro,nouser,noauto

/dev/cdrom /media/cdrom -t iso9660 ro,nouser,noauto Use /dev/cdrom /media/cdrom -t iso9660 ro,nouser,noauto to allow only the root user account to mount the CD-ROM device. -t iso9660 specifies the type as filesystem structure used on CD-ROMs. Be aware of the following mount options: nouser allows only the root user to mount the volume. noauto prevents the volume from being mounted automatically. Use this option for removable media. ro mounts the volume read only. user identifies a specific user who can mount the volume. users allows any user to mount the volume. rw mounts the volume read/write. suid allows the SUID bit to be set on files in the volume. (nosuid disables this function.) defaults uses the following default settings: rw, suid, dev, exec, auto, nouser, and async.

You want to mount a number of file systems each time the system is brought up. Which configuration file should hold the configuration information for the file systems to be mounted? /etc/mount /etc/profile /etc/inittab /etc/fstab

/etc/fstab /etc/fstab holds the file system table configuration of all filesystems to be mounted during normal operations. /etc/profile stores system-wide configuration commands and is used primarily to set environment variables. /etc/inittab determines the default runlevel for the system and starts the appropriate daemons for that runlevel. /etc/mount is not defined to show mounted file systems.

What is the full path and filename of the file that contains the file system table for a Linux system?

/etc/fstab The Linux file system table (fstab) is file located at /etc/fstab. The /etc/fstab file identifies volumes to mount each time the system boots. When the system boots, it automatically mounts the volumes identified in the file.

You need to implement disk quotas on your Linux system. You need the quotas on the / directory. What is the full path and name of the file that must be edited to implement quotas for users and groups?

/etc/fstab You must edit the /etc/fstab file to add the mount options for the file system so it can implement quotas. Add the following mount options for each applicable file system: usrquota implements quotas for users. grpquota implements quotas for groups.

Which file shows the currently mounted volumes? /etc/mtab /etc/mount /etc/fstab /etc/mount.conf

/etc/mtab The /etc/mtab file shows the currently mounted volumes. /etc/fstab controls which volumes are mounted at boot. /etc/mount and /etc/mount.conf are not defined by FHS to show mounted filesystems.

Which of the following sets of octal permissions would allow everyone to execute the following file as if they were the root user? -rwxr-xr-x 1 root root 8045 July 24 2018 myscript 4755 Correct Answer: 1655 Correct Answer: 0755 Correct Answer: 4744

4755 4755 is correct because it sets the SUID bit for everyone to execute the file as if they were the root user. File permissions can be displayed in a number of ways. The traditional method is rwxrwxrwx. With this method, r means read, w means write, and x means execute. These permissions are displayed for the user owner (first set), group owner (second set) and the world, or everyone (third set). Permissions can also be converted into binary using three bits, one for read, one for write, and one for execute. In this notation, rwxrwxrwx would be 111111111. Displaying the permissions in binary is a bit long-winded, so binary permissions are often converted into octal numbers (digits 0-7). In octal, rwxrwxrwx would be represented as 777 (111 binary = 4+2+1 = 7 octal). A fourth group of rwx (111 binary or 7 octal) can be appended to the beginning of the permissions to set SUID (100 binary or 4 octal), SGID (010 binary or 2 octal), and/or the sticky bit (001 binary or 1 octal). This is represented as 0777 octal if none of these are set. 0755 is incorrect because even though everyone can execute the file, it will be executed with the permissions of the user that executes it. 4744 is incorrect because even though the SUID bit is set, only the user owner can execute it. 1655 is incorrect because the group owner and everyone can execute it, but it will be executed with the permissions of the user that executes it.

For Linux files, the default permission is 666, and the default umask is 022. When a new file is created, it will be assigned 644 (rw-r--r--) permissions. If the umask is set to 027, what permissions will be assigned for newly created files? 660 (rw-rw----) 640 (rw-r-----) 666 (rw-rw-rw-) 644 (rw-r--r--)

640 (rw-r-----) A default file permission of 666 and umask of 027 results in 640 (rw-r-----). 660 (rw-rw----) has a umask of 007. 644 (rw-r--r--) has a umask of 022. 666 (rw-rw-rw-) has a umask of 000.

You are called into the office of a newly hired manager. He has copied a file from his old place of work onto his new workstation, but is now receiving an error message that access is denied each time he tries to access the file. He is not the owner of the file or a member of the group the file is associated with. Which of the following represents the LEAST set of file permissions needed for him to be able to read and write to the file? 111 222 444 666

666 Because he is not a member of the group or the owner of the file, the only set of permissions applying to the manager is the last number. The ability to read the file has a value of 4, while the ability to write to the file has a value of 2. Adding the two together, the needed permission for the user is 6.

Calculating umask

> Unmask Calculation: Default Permission For Files (binary): 666 For Directories (binary): 777 For Files (letter abbreviation): rw-rw-rw- For Directories (letter abbreviation): rwxrwxrwx > Unmask Calculation: Umask (minus) For Files (binary): 022 For Directories (binary): 022 For Files (letter abbreviation): ----w--w- For Directories (letter abbreviation): ----w--w- > Unmask Calculation: Result (equals) For Files (binary): 644 For Directories (binary): 755 For Files (letter abbreviation): rw-r--r-- For Directories (letter abbreviation): rwxr-xr-x Additional umask example calculations are described below: A umask of 066 results in file permissions of rw-------- (600) and directory permissions of rwx--x--x (711). A umask of 033 results in file permissions of rw-r--r-- (644) and directory permissions of rwxr--r-- (744). A umask of 011 results in no changes to file permissions (the x permission is already removed by default) and directory permissions of rwxrw-rw- (766).

badblocks

A bad sector or block is a section on a disk drive to which data can no longer be written to read from. Included by most Linux distributions, badblocks is used to search for bad blocks on a device (usually a disk partition), where the device is the special file corresponding to the device (e.g. /dev/sda). Command options include: -b block-size specifies the size of blocks in bytes. The default is 1024. -c number of blocks is the number of blocks which are tested at a time. The default is 64. -e max bad block count specifies a maximum number of bad blocks before aborting the test. The default is 0, meaning the test will continue until the end of the test range is reached. -i input_file reads a list of already existing known bad blocks. Badblocks will skip testing these blocks since they are known to be bad. -n uses non-destructive read-write mode. By default only a non-destructive read-only test is done. This option must not be combined with the -w option, as they are mutually exclusive. -o output_file writes the list of bad blocks to the specified file. -s shows the progress of the scan by writing out rough percentage completion of the current badblocks pass over the disk. -v Verbose mode. -w uses write-mode test. With this option, badblocks scans for bad blocks by writing some patterns (0xaa, 0x55, 0xff, 0x00) on every block of the device, reading every block and comparing the contents. This option may not be combined with the -n option, as they are mutually exclusive. -X an internal flag to be used only by e2fsck and mke2fs. It bypasses the exclusive mode in-use device safety check. *Warning Never use the -w option on a device containing an existing file system. This option erases data! If you want to do write-mode testing on an existing file system, use the -n option instead. It is slower, but it will preserve your data. e.g. badblocks -v /dev/sda2 > badsectors.txtChecks for bad blocks using the verbose mode and exports the results into a file named badsectors.txt

8.9.6 Add File Permissions

A change in company policy requires users in the hr group to make changes to the files in the /hr directory. In this lab, your task is to: Give the Write group permission to the files in the /hr directory in addition to any existing permissions. Use the ls command to verify the changes. Complete this lab as follows: At the prompt, type chmod g+w /hr/* and press Enter to add the write group permission to all files in the /hr directory. Type ls -la /hr and press Enter to verify the changes.

Full backup

A copy of all the files that exists at the point in time when the backup is taking place.

Secure Hash Algorithm (SHA)

A cryptographic hash function that takes an input and produces a 160-bit (20-byte) hash value known as a message digest. SHA is typically rendered as a 40-digit hexadecimal number.

SHA

A cryptographic hash function which takes an input and produces a 160-bit (20-byte) hash value known as a message digest - typically rendered as a hexadecimal number, 40 digits long. The SHA (Secure Hash Algorithm) algorithm is slowly replacing the MD5 algorithm.

Differential backup

A differential backup copies all of the files that have been updated, but only against the last full backup. An incremental backup would backup files changed since the last full or incremental backup. A differential backup will update files that have changed since the last full backup.

Image backup

A disk image is a single computer file or set of files that contain the contents of a hard disk. It is usually created by coping the disk sector-by-sector, instead of file-by-file. A disk image is often called a system image, especially when it is an image that contains a computer operating system. Image backups are an important part of a backup strategy, especially after software or system updates are installed.

Full backup

A full backup is a copy of all the files that exists at the point in time when the backup is taking place. If a backup took place last week, when a full backup runs again this week, every single file will be backed up again, even if nothing has been updated. This option can be expensive, given that each time a new backup runs, you will need, at the very least, double the amount of backup storage as you did before.

Set group ID up on execution (SGID )

A special file/directory permission given to a file. This permission grants a user temporary membership to a group so he or she can execute the directory, file, program, or command. A special type of file/directory permission given to a file that grants temporary permissions to a user to run a program/file with the permissions of the file group permissions to become member of that group to execute the file, e.g. users will get file group's permissions when executing a directory/file/program/command.

Set owner user ID on execution (SUID )

A special type of file permission given to a file. This permission grants a user temporary permission to run a program or file with the file owner's permissions.

Which of the following statements best describes the function of the repquota /home -vu command? A summary of disk usage and quotas is displayed for the users who have files within /home. The aquota.user and aquota.group files in /home are created. The /home quota file is opened in vi for editing. The current user's quota limits and usage for /home are displayed.

A summary of disk usage and quotas is displayed for the users who have files within /home. The repquota /home -vu command displays a summary of disk usage and quotas for those users who have files within /home. The repquota command displays a summary of the disk usage and quotas for the specified file systems, including the specific number of files and used space by user. Common options include the following: -v reports all quotas, even if there is no usage. -n does not resolve user and group names to speed printing time. -u and -g reports for users and groups respectively. -a gives information for all file systems listed in /etc/mtab. Use edquota to open and edit a user's quota, edit a group's quota, or change the grace period. Use quotacheck to create the aquota.user and aquota.group files in the file system. Use quota to display the current user's quota.

tune2fs

Adjusts tunable file system parameters on ext2, ext3, and ext4 file systems. Some of the adjustable parameters include volume label, reserved blocks, inode sizes, and journaling. Tune2fs can also implement access control lists for individual users. Command options include: -c adjust the number of mounts after which the file system will be checked. -e remount-ro remounts the file system as read-only. -l lists the contents of the file system super block. -o acl enables Posix access control lists. -j converts ext2 file systems to ext3 file systems. e.g. tune2fs -o acl /dev/sdb1Enables access control lists on the first partition of the second hard drive. The drive needs to be remounted.

Incremental backup

An incremental backup stores files that has been changed or added, since the last backup has been made. This type of backup can save a considerable amount of storage capacity, since only the updated files are backed up. In this scenario, every time a backup runs, only the files updated since the last backup are updated. Newly added files will also be backed up. This is a good option when running backups regularly.

Message Digest Algorithm 5 (MD5)

An algorithm that produces a 128-bit hash value.

8.9.5 Set Directory Permissions

An assistant administrator has been modifying permissions on the /hr directory. You want to quickly change the permissions on /hr to match the permission settings documented in your company's security policy. You must modify the directory permissions to be drwxr-xr-x (the octal equivalent of 111 101 101 = 755). In this lab, your task is to modify the permissions on the /hr directory as follows: User: Read, Write, Execute Group: Read, Execute Other: Read, Execute Complete this lab as follows: At the prompt, type chmod 755 /hr. Press Enter to set these permissions on the /hr directory.

Sticky bit

An attribute that marks a file or directory to prevent anyone except the file owner from executing deletion.

8.12.4 Extract from tar Files

An employee in another department recently provided several important files for your current assignment. The files are compressed in a tar file. Today, you need to extract each file and begin to use the files. In this lab, your task is to extract the files in /proj_files.tar.gz into the /projects directory. Complete this lab as follows: At the prompt, type tar -xzf /proj_files.tar.gz -C /projects. Press Enter to extract the files from the tar file and place them in the /projects directory.

debugfs

An ext2/ext3/ext4 file system debugger. Can be used for information gathering about target partitions, including directory listings with deleted file entries. Also allows file system modification and deleted file recovery. Command options include: -w the file system should be opened in read-write mode. If not included, the file system will be read-only. -c open the file system in catastrophic mode. This ignores inodes and group bitmaps initially. Useful when a file system has significant corruption. -f cmd_file will read in commands from the cmd_file and execute them. -V print the debugfs version number and exit. e.g. debugfs -w /dev/sdb1Opens the file system on sdb1 in read-write mode. debugfs -c /dev/sda1Opens the file system on sda1 in catastrophic mode.

Incremental backup

An incremental backup stores files that has been changed or added since the last backup has been made.

Inode

An inode is a data structure on a filesystem on Linux that stores all the information about a file except its name and its actual data. This includes such things as when it was last modified, size, data block location, permissions, and ownership.

8.8 Ownership

As you study this section, answer the following questions: Which user accounts can change file ownership? Which utility will display ownership information for files and directories? What are the two different methods you can use to change group ownership of a file? In this section, you will learn to: View ownership information. Change file ownership. Change group ownership for a file. Change directory ownership. Key terms for this section include the following:

8.6 File System Maintenance

As you study this section, answer the following questions: Which utility allows you to view the space available on all mounted file systems? What kinds of information can the lsof utility provide? What action must you perform before using the fsck utility? Which utility converts ext2 file systems to ext3 file systems? In this section, you will learn to: Determine the amount of free disk space. Determine the directory size. Key terms for this section include the following:

chmod

Assigns a special permission. Be aware of the following syntax options: > The special permission precedes the standard octal representation of a set of permissions. > Only the first number changes to identify the special permission group settings. > [category]+[permission] adds a special permission for a user, group, or other (category) to a file. > [category]-[permission] removes a special permission for a user, group, or other from a file. e.g. chmod 4xxx sets the SUID. chmod u+s sets the SUID. chmod u-s removes the SUID. chmod 2xxx sets the SGID. chmod g+s sets the SGID. chmod 1xxx sets the sticky bit. chmod u+t sets the sticky bit. chmod u-t removes the sticky bit. chmod 6xxx sets both the SUID and SGID. chmod 7xxx sets the SUID, GUID, and sticky bit.

About Special Permissions

Be aware of the following special permissions:

8.12.5 Archive Facts

Being able to backup, restore, and compress files will help in protecting and coping files and even disks or partitions. This lesson covers the following topics: Using tar Using gzip Using xz Using bkzip2 Using zip

8.8.5 Change File Ownership

Brenda Cassini (bcassini) is taking over payroll documentation for Will Adams (wadams). In this lab, your task is to give the bcassini user ownership of the /hr/payroll file. Use the ls -l command to verify the ownership changes. Complete this lab as follows: At the prompt, type chown bcassini /hr/payroll and press Enter to give bcassini ownership of the /hr/payroll file. Type ls -l /hr and press Enter to verify the change in ownership.

Calculating umask

By default, files receive rw-rw-rw- (666) permissions and directories receive rwxrwxrwx (777) permissions when they are created. In most cases, the default assignment gives excess permissions to files and directories. The umask value identifies which permissions are removed from the default permissions when files and directories are created. The following table shows what happens when the mask is set to a value of 022.

Changing File and Directory Ownership

By default, when a user creates a file or directory, the user and the user's primary group receive ownership for that file or directory. To change the user that owns a file, you must be logged in as root. To change the group that owns a file, you must be logged in as root or as the user who currently owns the file. The table below lists the most common commands for managing file ownership:

8.11.6 Practice Questions

CIST 2431

8.12.10 Practice Questions

CIST 2431

8.6.5 Practice Questions

CIST 2431

8.7.12 Practice Questions

CIST 2431

8.8.8 Practice Questions

CIST 2431

8.9.9 Practice Questions

CIST 2431

chgrp

Change the group owner of a file or directory. e.g. chgrp sales /sales/report makes the sales group the group owner of the file.

chown

Change the ownership of a file or directory. Be aware of the following options: -R changes the ownership of the file recursively throughout the directory tree. user changes the file ownership only. user:group or user.group change the user and group ownership of the file. :group or .group changes the group ownership only. e.g. chown pmorril /sales/report makes pmorril the user owner of the /sales/report file.chown -R pmorril /sales makes pmorril the owner of all files in the /sales directory (and below).chown pmaxwell:sales /sales/report makes pmaxwell the user owner and sales the group owner of the file.chown :sales -R /sales makes the sales group the owner of all files in the /sales directory.

chmod

Change the permissions for the specified file. You can use the following syntax options: entity+permission adds a permission for a user, group, or other to a file or directory. entity-permission removes a permission for a user, group, or other from a file or directory. entity=permission sets the permission equal to the permission specified for a user, group, or other for a file or directory. decimal_value sets the permissions for the file according to the numbers represented for each mode entity. -R sets permissions recursively. e.g. chmod u+x,g+x,o+x myfile adds the execute permission to the myfile file for user, group, and other.chmod g-w,o-w myfile removes the write permission for group and other from the myfile file.chmod u=rwx myfile grants the user read, write, and execute permissions for the myfile file.chmod 711 myfile grants the user read, write, and execute permissions (7) while group and other both receive execute permission (1) for the myfile file.

You are asked to help a user who is complaining that file system errors are being reported during boot-up. When you reboot the user's system, you see errors on sda2. Which of the following strategies will check the file system on sda2 and fix the errors? Run fsck /dev/sda2. Change to single user mode and run fsck /dev/sda2. Run chkdsk /dev/sda2. Change to single user mode and run scandsk /dev/sda2. Change to single user mode and run fdisk /dev/sda2.

Change to single user mode and run fsck /dev/sda2. You want to change to single user mode to prevent any access to the file system and use the fsck utility on /dev/sda2. It is also important to ensure the volume on which you are using fsck is not mounted. Using fsck in mounted volumes can corrupt most filesystems. There are no disk utilities called scandsk or chkdsk in Linux. fdisk is used for partitioning a drive, not for repairing a file system.

Changing I/O schedulers

Changing which I/O scheduler is used can be done at runtime or by modifying the Grub boot loader. When changing the scheduler at runtime, the change is applied immediately but on the next boot, the system will run the default scheduler. Modifying the scheduler via the Grub boot loader causes the system to use the same scheduler each time the system is started. To modify the scheduler at runtime run echo "[scheduler]" > /sys/block/[disk device]/queue/scheduler. Example: echo "cfq" > /sys/block/sda/queue/scheduler

fsck

Checks and optionally repairs one or more Linux file systems. Common options include: -s serializes fsck when multiple file systems are checked. -t specifies the type(s) of file system to be checked. -a automatically repairs the file system without any questions. -r prompts for confirmation when errors are found and ask permission to fix the errors (only when -a is not specified). Be aware of the following: The file system must be unmounted before using fsck. When manually running fsck, use runlevel 1 (init) or rescue.target (systemd) to ensure that other users do not mount the file system. e.g. fsck -t ext3 /dev/sdb1Checks the first partition on the first partition of the second hard drive.

Using bzip2

Compared with gzip, the bzip2 command will create smaller archives but has a slower decompression time and higher memory use.bzip2 compresses files using the Burrows-Wheeler block sorting text compression algorithm, and Huffman coding. The command-line options are deliberately very similar to those of GNU gzip, but they are not identical. bzip2 expects a list of file names to accompany the command-line flags. Each file is replaced by a compressed version of itself, with the name original_name.bz2. Each compressed file has the same modification date, permissions, and, when possible, ownership as the corresponding original, so that these properties can be correctly restored at decompression time.

Which of the following describes the effects of the tune2fs -j /dev/sdb1 command? Displays the superblock on the /dev/sdb1 device. Remounts the /dev/sdb1 device as read-only. Converts the /dev/sdb1 device to ext3. Changes how many times the /dev/sdb1 device is mounted before running fsck.

Converts the /dev/sdb1 device to ext3. tune2fs -j /dev/sdb1 converts the /dev/sdb1 device file system from ext2 to ext3 without affecting the data on the drive. Use tune2fs to adjust tunable file system parameters on ext2, ext3, and ext4 file systems. Other tune2fs options include the following: -c adjusts the number of mounts after which the file system will be checked. -e remount-ro remounts the file system as read-only. -l lists the contents of the file system super block. -o acl enables Posix access control lists.

repquota

Displays a summary of the disc usage and quotas for the specified file systems, including the specific number of files and used space by user. Common options include: -v reports all quotas, even if there is no usage. -n does not resolve user and group names to speed printing time. -u and -g report for users and groups, respectively. -a gives information for all file systems listed in /etc/mtab. e.g. repquota /home -uv creates a user quota report for the /home directory.

du

Displays files and file sizes in and below a specified directory. Common options include: -c lists a total amount of space used in the directory. -h display the output in human readable format (bytes, KB, MB, GB, TB). -s lists only the total, not each file. -a evaluates all files, not just directories. e.g. du -c /home/badamLists all files and directories in badam's home directory along with a file size and a total amount of space taken up by the directory. du -c -s /home/badamShows the total amount of space taken up in badam's home directory.

lsof

Displays open files in the file system. lsof gives the following information by default: The command used to access the file Process ID Name of the user who is accessing the file A file descriptor (these are described in the lsof man pages) File node type Device numbers File size Inode address File path Common options include: +D [directory_name] recursively lists files in a directory. -c [command_name] lists all files for processes that are executing the specified command. -u [user] lists open files owned by the specified user. -g [process_ID] lists files opened by a specific process. e.g. lsof -u userLists files opened by processes that the specified user owns.

quota

Displays the current user's quota: -u shows the quota for a user. -g shows the quota for a group. -v shows current the current usage, the hard quota and the soft quota for blocks and inodes. e.g. quota displays the quota report only for the current user account.quota -u dhanson displays the quota report only for the dhanson user account.

df

Displays the free space in the partition holding the specified directory. If no directory is given, the space available on all currently mounted file systems is shown. Disk space is shown in 1 K blocks by default. Common options include: -h displays the output in get human readable format (bytes, KB, MB, GB, TB). -i displays inode information. -l limits the list to local file systems. e.g. df /homeLists the free space on the partition that holds the /home directory.

8.8.7 Change Directory Ownership

During a random security audit, you found that ownership and group ownership for the /hr directory is set to Will Adams (wadams). For security reasons, you need to change the ownership. You want to give ownership to Brenda Cassini (bcassini), the office manager, and you want to give group ownership to the hr group for all the files in the directory. After you do this, you need to reset group ownership on the /hr/personnel file to mgmt1. In this lab, your task is to: Give bcassini ownership of the /hr directory and all of its contents. Give hr group ownership of the /hr directory and all of its contents. Return group ownership of the /hr/personnel file to mgmt1. Complete this lab as follows: > At the prompt, type chown -R bcassini:hr /hr and press Enter to assign user ownership to bcassini and group ownership to hr for the /hr directory and all of its contents. The -R switch changes the ownership recursively throughout the /hr directory tree. > Use chgrp mgmt1 /hr/personnel and press Enter to return group ownership of the /hr/personnel file to mgmt1.

Yesterday, you created a new swap area for your system. Today, after rebooting the system, you find that the swap area is not mounted. What should you do to ensure that the swap area is mounted each time the system boots? Edit /etc/inittab and add the swap area. Run the mount --auto command and identify the swap area partition. Remount the swap area. Then run export mount to make the change persistent. Edit /etc/mtab and add the swap partition. Edit /etc/fstab and add the swap partition.

Edit /etc/fstab and add the swap partition. To mount the swap area each time the system boots, edit the /etc/fstab file and add the swap area with the auto keyword. /etc/mtab shows currently mounted volumes. /etc/inittab determines the default runlevel for the system and starts the appropriate daemons for that runlevel.

Edit quotas

Edit a quota for the specified user or group. Be aware of the following when editing quotas: Set the soft and hard quotas for blocks. This limits the total amount of disk space per user or group. Set the hard and soft quotas for inodes. This limits the total number of files and directories per user or group. Users may exceed soft quotas for a number of days specified in the grace period (seven by default). When the grace period expires, users cannot create additional files. Users cannot exceed hard quotas. When setting block quotas, 1000 blocks is about 1 MB, and 1,000,000 blocks is about 1 GB. Setting the quota limits to 0 removes all quotas.

Enable quotas and view a quota report

Enable disk quotas and then generate a disk usage and quota report. The report shows: How much space to allocate to each user. How much space is currently consumed by each user. Whether some users are using a significant amount of disk space.

quotaon

Enables quotas for the mounted file system as follows :-a enables all mounted file systems listed in /etc/mtab. -v runs the command in verbose mode. e.g. quotaon -av / enables quotas for the root (/) directory.

Inode Modes

Every file and directory in the Linux file system has an inode (index node) that stores information about the file or directory, including when it was last modified, size, data block location, permissions, and ownership. The portion of the inode that stores permission information is called the mode. The mode has three sections: User permissions (owner) Group permissions (group owner) Other permissions (everyone else on the Linux system who is not an owner or a member of the owning group) There are three types of permissions contained in the mode, each of which is described in the table below:

8.12.9 Backup Strategy Facts

File backups can be performed using a number of Linux commands. However, an overall backup strategy will make the backup process more efficient, and will ensure all files are backed up in a timely manner. This lesson covers the following topics: Backup types Off-site and off-system storage plans Integrity checks

You attempt to unmount a volume using the umount /dev/sdd3 command, but you receive a device is busy error message. Which of the following strategies will be MOST likely to allow you to unmount the file system? (Select TWO). Use the fscls command to close any open files on the filesystem. Try to unmount again. Perform a backup of the sdd3 device and try to unmount again. Find and close any open files on the file system, and try to unmount again. Make sure your current working directory is not on the file system and try to unmount again. Edit /etc/fstab and remove the mount. Try unmount again.

Find and close any open files on the file system, and try to unmount again. Make sure your current working directory is not on the file system and try to unmount again. Some file systems will not allow you to unmount a file system if your current working directory is in that file system. The command lsof lists open files, and the pid that has the files open. This will allow you to close the file, or at least kill the process that has the file open. There is no command called fscls. Editing /etc/fstab will not help to unmount a filesystem during the current session. A backup will not close a file that is open.

Write

Letter Abbreviation: w Octal Value: 2 Allowed Actions on Files: Edit the file and save the changes Allowed Actions on Directories: Add, delete, and rename files if the execute permission is also present

getfacl file

For each file, getfacl displays the file name, owner, the group, and the Access Control List (ACL). If a directory has a default ACL, getfacl also displays the default ACL. Non-directories cannot have default ACLs. getfacl options: -a Display the file access control list. -d Display the default access control list. -c Do not display the comment header (the first three lines of each file's output). -e Print all effective rights comments, even if identical to the rights defined by the ACL entry. -E Do not print effective rights comments. -s Skip files that only have the base ACL entries (owner, group,others. -R List the ACLs of all files and directories recursively. -L Logical walk, follow symbolic links to directories. The defaultbehavior is to follow symbolic link arguments, and skip symbolic links encountered in subdirectories. Only effective in combination with -R. -P Physical walk, do not follow symbolic links to directories. This also skips symbolic link arguments. Only effective in combination with -R. -t Use an alternative tabular output format. The ACL and the default ACL are displayed side by side. Permissions that are ineffective due to the ACL mask entry are displayed capitalized. The entry tag names for the ACL_USER_OBJ and ACL_GROUP_OBJ entries are also displayed in capital letters, which helps in spotting those entries. -p Do not strip leading slash characters ('/'). The default behavior is to strip leading slash characters. -n List numeric user and group IDs -v Print the version of getfacl and exit. e.g. getfacl myfile Output:# file: myfile# owner: cpelfrey# group: adminuser::rw-group::r--other::r

Which of the following represent a typical Linux backup type? (Choose FIVE.) Correct Answer: Full Image Archival Tarball Asynchronous Snapshot Incremental Differential

Full Image Snapshot Incremental Differential A full backup is a copy of all the files that exists at the point in time when the backup is taking place. An incremental backup stores files that has been changed or added, since the last backup has been made. A differential backup copies all of the files that have been updated, but only against the last full backup. Snapshot clones is a technology that allow you take point-in-time snapshots of the files on a system without causing the downtime inherent in traditional backups. A disk image is a single computer file or set of files that contain the contents of a hard disk. The other options are not backup types.

8.6.4 I/O Scheduling

I/O schedulers provide a way to optimize disk access requests (read/write). In many cases they try to do this by merging I/O requests to similar location on the disk. Using this method, the drive doesn't need to seek as often, improving the overall response time for disk operations. This lesson covers the following topics: I/O schedulers Viewing I/O schedulers Changing I/O schedulers

Implementing Disk Quotas

Implementing Disk Quotas

Execute

Letter Abbreviation: x Octal Value: 1 Allowed Actions on Files: Execute the file, if it's a program file or a shell script (must be used in conjunction with the read permission) Allowed Actions on Directories: Enter the directory and access its contents

I/O Schedulers

Linux provides several I/O schedulers to choose from. The following table gives a brief summary of three such schedulers:

iostat

Monitors system I/O device loading by observing the time devices are active in relation to their average transfer rates. The iostat command generates reports that can be used to change system configuration to better balance the input/output load between physical disks. Running iostat without any options displays CPU usage and I/O statistics in the form of how much has been written per second and in total. Command options include: -m displays the results in megabytes (MB) instead of kilobytes (KB). -d only display the statistics for the devices connected on the system. -p device display the results for the specified device. -x adds extended statistics, such as avgqu-sz. This statistic shows the number of operations that were either queued or being serviced on a device. If this is not in the single digits (with an occasional double-digit spike) more troubleshooting may be required. number When a number (such as 5) is used iostat will continue displaying statistics for that specified time in seconds. Press Ctrl + c to exit. See the man pages for additional options. e.g. iostat -m -p sda1Lists results for the sda1 partition in MBs. iostat 5Refreshes the results every 5 seconds.

Noop

Noop is the simplest scheduler. It places all I/O requests into a First in, First Out (FIFO) queue. In addition, read/write requests of a similar purpose are also combined to reduce the number of disk operations and increase the length of system calls. This scheduler is often used for systems that do not need an I/O scheduler. For example, a virtual machine (VM) is running on a host computer which is already using its own I/O scheduler.

edquota

Opens and edit a user's quota, a group's quota, or change the grace period: -u changes the user's quota. -g changes a group's quota. -t changes the grace period. e.g. edquota -u mtomm opens the quota file for the mtomm user account.

Permissions

Permissions are identified with either the letter abbreviation (r, w, or x), or the octal value that corresponds to the permission. The following graphic depicts how permissions are referenced: In the mode: A d preceding the permissions indicates that the object is a directory. A dash (-) preceding the permissions identifies a file (the example above is for a file). Permissions are grouped according to user, group, or other permissions. If a given permission has not been assigned, a dash (-) takes its place in the mode. When using numbers to represent permissions, add the numbers together within each permission group. Then string the numbers together. For example, the mode of the file in the graphic above can be represented by the number 764. The root user has all permissions to files and directories regardless of the mode settings.

Disk quota

Prevents a user or group from using a disproportionate amount of disk space on a volume.

8.7.10 Edit Quotas 1

Sam Chan (schan) has reached his user quota limit. He wants more space. Your manager has approved an increase in his quota limit. In this lab, your task is to: Increase the hard and soft block limits on the schan user account to 1048576 Kb (1 Gb). After you've finished, generate a quota report to confirm the changes. Complete this lab as follows: > At the prompt, type edquota -u schan and press Enter to open the schan quota file. > Press 1 and press Enter to open the editor. > Move the curser under soft and delete 9216. > Type 1048576 (use the delete key to delete extra spaces caused by the insertion). > Move the curser under hard and delete 10240. > Type 1048576 (use the delete key to delete extra spaces caused by the insertion). > Press Ctrl + x to exit the editor. > Press the Y key to save your changes. > Press Enter. > Type repquota -a and press Enter to generate the report and confirm the changes.

You have just installed a new program that will be used by all users on the computer. After installation, you log in as a regular user, and you try to run the program. The program stops and displays the following error: Error: not running as root What should you do so that all users can run this program? Add users to the sudoers file. Tell them to run the program using the sudo command. Have users run the program using the su -c command. Set the SUID on the program. Make all users members of the root group.

Set the SUID on the program. The program must be run as the root user. The easiest method for resolving the problem is to set the SUID on the program file. When the program runs, it will run with the permissions of the root user. Using the sudo command will require extra work and user training. Using the su -c command means that users must know the root user password. Making users members of the root group might not work and would give them extra permissions to things other than the program file.

Setting the SUID flag is a powerful and useful feature. It can have weaknesses associated with its use. Which of the following statements identifies a weakness? Only twelve applications or processes may be run at the same time by setting the SUID flag for root user permissions. Setting the SUID flag is a one-time event that reverts after execution, forcing the root user to reset the flag every time. Setting the SUID flag for an application or process owned by the root user is a potential security hole. There are no weaknesses to using the SUID flag.

Setting the SUID flag for an application or process owned by the root user is a potential security hole. Setting the SUID flag for programs owned by root is dangerous because that program executes with root user privileges. There are no limits on the use of the SUID flag, and it is not reset upon use.

Snapshot clones backup

Snapshot clones is a technology that allow you take point-in-time snapshots of the files on a system without causing the downtime inherent in traditional backups. A snapshot is not an independent backup of a set of data files. Rather, a snapshot is set pointers to blocks of data that make up a set of files at a point-in-time. When a change is made, the original blocks are kept and changed blocks are added. When a new snapshot is taken, another set of pointers is created that point to the blocks that make up the file at that point-in-time. The term clone is used when restoring. The blocks for a selected snapshot are written to a new storage location as a traditional set of files. This set of files is considered a clone of the original snapshot. The benefits of snapshots and clones is the rapid accessibility of point-in-time data which also allows for a quick roll back when data is corrupted. The disadvantage of snapshot technology is that it requires more storage space and it may impact production performance during the clone process since primary data is being accessed.

Which of the following special permissions prevents a file's deletion by anyone except the file's owner? SGID Umask Sticky bit SUID

Sticky bit The sticky bit marks the file (not directory) to prevent the file's deletion by anyone except the file owner. SUID (Set User ID) allows a program to run with the permissions of the file owner, not with the permissions of the user who runs the program. SGID allows a program to run with the permissions of the group owner. If SGID is set on a directory, a newly created file will receive the same group owner as assigned to the parent directory. Umask changes (removes) the default file and directory permissions. By default, files receive rw-rw-rw- (666) permissions when they are created, and directories receive rwxrwxrwx (777) permissions when they are created.

CFQ

The Complete Fairness Queuing (CFQ) input/output (I/O) scheduler works by creating a per-process I/O queue. The goal of CFQ is to provide a fair I/O priority to each process. This is accomplished by first ordering the queues to reduce disk seeking and then servicing these per-process I/O queues, in a round-robin fashion. The benefits of using the CFQ scheduler is that it tries to provide each process with the same priority for disk access. The disadvantage of using the CFQ scheduler is that it makes this scheduler less optimal for environments that might need to prioritize one request type (such as reads) from a single process. *Each disk device has its own scheduler and can be configured independent of the other devices. You can use the lsblk -o KNAME,TYPE,SIZE,MODEL command to view these devices.

Deadline

The Deadline scheduler creates a read queue and a write queue. Since each I/O request has an associated time stamp (used by the kernel for an expiration time), the Deadline scheduler utilizes this time stamp to push I/O request that have reached their deadline to their highest priority. The default Deadline values are 500 ms for read operations and 5,000 ms for write operations. If needed, these values can be adjusted. Because of these values, the Deadline scheduler is often considered the optimal scheduler for read-heavy workloads.

MD5

The MD5 (Message Digest Algorithm 5) algorithm produces a 128-bit hash value. It was originally used as a cryptographic hash function but was found to suffer from extensive vulnerabilities.

SCP

The SCP tool securely copies files and directories between remote hosts without starting an FTP session or even logging into the remote systems. SCP uses SSH to transfer data, so it requires authentication, but it does encrypt both the file and any passwords exchanged

8.9.8 Enable Directory Browsing

The Sales team uses the /sales directory to store documents related to sales, contacts, and orders. Currently, permissions on the directory only allow the user and group owners to view the contents of the directory. Users who are not part of the group owner are unable to list the contents of the directory. As part of a new company policy to increase teamwork, you want to allow all users to be able to see the /sales directory and list its contents. You also want to let all users open any document inside that directory, but you don't want them to make changes to documents. In this lab, your task is to complete the following: Allow the other group to browse the /sales directory. Modify permissions on all files in the /sales directory to allow members of the other group to view the file but prohibit them from changing it. Complete this lab as follows: At the command prompt, type chmod o+rx /sales and press Enter to enable the other group to browse the /sales directory. The read and execute permissions are necessary to see the directory and list its contents. Type chmod o+r /sales/* and press Enter to allow the other group to read all documents in the /sales directory.

Using cpio

The cpio command is used to archive files or to extract files from a cpio archive. Although similar to other archive tools, cpio is different because it takes only the files names from standard input. The cpio command: Copies files to an archive (copy-out mode). Extracts files from an archive (copy-in mode). Copies files to a different directory tree (copy-pass mode).

dd

The dd command stands for "data duplicator" and is used to copy and covert data. The dd command can be used for tasks such as: > Backing up and restoring the entire hard disk or partition > Backing up the Master Boot Record (MBR) > To copy and convert magnetic tape format > To convert between ASCII and EBCDIC formats > To convert lower case to upper case > The syntax of dd is: dd options=value bs=BYTES Read and write up to BYTES bytes at a time (default: 512);overrides ibs and obs cbs=BYTES Convert BYTES bytes at a time conv=CONVS Convert the file as per the comma separated symbol list count=N Copy only N input blocks ibs=BYTES Read up to BYTES bytes at a time (default: 512) if=FILE Read from FILE instead of stdin iflag=FLAGS Fead as per the comma separated symbol list obs=BYTES Write BYTES bytes at a time (default: 512) of=FILE Write to FILE instead of stdout oflag=FLAGS Write as per the comma separated symbol list seek=N Skip N obs-sized blocks at start of output skip=N Skip N ibs-sized blocks at start of input status=LEVEL The LEVEL of information to print to stderr; 'none' suppresses everything but error messages, 'noxfer' suppresses the final transfer statistics, 'progress' shows periodic transfer statistics e.g. dd if=/dev/sda of=/dev/sdbWill clone one hard disk to another hard disk. dd if=hdadisk.img of=/dev/sdb3Will restor the above image to an other machine. dd if=/dev/hda1 of=~/partition.imgWill backup a partion to an image name partition.img

Using gzip

The gzip command reduces the size of the named files using Lempel-Ziv coding (LZ77). Whenever possible, each file is replaced by one with the extension '.gz', while keeping the same ownership modes, access and modification times. The default extension is -gz for VMS, z for MSDOS, OS/2 FAT, Windows NT FAT and Atari.) If no files are specified, or if a file name is "-", the standard input is compressed to the standard output. Gzip will only attempt to compress regular files. In particular, it will ignore symbolic links.

8.8.6 Change Group Ownership for a File

The hr group currently owns the /hr/personnel file, but the mgmt1 group should own the file to protect employee privacy. In this lab, your task is to: Change the group ownership of the /hr/personnel file from hr to mgmt1. Use the ls -l command to verify the ownership change. Complete this lab as follows: > At the prompt, type one of the following commands and press Enter: > chgrp mgmt1 /hr/personnel > chown .mgmt1 /hr/personnel > chown :mgmt1 /hr/personnel > Type ls -l /hr and press Enter to verify the ownership change.

8.9.7 Set File Permissions

The human resources team uses the /hr directory to keep important employee documents. Over time, you notice that permissions set on each file have become inconsistent. You want to make sure that all files in the /hr directory have the same permissions settings. You must modify the file permissions to be -rw-rw---- (the octal equivalent of 110 110 000 = 660). In this lab, your task is to configure permissions on all files in the /hr directory as follows: User and group owners should have Read and Write permissions to the files. All other users should have no permissions on any file. Use the ls command to verify your changes. Complete this lab as follows: At the prompt, type chmod 660 /hr/* and press Enter to set the permissions on all files in the /hr folder to the same permissions. Type ls -la /hr and press Enter to verify the changes.

umask Commands

The table below lists the commands for managing umask: Be aware of the following: The default umask value may vary depending on the Linux distribution (022 or 0022 is the most common default). Setting the umask with the umask command is only persistent for the shell session. To make the umask persistent through shell sessions and reboots, add the umask command to the shell configuration file (depending on the distribution).

Managing Permissions

The table below lists the most common commands for managing permissions:

Using tar

The tar (tape archive) utility takes the contents of several files and stores them as a single file. The tar command can be used to backup directories or entire file systems. To help others know that the tar utility must be used to extract files from it, by convention, an archive file created with tar is assigned an extension of .tar

While reading about file system permissions in Linux, you discover that the default permissions assigned to new files when they are created are rw-rw-rw- (666 octal), and new directories are rwxrwxrwx (777 octal). However, when you create a new file in a directory called /data, the permissions assigned are rw-r--r--. Which of the following BEST explains the results you are seeing? There are more restrictive permissions assigned to the /data directory, and any new files created inside that directory will inherit the more restrictive permissions. Because you are logged in as a normal user and not the root user, all files that you create will be created with a more restrictive set of permissions. You are logged in as the root user, and all files created by the root user are assigned these permissions. Only normal users get rwxrwxrwx (777 octal) permissions on newly created files. The umask must be set to 0022 and, therefore, block the write permission for the group owner and everyone else.

The umask must be set to 0022 and, therefore, block the write permission for the group owner and everyone else. The default permissions for directories are rwxrwxrwx (777 octal) and rw-rw-rw (666 octal) for files. The way that you override these permissions is by setting the umask to block the permissions that you do not want set. The umask is typically set system-wide for all users, including the root user.

Using xz

The xz command is a general-purpose data compression tool with command line syntax similar to gzip and bzip2. The native file format is the .xz format, but also the legacy .lzma format and raw compressed streams with no container format headers are supported. The xz command compresses or decompresses each file according to the selected operation mode. If no files are given or file is -, xz reads from the standard input and writes the processed data to standard output. xz will refuse (display an error and skip the file) to write compressed data to standard output if it is a terminal. Similarly, xz will refuse to read compressed data from standard input if it is a terminal.

Using zip

The zip program puts one or more compressed files into a single zip archive, along with information about the files (name, path, date, time of last modification, protection, and check information to verify file integrity). An entire directory structure can be packed into a zip archive with a single command. This program is useful for packaging a set of files for distribution; for archiving files; and for saving disk space by temporarily compressing unused files or directories. The zip command is a compression and file packaging utility for many operating systems including Linux, Unix, and Windows. It is analogous to a combination of the Linux tar command and is compatible with PKZIP (Phil Katz's ZIP for MSDOS systems). A companion program named unzip, unpacks zip archives. The syntax for zip is: zip [options] zipfile files_list

xfs_metadump

This command is used to copy the metadata (such as (filenames, file sizes) from an XFS files system to a file, but can only be used to copy unmounted file systems, or read-only mounted file systems. Be aware that by default, xfs_metadump obfuscates most file (regular file, directory and symbolic link) names and extended attribute names to allow the dumps to be sent without revealing confidential information. Command options include: -a Copies entire metadata blocks. -e Stops the dump on a read error. -g Shows dump progress. -o Disables obfuscation of file names and extended attributes. See the man pages for additional options. e.g. xfs_metagump -o /dev/sda3 /xfs/xfs_dumpCopies the file system metadata found on /dev/sda3 to the /xfs/xfs_dump file. The -o option disables obfuscation of file names and extended attributes.

Snapshot clones backup

This feature allows you to take point-in-time snapshots of the files on a system without causing the downtime inherent in traditional backups. A snapshot is set pointers to blocks of data that make up a set of files at a point in time.

8.6.3 File System Maintenance Facts

This lesson covers the commands used to check and maintain file system integrity:

8.7.3 Quota Facts

This lesson covers the following topics: About disk quotas Implementing disk quotas Disk quotas commands

8.11.3 Special Permission Facts

This lesson covers the following topics: About special permissions Managing special permissions

8.10.3 The umask Command Facts

This lesson covers the following topics: About umask Calculating umask umask commands

8.9.4 Permission Facts

This lesson covers the following topics: Inode modes Permissions Managing permissions

8.12.8 cpio and dd Facts

This lesson covers the following topics: Using cpio Using dd

ioping

This tool generates various I/O patterns and lets you monitor I/O speed and latency in real time. this tool shows disk latency in the same way as ping command shows network latency on Linux or Unix-like system. Command options include: -c count device runs for the number of specified count requests for the specified device -R device shows the disk seek rate for the specified device See the man pages for additional options. e.g. ioping -c 10 /dev/sdaPerforms a latency ping 10 times on the /dev/sda device. ioping -R /dev/sdaShows the disk seek rate for the /dev/sda device.

setfacl file

This utility sets Access Control Lists (ACLs) of files and directories. setfacl options: -m modifies the ACL of a file or directory. ACL entries for this operation must include permissions. -x remove ACL entries. It is not an error to remove an entry which does not exist. Only ACL entries without the perms field are accepted as parameters, unless the POSIXLY_CORRECT environment variable is defined. -b Remove all extended ACL entries. The base ACL entries of the owner, group and others are retained. -k Remove the Default ACL. If no Default ACL exists, no warnings are issued. -n Do not recalculate the effective rights mask. The default behavior of setfacl is to recalculate the ACL mask entry, unless a mask entry was explicitly given. The mask entry is set to the union of all permissions of the owning group, and all named user and group entries. (These are exactly the entries affected by the mask entry). -d All operations apply to the Default ACL. Regular ACL entries in the input set are promoted to Default ACL entries. Default ACL entries in the input set are discarded. (A warning is issued if that happens). -R Apply operations to all files and directories recursively. This option cannot be mixed with "--restore". -L "Logical walk": follow symbolic links to directories. The default behavior is to follow symbolic link arguments, and skip symbolic links encountered in subdirectories. Only effective in combination with -R. This option cannot be mixed with "--restore". -P "Physical walk": do not follow symbolic links to directories. This also skips symbolic link arguments. Only effective in combination with -R. This option cannot be mixed with "--restore". -v Print the version of setfacl, and exit. e.g. setfacl -m u:cplefrey:r myfilegrants the user cplefry read access to the file named myfile. setfacl -m m::rx myfile Revoke write access from all groups and all named users (using the effective rights mask) for the file named myfile.

Viewing I/O Schedulers

To determine which I/O scheduler your system is using run cat /sys/block/[disk device]/queue/scheduler. A list of the available schedulers will be shown. The scheduler enclosed in brackets is the scheduler currently being used. Example: cat/sys/block/sda/queue/scheduler Result/Output: noop [deadline] cfq In this example, this system is using the scheduler named Deadline. Also notice that the noop and cfq schedulers are available.

8.7.4 Determine the Amount of Free Disk Space

Type df -h at the prompt to answer the following questions How much space is used on /dev/sda2? 2.9G How much space is still available on /dev/sda2? 1.1G What percentage of space is used on /dev/sda1? 52% The df command shows the amount of free space left on mounted drives. The -h option allows you to see the output in a readable form. 1.2G is the amount of used space on /dev/sda2. 2.8 is the amount of available space on /dev/sda2. 52% is the percentage of used space on /dev/sda1.

8.7.6 Find the User Quota

Type quota -u wadams at the prompt to answer the following questions about quota information for the wadams user account. What is the blocks quota? 18432 What is the blocks limit? 20480 What is the files quota? 500 What is the files limit? 550 Use the quota command to find the following quota information for the wadams user account. The blocks quota (also called the soft limit) is 18432 (value given is in Kilobytes). The blocks limit (also called the hard limit) is 20480 (value given is in Kilobytes). The files quota (also called the inode soft limit) is 500. The files limit (also called the inode hard limit) is 550. The root user can use the quota -u username command to find a quota for a different user.

8.7.7 Generate a Quota Report

Type repquota -a at the prompt to answer the following questions: Which user does not have a quota limit? root What is the hard block limit for most users? 10240 What is the soft block limit for most users? 9216 What is the highest hard block limit setting? 20480 Which user has the highest hard block limit setting? wadams Use the repquota -a command to generate a report for user quotas and retrieve the following answers: Root is the user with no limit (0 indicates that there is no quota on the account). 10240 Kb is the hard block limit for most of the users listed in this report. 9216 Kb is the soft block limit for most of the users listed in this report. 20480 Kb is the highest hard block limit. Wadams is the user account that has the highest hard block limit.

You need to create a large number of files, and you would like to ensure that you, the user owner, are the only person that has read and write permissions to the files. The files will be located in a number of different directories that already contain other files you don't want modified. How could you BEST create these files with the correct permissions using the LEAST amount of effort? Type umask 0066 to change your umask. Make a list of all the files you created and run umask 0066 on each of them to change their permissions. Type umask 6600 to change your umask. Run chmod -R 600 on all of the directories in which you created the new files.

Type umask 0066 to change your umask. A umask of 0066 would block the read and write bits for the group owner and the world/everyone. By setting the umask first, all files created after would have these permissions. The umask command only changes the umask in memory, which affects the creation of new files. The umask command with 6600 is incorrect because it would block the read and write permissions for the user owner. Running the chmod command on a directory would change the permissions on all files in that directory.

A service account is created by the system or an application and cannot be used to log in to the system. Which of the following methods can be used to verify that a service account cannot login to the system? View the entry for the service account in /etc/shadow and look for /sbin/nologin. Verify that file and directory permissions have been removed for the service account to the /boot partition. View the ACLs for /bin/login to ensure that the service account is not listed. View the entry for the service account in /etc/passwd and look for /sbin/nologin.

View the entry for the service account in /etc/passwd and look for /sbin/nologin. View the entry for the service account in /etc/passwd and look for /sbin/nologin. This ensures that the service account will not have permission to log in. The other options do not provide any information related to a service account's permission to login.

You need to see who has permissions to the sales_projection_q2 file. You use ls -l sales_projection_q2 and receive the following information: drwxr-xr-x 22 pclark acct 4096 Jun 19 15:01 sales_projection_q2

Which user owns this file? (Your answer is case-sensitive.) pclark Which group owns this file? (Note: your answer is case-sensitive.) acct Given the following information about the sales_projection_q2 file, the user who owns the file is shown first (after the file mode information), and the group owner is shown second. In this, case pclark is the user, and acct is the group.

8.8.4 View Ownership Information

You are logged in as root, and the working directory is root's home directory. Type ls -l /folder_name/file_name at the prompt to answer the following questions: Who owns the /sales/orders file? bcassini Who is the group owner of the /projects/darkhorse file? proj Who is the owner of the /projects directory? bcassini Who is the group owner of the /hr directory? wadams Since you are logged in as root, the working directory is root's home directory. When using the ls -l command from this directory, you must include the full path, starting with the root directory (/), to find the requested information. Use the following ls -l commands to view detailed information for directories and files. ls -l /sales/orders: bcassini owns the file. ls -l /projects/darkhorse: proj is the group owner of the file. ls -l /: bcassini owns the /projects directory. ls -l /: wadams is the group owner of the /hr directory. You can also use cd / to change from the root user's home directory to the root of the file system where these directories are located.

8.7.5 Determine the Directory Size

You are logged on as Will Adams (wadams), and your working directory is /home/wadams/. Type du at the prompt to answer the following questions. How big is the /home/wadams directory? 100 K What is the largest directory in /home/wadams? ./.config What is the size of the ./.config/ibus/bus directory? 40 K The du command shows the hard disk space used by the file system or directory. 100 K is the size of the /home/wadams directory. ./.config is the largest directory in /home/wadams. 40 K is the size of the ./.config/ibus/bus directory.

Integrity Checks

You can check the integrity of a backup to ensure that the data has been backed up or transferred without error. One way to do this is to use a hash algorithm that produces a "fingerprint" of the downloaded file. A hash algorithm inputs the backup data and outputs a unique character string. If the source data and the backed up data produce the same fingerprint, you can be confident that the data is identical. There are two hash algorithms that are commonly used to check integrity.

8.11.4 Set the SUID Bit

You have a Linux workstation that you use at home for browsing the internet, playing music, and writing letters. When you run your MP3 player, it sometimes pauses in playback. You have heard that you might be able to alleviate the problem by raising the priority of the program. You decide to set the SUID bit to automatically run the program as root and thereby raise its priority. In this lab, your task is to: Set the SUID bit for the /usr/bin/xmms program. Don't change any other permissions on the file. Complete this lab as follows: > At the prompt, type one of the following commands: chmod u+s /usr/bin/xmms chmod 4755 /usr/bin/xmms > Press Enter to add the SUID bit to the file without changing the other permissions

8.11.5 Remove SUID and SGID Permissions

You have a Linux workstation that you use at home. You are the only person that uses this computer. You want to improve security by removing the SUID and SGID from some files. In this lab, your task is to: Remove the SUID from the following files:/usr/bin/gpasswd/usr/bin/newgrp Remove the SGID from the following files:/usr/bin/wall/usr/bin/write Leave permissions on the files as they are. Complete this lab as follows: > At the prompt, type chmod u-s /usr/bin/gpasswd and press Enter to remove the SUID. > Type chmod u-s /usr/bin/newgrp and press Enter to remove the SUID. > Type chmod g-s /usr/bin/wall and press Enter to remove the SGID. > Type chmod g-s /usr/bin/write and press Enter to remove the SGID.

Off-Site and Off-System Storage Plans

You should consider having an off-site, or off-system, storage plan. This is especially important in cases where a natural disaster destroys the hardware and data stored locally. There are several tools that can assist you when backup up using off-site or off-system storage.

8.10.4 Change the umask

You want to change your default umask to give yourself and members of the groups to which you belong full permissions to the files and directories you create. You want to deny permissions for everyone else. You are logged on as wadams. The octal values in the umask command subtracts permissions rather than grant them. In this case, the 0 in the first position subtracts no permissions from the user. The 0 in the second position subtracts no permissions from the group. The 7 in the third position subtracts all permissions for other users. You cannot create a file with execute permissions because you must compile an executable file. You can only create a directory with execute permissions. Use the table below to determine the octal values needed for the umask command. In this lab, your task is to change your default umask value to give yourself and members of the groups to which you belong full permissions to the files and directories that you create. Complete this lab as follows: At the prompt, type umask 007. Press Enter to set the umask value.

What would you enter at the command prompt to change the group ownership for the devstyle.txt file to rand in the present working directory?

chgrp rand devstyle.txt Use chgrp rand devstyle.txt to change the group ownership for the devstyle.txt file to rand. The chgrp command changes the group owner of a file or directory. chown can also change the group ownership. The following chown commands change the group ownership as required in the scenario: chown :rand devstyle.txt chown .rand devstyle.txt

You are the team lead for a marketing project. Only the members of the team3 group should have read/write permissions to a document called project_data.doc. You want to ensure that no one on the team will delete the document by accident. Your user name is bsmith.A long listing of the file is as follows: -rwxr-xr-x 1 bsmith team3 7260 June 22 2004 project_data.doc Which of the following commands will accomplish this task? chown :bsmith project_data.doc chmod 744 project_data.doc chgrp bsmith project_data.doc chmod 1664 project_data.doc

chmod 1664 project_data.doc chmod 1664 project_data.doc is the correct answer because you are setting the sticky bit. When the sticky bit is set on a file, that file can only be deleted by its user owner no matter what permissions have been assigned to it, even if it were assigned permissions of 777 (rwxrwxrwx). POSIX file permissions can be displayed in a number of ways. The traditional method is rwxrwxrwx. With this method, r means read, w means write, and x means execute. These permissions are displayed for the user owner (first set), group owner (second set) and the world, or everyone (third set). POSIX permissions can also be converted into binary using three bits, one for read, one for write, and one for execute. In this notation, rwxrwxrwx would be 111111111. Displaying the permissions in binary is a bit long-winded, so binary permissions are often converted into octal numbers (digits 0-7). In octal, rwxrwxrwx would be represented as 777(111 binary = 4+2+1 = 7 octal). A fourth group of rwx (111 binary or 7 octal) can be appended to the beginning of the permissions to set SUID (100 binary or 4 octal), SGID (010 binary or 2 octal) and/or the sticky bit (001 binary or 1 octal). This is represented as 0777 octal if none of these are set. If rwx notation is used, SUID is rwsrwxrwx, SGID is rwxrwsrwx, and the sticky bit is rwxrwxrwt. chmod 744 project_data.doc is incorrect because only the user owner would have write permissions. chgrp bsmith project_data.doc is incorrect because it changes the group owner to your personal group. If this were done, you would have to give the world (everyone) read/write permissions to allow team3 members to have read/write permissions. chown :bsmith project_data.doc would have the same effect and could only be run as root because only the root user can run chmod.

You need to set the SUID permission on a file named rider. Which of the following commands will accomplish this task? chmod 1777 rider chmod 4777 rider chmod 2777 rider chmod rider 1777

chmod 4777 rider Use chmod 4777 rider. The SUID permission is numerically equivalent to 4000. This value is added to the other permissions, and chmod is used to apply it.

You must change ownership of a script called myscript so that only the user owner has read/write access to it and only the user owner and group owner have execute permissions. Which of the following commands will accomplish this task? chmod 750 myscript chmod 611 myscript chmod 771 myscript chmod 755 myscript

chmod 750 myscript chmod 750 is correct because it allows the user owner full read, write, and execute permissions, and the group owner read and execute permissions. POSIX file permissions can be displayed in a number of ways. The traditional method is rwxrwxrwx. With this method, the r means read, the w means write, and the x means execute. These permissions are displayed for the user owner (first set); group owner (second set); and the world, or everyone (third set). POSIX permissions can also be converted into binary using three bits, one for read, one for write, and one for execute. In this notation, rwxrwxrwx would be 111111111. Displaying the permissions in binary is a bit long-winded, so binary permissions are often converted into octal numbers (digits 0-7). In octal, rwxrwxrwx would be represented as 777(111 binary = 4+2+1 = 7 octal). chmod 771 is incorrect because it gives execute permissions to everyone. chmod 611 is incorrect because it does not give write permissions to the group owner. chmod 755 is incorrect because it gives execute and read permissions to everyone and does not give write permissions to the group owner.

A file named acctg needs to have the SGID permission set on it while keeping all other permissions at their present value. Which of the following commands will accomplish this task? chmod 1777 acctg chmod s+g acctg chmod g+s acctg chmod +g acctg

chmod g+s acctg Use the command chmod g+s acctg to add the SGID permission to the existing set of permissions. SGID has a numeric value of 2000 and would need to be added to the value of existing permissions if the numeric form of chmod is used.

Which of the following commands would be used to make nstevens the owner of all of the files and directories in the /docs directory? chown -v nstevens /docs chown -f nstevens /docs chown -R nstevens /docs chown nstevens /docs

chown -R nstevens /docs The correct answer is chown -R nstevens /docs. This tells chown to act recursively on all files and directories in the specified location. The -v option is for verbose, meaning output will be generated for every file processed. The -f option is for suppressing most error messages. With no options, chown only acts upon the given file or directory.

Which of the following commands make sales the group owner of the /sales/report file? (Select TWO. Each answer is an independent solution.) chgroup sales /sales/report chmod .sales /sales/report chown :sales /sales/report chown .sales /sales/report

chown :sales /sales/report chown .sales /sales/report The following commands make sales the group owner of the file: chown .sales /sales/report chown :sales /sales/report chgroup is not a valid command. Use chgrp to change the group owner of a file or directory. chgrp sales /sales/report will also change the group ownership required in the scenario. chmod changes the permissions for the specified file or directory.

You use ls -l /home/sales/sales_projection_q2 and get this information: drwxr-xr-x 22 pclark acct 4096 Jun 19 15:01 sales_projection_q2 Which of the following commands will change the user owner to jyoung and the group owner to sales? chgrp jyoung:sales /home/sales/sales_projection_q2 chown jyoung,sales /home/sales/sales_projection_q2 chmod jyoung:sales /home/sales/sales_projection_q2 chown jyoung sales /home/sales/sales_projection_q2 chown jyoung:sales /home/sales/sales_projection_q2

chown jyoung:sales /home/sales/sales_projection_q2 You can enter chown jyoung:sales /home/sales/sales_projection_q2 to make jyoung the user owner and sales the group owner of this file. You can also enter chown jyoung.sales /home/sales/sales_projection_q2. In the first example, a colon (:) is used to separate the user and the group. In the second example, a period (.) is used. Either character will work with the chown command.

You want to restore files with the extension .cfg from an archive called configs.cpio. Which command will perform the restore? cpio -ivd /mnt/hdd2/configs.cpio < "*.cfg" cpio -ivd ".cfg" < /mnt/hdd2/configs.cpio cpio -ivd "cfg" < /mnt/hdd2/configs.cpio cpio -ivd "*.cfg" < /mnt/hdd2/configs.cpio

cpio -ivd "*.cfg" < /mnt/hdd2/configs.cpio The correct command is cpio -ivd "*.cfg" < /mnt/hdd2/configs.cpio. The cpio command processes one item at a time making the use of piped output, text files or multiple quoted items as input. The option i means extract, d means restore the files and directory path if the files were archived with a directory path and v is verbose mode.

Which of the following is the BEST command to use when creating a disk image? gzip dd cpio pack

dd The dd command stands for "data duplicator"Â and is used to copy and covert data. The dd command can be used for tasks such as backing up and restoring an entire hard disk or partition. The pack command compresses files. The cpio command creates archives. The gzip command compresses files.

Which utility allows you to make an exact copy of a file? tar cp cpio dd

dd Use dd to make an exact (byte for byte) copy of a file. Use tar and cpio to copy files to archives. cp makes a copy of a file, but it is not necessarily an exact copy (for example, permissions might not be the same on the copied version of the file).

A user is trying to access a file system mounted at /mnt/sdb1, but receives an error that states No such file or directory. Which commands can you use to see the current mount points? (Select TWO). df fsck mntfs mounts mntchk mount

df mount Use the mount command with no arguments to show all the current mount points. df will also show which file systems are mounted to what points. The command fsck is used to check file systems but does not show the mount points. There are no commands called mounts, mntchk, or mntfs.

You are requested to help a user who reports that he has no more local storage space. You go to his system and log in as the root user. Which of the following commands will display the available disk space on all partitions? (Select TWO). du -h fdisk -free du -a df -h dskuse -free df

df -h df df shows the size, used blocks, and available blocks for each partition. Using df -h shows the same information in bytes instead of blocks. du is used to show the disk usage of each file in a directory in blocks; du -a is for all files, and du -h shows the usage in bytes, not blocks. Fdisk is used for partitioning a drive. There is no dskuse command.

When creating an ext2 or ext3 file system, a fixed number of inodes is assigned. Which of the following commands shows the number of inodes, number of free inodes, and number of used inodes? ls -i du --inodes df -i mke2fs -i

df -i df -i or df --inode displays the total number of inodes, used inodes, and free inodes; the percentage of inodes in use; and the mount point. du --inodes lists inode usage information instead of block usage. There is no -I option available. ls -i or ls --inode displays the index number of each file or directory. mke2fs -i is used to specify the bytes per inode ration to be used during the file system creation process.

You have created a separate partition for the sales team and mounted it to the /sales directory. The team is about to begin a new project, and they want to make sure there is enough disk space to hold upcoming files. Which of the following commands will show you the amount of free space? part /sales df /sales diff /sales free /sales

df /sales Use the df /sales command to view the free space on the partition. Use the free command to show memory statistics. Use the diff command to compare two files.

Edit mount options in /etc/fstab

dit the /etc/fstab file to add the mount options for the file system to enable quotas: usrquota enables quotas for users. grpquota enables quotas for groups.

What command would you enter at the command prompt to list all files and directories in the badams home directory along with a file size and a total amount of space taken up by the directory?

du -ac /home/badams Use du /home/badams to lists all files and directories in the badams home directory along with a file size and a total amount of space taken up by the directory. The du command displays files and file sizes in and below a specified directory. Common du options include the following: -c lists a total amount of space used in the directory. -h displays the output in human readable format (bytes, KB, MB, GB). -s lists only the total, not each file. -a evaluates all files, not just directories.

Which of the following command allows you to use an alternative superblock when the primary superblock has been corrupted? fsck /dev/sd1 e2fsck -b 16385 /dev/sda1 mke2fs -n /dev/sda1 mkfs -t ext2 /dev/sda1

e2fsck -b 16385 /dev/sda1 Use the e2fsck -b 16385 /dev/sda1 command to use the alternative superblock at block 16385. The mke2fs -n /dev/sda1 command tells you the locations of the superblocks on the disk. The fsck /dev/sd1 command starts the fsck utility on the device. The mkfs -t ext2 /dev/sda1 command formats the sda1 partition.

Which of the following commands will open the quota file for a specific user? quota -u edquota -u quotaon -u repquota -u

edquota -u Use edquota -u to open and edit the quota file for a specific user. quota -u displays the user's quota. repquota displays a summary of the disk usage and quotas for the specified file systems, including the specific number of files and used space. quotaon enables quotas for the mounted file system; however, it does not a have a -u option.

You want to archive some configuration files to the floppy drive. You are using the cpio utility. Which line will create the archive on the floppy? cpio -ov /etc/*.conf /dev/rfd0 cpio -ov /dev/rfd0 /etc/*.conf ls /etc/*.conf | cpio -ovd > /dev/rfd0 cpio -cv /etc/*.conf /dev/rfd0

ls /etc/*.conf | cpio -ovd > /dev/rfd0 The correct command is ls /etc/*.conf | cpio -ov > /dev/rfd0. The cpio command is different from many Linux commands in that it processes from a list, one line at a time. Therefore it is commonly used with commands such as s or find where the output is piped into cpio as shown in this example. The option o is create, v is verbose mode and d means to store the directory path with the file. The other option is to use commands such as find or ls to make a text file and then reference that text file in the cpio command, as shown here: ls /etc/*.conf > /root/etclist.txt and then cpio -ov /root/etclist.txt > /dev/rfd0

Anna is attempting to unmount the mount point /mnt/data. The umount command failed and displayed error message stating that the device is busy. Anna suspects there my be an open file causing the issue. Which of the following commands will show Anna a list of open files? uname awk lsof stat

lsof lsof displays open files in the file system. lsof displays the following information by default: The command used to access the file Process ID Name of the user accessing the file A file descriptor File node type Device numbers File size Inode address File path awk is an interpreter for the AWK text processing language. stat displays the status of a file or process. You would first need to know the name of the file or process. uname shows information about the system.

A number of new file systems have been added to the server and you want them to be active now. You also do not want to bring the server down. Which command makes the changes active? mount -t mount -r mount -a init q

mount -a The command mount -a forces a re-read of the entries in the /etc/fstab file and makes the settings active.

You need to mount the CD-ROM device to the /media/cdrom directory. What command should you enter at the command prompt?

mount /dev/cdrom /media/cdrom Use mount /dev/cdrom /media/cdrom to mount the CD-ROM device to the /media/cdrom mount point. The /dev/cdrom device file name is just a symbolic link to the actual device (sr0), so mount /dev/sr0 /media/cdrom will also work.

You have partitioned and formatted a new hard drive, sdc. You want to mount the first partition on sdc to directory /mnt/newdisk. Which command will perform the mount correctly? mount /dsk/sdc_first /mnt/newdisk mount /sdc1 /mnt/newdisk mount /mnt/newdisk /dev/sdc1 mount /dev/sdc1 /mnt/newdisk mount /dev/sdc /mnt/newdisk

mount /dev/sdc1 /mnt/newdisk When mounting a device and partition, you specify the /dev directory and the device and partition you want to mount and then the mount point to mount the device to. The correct format for mount is mount item and mount point. Devices are always in the /dev directory. There is no /dsk directory. Partitions on hard drives are numbered.

What is the name of the package that must be installed if you want to use disk quotas on your Linux system?

quota If the quota package is not installed on your system, you can install it with the dnf install command. quotaon.service is used to enable quotas on a given file system.

Which command should you enter at the command prompt to display the current user's quota limits and disk usage?

quota Use quota to display the current user's quota. Be aware of the following options: -u shows the quota for a user. -g shows the quota for a group -v shows current the current usage, the hard quota, and the soft quota for blocks and inodes.

Which of the following commands displays the disk usage and quota limits for the development group? edquota -g development quotacheck -g development repquota development quota -g development

quota -g development Use quota -g development to display the disk usage and quota limits for the development group. By default, the quota command displays the current user's quota usage, but the -g option specifies a group. repquota displays the disk usage and quota limits for groups if the -g option is present. quotacheck creates the aquota.user and aquota.group files in the file system. Use edquota to open and edit a user's quota, edit a group's quota, or change the grace period.

Which of the following sets of permissions represent the minimal permissions required to allow a user to list the contents of a directory? rw- rwx r-x r--

r-x To list the contents of a directory, a user must have the read (r) permission and the execute (x) permission.

SGID (Set Group ID)

s in the execute permission position of the group permissions e.g. rwxrwsrw- Octal Value: 2 If the SGID bit is set: On a file, the program will run with the group permissions of the group owner. On a directory, a newly created file will receive/inherit the same group owner as assigned to the parent directory.

SUID (Set User ID)

s in the execute permission position of the user permissions e.g. rwsrw-rw- Octal Value: 4 If the SUID bit is set, the program will run with the permissions of the file owner, not with the permissions of the user who runs the program. The most common use of SUID is to allow users to run a command as the root user. Users do not become the root user, but rather the command or program runs as if executed by the root user. Some programs require the SUID bit set for proper functionality. Be careful in setting the SUID bit as it could give a program too many permissions.

You need to back up Jane's files in her /home/user/jane directory. Which command will create an archive of these files in the /root directory? (Select TWO). tar -cvf /root/jane.tar /home/user/jane tar -czvf /root/jane.tgz /home/user/jane tar -cgvf /root/jane/tgz /home/user/jane tar -cbvf /root/jane.tbz /home/user/jane tar -cjvf jane.tbz /home/user/jane

tar -cvf /root/jane.tar /home/user/jane tar -czvf /root/jane.tgz /home/user/jane tar -cvf will create a standard archive, jane.tar, in the root directory. tar -czvf will create a compressed archive, jane.tgz, in the root directory. tar -cjvf does create a compressed archive (using bzip2), but not in the root directory. The command tar -cbvf is incorrect due to the -b switch, and tar -cgvf is incorrect due to the -g switch.

You have a tape archive mounted in /dev/rmt12. You need to get a list of the file contents. Which command will list the contents? tar -tc /dev/rmt12 tar -tf /dev/rmt12 ls -la /dev/rmt12 ls -lc /dev/rmt12

tar -tf /dev/rmt12 tar -tf /dev/rmt12 lists the contents of the archive. tar -tc /dev/rmt12 will not work because the -c switch is for creating an archive. ls does not list the contents of an archive.

You have a SCSI tape drive st0. You want to back up the contents of /var/oracle. Which command will perform the backup? backup /var/oracle /dev/st0 cp /var/oracle /dev/st0 tar -vcf /dev/st0 /var/oracle tar -vcf /var/oracle /dev/st0

tar -vcf /dev/st0 /var/oracle tar -vcf /dev/st0 /var/oracle will create an archive. tar -vcf /var/oracle /dev/st0 is incorrect because the destination and source are reversed. cp does not create an archive. There is no standard Linux command called backup.

You need to restore a file, yearend.xls, from the archive 013004.tar.gz in the backup directory. The file needs to be restored to /home/accounting. Which command will perform the restore? unzip -xzvf /backup/013004.tar.gz /home/accounting/yearend.xls tar -xvf /backup/013004.tar.gz /home/accounting/yearend.xls tar -xzvf /backup/013004.tar.gz /home/accounting/yearend.xls extract -xzvf /backup/013004.tar.gz /home/accounting/yearend.xls

tar -xzvf /backup/013004.tar.gz /home/accounting/yearend.xls tar -xzvf is correct. tar needs the switches -x to extract, -z to uncompress with gzip format, and -f to tell tar the file argument is an archive. -v is the verbose switch and is optional. tar -xvf is missing the -z switch because the archive is compressed with gzip. The command extract does not exist. The command unzip does exist, but will not extract files from a gzip archive.

You need to convert the file system of /dev/sdb3 from ext2 to ext3 without affecting the data on the drive. What command and option should you enter at the command prompt?

tune2fs -j /dev/sdb3 Use tune2fs -j /dev/sdb3 to convert the file system from ext2 to ext3 without affecting the data on the drive. Use tune2fs to adjust tunable file system parameters on ext2, ext3, and ext4 file systems. Other tune2fs options include the following: -c adjust the number of mounts after which the file system will be checked. -e remount-ro remounts the file system as read-only. -l lists the contents of the file system super block. -o acl enables Posix access control lists.

The umask can also be represented and changed using a symbolic (letter) representations of the mask.

u - User (the owner of the file) g - Group (any member of the file's defined group) o - Other (anyone else) a - All (equivalent to all of the above - u, g, and o) The syntax for using symbolic representation is: umask symbolic_letter[+ or -]permission. Example: umask g-w or umask g+w

A user calls the help desk. Each time he creates a new text file, permissions of 640 are applied to the file, and he must use chmod to set them to 644. What command should you enter in the user's profile to set the default permission for newly created files to 644? umask 640 umask -640 umask 0022 umask 0027

umask 0022 The user currently has an umask value of 0027, which is what is causing the new files to have permissions of 640. Changing this value to 0022 will allow all newly created files to have permissions of 644.

Partition /dev/sdb2 is mounted to /mnt/temp. You need to unmount /dev/sdb2. Which commands would you use? (Select TWO). (Each option is a complete solution.) unmount /dev/sdb2 umount /mnt/temp umount /dev/sdb2 dismount /mnt/temp dismount /dev/sdb2

umount /mnt/temp umount /dev/sdb2 umount /mnt/temp Correct Answer: umount /dev/sdb2

You have an xfs file system in your Linux computer. You need to display the XFS file system parameters, such as the block size and inode data structures. Which of the following commands should you use? (Select TWO). (Each answer is an independent solution.) xfs_growfs -n mkfs.xfs xfs_info xfs_metadump

xfs_growfs -n xfs_info xfs_growfs -n and xfs_info display the XFS file system parameters, such as the block size and inode data structures. The XFS file system is proficient at handling large files and offers smooth data transfers. It also can reside on a regular disk partition or on a logical volume. xfs_metadump copies (dumps) the metadata from an XFS file system to a file. mkfs.xfs creates an XFS file system.

You have an XFS file system in your Linux system represented by /dev/sdb1. You need to copy all the filenames on the drive to the /reviewxfs file. You must be able to read the filenames in the /reviewxfs file. Which of the following commands should you use? xfs_metadump -e /dev/sdb1 /reviewxfs xfs_info /dev/sdb1 /reviewxfs xfs_metadump -o /dev/sdb1 /reviewxfs xfs_growfs -n /dev/sdb1 /reviewxfs

xfs_metadump -o /dev/sdb1 /reviewxfs Use xfs_metadump -o /dev/sdb1 /reviewxfs to copy (dump) the metadata from the XFS file system on /dev/sdb1 to the /reviewxfs file. By default, the file names and extended attribute names are obfuscated before they are dumped. -o disables obfuscation of file names and extended attributes. xfs_metadump -e stops dumping the file system if there is a read error. xfs_growfs -n and xfs_info display the XFS file system parameters, such as the block size and inode data structures.

Type the full device file name for the first partition on the hard drive with the third lowest ID number.

/dev/sdc1 /dev/sdc1 is the first partition (1) on the hard drive with the third lowest ID number (c). /dev/dsxn file names identify hard drives and partitions. A letter follows the sd designation and identifies the ID of the hard drive. At the end of the name, a number identifies the partition on the drive.

You have added several new hard disks to your system. After partitioning and formatting, you have modified a configuration file to mount these new file systems automatically. You want to document the change you made. Which of the following configuration files would you document? /etc/crontab /etc/fstab /etc/modules.conf /etc/inittab

/etc/fstab You want to document the changes you made in /etc/fstab. /etc/inittab defines the initial processes on boot-up. /etc/modules.conf defines kernel loadable modules. /etc/crontab defines jobs that run at particular dates and times.

Which of the following hexadecimal codes represents an extended partition? 0x85 0x83 0x82 0x88

0x85 0x85 represents a Linux extended partition. 0x82 represents a Linux swap partition. 0x83 represents a Linux partition. 0x88 represents a Linux logical partition.

Which of the following is the maximum number of primary partitions that can be created on a single hard disk drive? Unlimited 2 4 8

4 There can be a maximum of four primary partitions on a single hard disk drive. A partition is a logical division of a storage device associated with a hard disk drive. A primary partition is one that is used to store an operating system. Primary partitions: Can hold operating system boot files. Cannot be further subdivided into logical drives. Can be formatted.

Primary

A primary partition is used to store data as well as the operating system. Primary partitions: Can hold operating system boot files. Cannot be further subdivided into logical drives. Can be formatted with a file system. *There can be a maximum of four primary partitions or three primary partitions and one extended partition on a single hard disk drive.

Solid state drive (SSD)

A solid-state drive is a storage device that functions much like a hard disk drive, using the same block-based I/O operations. However, instead of aluminum platters, SSDs use flash memory to store data. SSDs typically provide storage capacity comparable to that of a small hard drive. SSDs are beginning to replace standard hard disk drives in computer systems. Some of the advantages of SSDs include that they: > Are much faster than hard drives. > Have no moving parts, so they last longer. > Have lower power consumption than hard drives. > Are less susceptible to physical damage. > Are smaller and lighter than hard drives. > Use the same SATA interface used by standard hard disk drives. The main disadvantage currently for solid state drives is cost; they are several times more expensive than comparable hard drives.

Logical Volume Manager (LVM)

A system of managing logical volumes or file systems made up of physical volumes mapped through a volume group.

File system

A system that specified how data is organized and stored on storage media.

Gloria, a Linux administrator, used the gdisk utility to create eight partitions on a new hard drive. Which of the following BEST describes the partitions Gloria has created? All eight partitions are the same. They are simply partitions. There are no primary, extended, or logical partitions. The first three partitions are primary partitions. The fourth is an extended partition that holds five logical partitions, making eight partitions in total. All eight partitions are logical partitions. There are no primary or extended partitions. The first seven partitions are primary partitions. The eighth partition is an extended partition that can be used to contain logical partitions.

All eight partitions are the same. They are simply partitions. There are no primary, extended, or logical partitions. Since there are eight partition and gdisk was used, Gloria must be using GPT. Therefore, all partitions are the same. They are just partitions. GUID partitioning does not use the concept of primary, extended, or logical partitions. Primary, extended, and logical partitions are part of MBR partitioning.

Primary partition

Am MBR partition that contains only one file system.

Volume group

An abstract container that combines physical volumes into the storage pools from which logical volumes are created.

Tom, a Linux administrator, has installed a new hard disk. He creates two primary partitions, sdb1 and sdb2, and one extended partition, sdb3. He formats sdb1 with ext3 and sdb2 as a swap area. When Tom attempts to format sdb3 as a swap area, he is unable. Which of the following explains why Tom can't format sdb3? A swap area can only reside on the second primary partition. An extended partition can't be formatted. A single drive can only have one swap area. Only a primary partition can be formatted as a swap area.

An extended partition can't be formatted. An extended partition can't be formatted. A swap area can be located on any partition. A swap area can be located on a primary partition or a logical partition within the extended partition. A single drive can have multiple swap areas.

Extended

An extended partition is an optional partition that contains logical partitions. Because an operating system cannot be booted from a logical partition from within an extended partition, this type of partition is not bootable. Extended partitions: Can be further subdivided into an unlimited number of logical partitions. Cannot be directly formatted with a file system. However, logical partitions within an extended partition can be formatted with a file system. Only one extended partition can exist on a single hard disk drive.

Device file

An interface for a device driver that appears in the Linux file system under the /dev directory.

Extended partition

An optional partition that can contain multiple logical partitions, each with their own file system.

8.3 Logical Volume Manager

As you study this section, answer the following questions: After you create your logical volume, what should you do? What should you do before running vgreduce? Which command extends the size of a logical volume? What is the difference between pvcreate and lvcreate? In this section, you will learn to: Use LVM. Create physical volumes. Define volume groups. Define logical groups. Key terms for this section include the following:

8.4 File Systems

As you study this section, answer the following questions: How would you make mkfs automatically calculate the size of the data blocks for the file system? Which command can you use to create the ReiserFS file system type? How would you create and activate a swap partition? Which file systems provide journaling? What is the difference between the ext3 and ext4 file system types? In this section, you will learn to: Format a hard disk with a specified file system. Create and activate a new swap partition. Key terms for this section include the following:

8.2 GUID Partitions

As you study this section, answer the following questions: What utility should you use to manage disk partitions? Which command allows you to back up and restore a disk's partition table? How many partitions does GPT allow on a storage device? Why should you carefully plan your partition changes before using parted? In this section, you will learn to: Manage GUID partitions. Key terms for this section include the following:

8.5 Mounting File Systems

As you study this section, answer the following questions: Which directory contains mount points specifically for external storage devices? What do you need to do to make a USB drive accessible? What happens if you mount a volume to a directory that already contains data? How can you verify that a volume is mounted correctly? Which commands can you use to view the devices that are currently mounted? How can you prevent users from mounting an optical media drive? In this section, you will learn to: Mount a volume to a specified directory with a specified file system. Unmount a volume. Mount a DVD drive to a specified directory. Key terms for this section include the following:

8.1 MBR Disk Partitions

As you study this section, answer the following questions: Why is it important to plan disk partitioning before installing Linux? What is the difference between a primary partition and an extended partition? Which utility would you use to manage disk partitions? Linux allows a maximum of only four primary partitions on a single hard disk drive. What can you do to get around this limitation? What does the /dev/sda3 device file name identify? Which directory stores device file names? In this section, you will learn to: Use fdisk to view the partition information on the system. Key terms for this section include the following:

Which of the following steps must be completed after creating a logical volumes so that the logical volume can be used to store files? Add the volume to a volume group and mount the group in the file system. Create file systems on the volumes and mount them. Give the volume a descriptive name and allocate space to it. Scan for logical volumes and extend them.

Create file systems on the volumes and mount them. After logical volumes have been created, the next step is to create file systems on them and then mount them: A file system is create using mkfs, just as with traditional partitions. Use the following syntax:mkfs -t file_system /dev/volume_group/logical_volume You can mount a logical volume using the mount command, just as you would to mount file systems on traditional partitions. Use the following syntax:mount -t file_system /dev/volume_group/logical_volume/mount_point Scanning for logical volumes and extending them is not the next step. Giving the logical volume a descriptive name and allocating space to it is not the next step. Adding the volume to a volume group and mounting the group in the file system is not the next step.

Hard disk drive (HDD)

For decades, hard disk drives have been the primary type of long-term storage used in desktop and server systems. Hard disk drives magnetically store information using spinning aluminum disks called platters. Each platter is coated with a magnetic surface material that allows the hard disk's read/write heads to store and retrieve information to and from the drive. The faster the disk's platters spin, the faster data can be accessed. A hard disk drive identifies where data can be stored on its platters using several parameters that are collectively called the drive's geometry. The following parameters are used by the storage device interface to determine how the drive is accessed and where data can be stored: > Heads specifies to the number of read/write heads in the drive. > Cylinders specifies the number of concentric parallel tracks on all sides of all platters in the hard disk drive. > Sectors Per Track specifies the number of wedge-shaped areas the platters have been divided into. Hard disk drives are connected to the system motherboard using a storage interface. The interface is commonly integrated within the motherboard itself. However, it may also be implemented using an expansion card installed in an expansion slot. In a modern desktop computer system, the following storage interfaces may be used: > Serial ATA (SATA) > Small Computer System Interface (SCSI) > Parallel ATA (PATA) (This interface is obsolete) Hard disks provide several advantages, including the following: > They can store a large amount of data. > They provide reasonably fast access speeds. > The store data at a relatively low cost per megabyte. Hard disks also have several disadvantages, including the following: Hard disks wear out over time because they are mechanical devices that contain moving parts. Hard disks are vulnerable to physical damage. For example, dropping a hard drive while it is spinning can cause the read/write heads to dig into the platter, destroying any data stored there.

GPT Advantages

GPT has several advantages over using MBR. GPT: Uses only one type of partition. There are no primary, extended, or logical partitions. Supports extremely large storage devices and partitions. Allows up to 128 partitions on a storage device. Stores a copy of the partition table in the first and last sectors of the storage device. If one copy gets corrupted, then the redundant copy can be used instead. Verifies the integrity of the partition table using a cyclic redundancy check (CRC). Assigns unique IDs to each storage device and partition.

External flash storage device

Like an SSD, external flash storage devices store information using programmable, non-volatile flash memory. External flash storage devices most commonly connect to the computer using a USB interface. Advantages of flash devices include: > Portability > Larger storage capacity than optical discs > Relatively fast read access Some of the disadvantages of flash devices are: > Less storage capacity than hard disks > Relatively slow write speeds Common external flash storage devices include: CompactFlash cards eMMC cards SD cards SSD cards MiniSD cards MicroSD cards xD cards Hybrid cards (combines SSD and HDD technology) Memory sticks

Optical disc

Optical discs, such as CDs, DVDs, and Blu-ray discs, store information using pits and lands in the surface of their reflective coating. As the disc spins, the optical drive uses a laser to read data stored on the surface of the disc in the form of deflected and reflected light. Some advantages of optical discs include the following: > They are highly portable. > They are inexpensive. > Recordable optical discs allow you to both read and write data. > They have a long shelf life and are relatively sturdy. > They use the same storage interfaces used by standard hard disk drives (SATA, SCSI, and PATA). > Blu-ray discs can store a large amount of data (25 GB or more, depending upon the format). Some disadvantages of optical discs include: > They are slower than hard disks, SSDs, and external flash devices. > Older optical disc standards have limited storage capacities (650 MB for CDs, 4.7 GB for DVDs). > There are occasionally compatibility issues between disc formats and readers.

Linux Storage Device Files

Storage devices in Linux are represented by device files. > Device files are located in the /dev directory. > The /dev directory contains files for all types of devices, even those that don't exist on the system. > Not only do device files represent devices, they also indicate how data is transferred to that device: - Devices, such as hard drives, that receive data in block transfers by using memory to buffer the transfers are called block devices. > The lsblk command lists information about block devices including name, type (disk or partition), size, and mount point. > The blkid command also lists the attributes of block devices including its universally unique identifier (UUID), file system type and volume label. > The /etc/crypttab file describes encrypted block devices that are set up during system boot. Each line describes one encrypted block device. Each line is in the form name encrypted-device password options. The first two fields are mandatory, the remaining two are optional. > Devices that send data transfers character-by-character (like a keyboard) are called character devices. - A raw device is a special type of logical device that is associated with a character device file. The table below lists and describes the most common device files:

8.5.5 Unmount a Volume

The /dev/sdb2 volume is mounted to an uncommon mount point directory, /root/newdrive. You need to remove the volume from the /root/newdrive mount point and remount it to the /mnt/drive2 directory. In this lab, your task is to: Unmount /dev/sdb2 from /root/newdrive. Mount /dev/sdb2 to /mnt/drive2. Use the mount command to verify that the volume is mounted correctly. Complete this lab as follows: At the prompt, type umount /root/newdrive and press Enter to unmount the volume from the mount point directory. Type mount /dev/sdb2 /mnt/drive2 and press Enter to mount the volume.

GPT

The GUID Partition Table scheme that replaces the MBR partitioning scheme.

8.2.3 GUID Partition Management Facts

The Globally Unique Identifier Partition Table (GPT) scheme has been introduced as a replacement for the Master Boot Record (MBR) partitioning scheme. This lesson covers the following topics: GPT advatages GPT management tools

MBR Limitations and Workarounds

The MBR partition format has many limitations: The master boot record must be installed in the first 512 bytes of the hard disk. Only four standard partitions can be created on a storage device. The default block size of 512 bytes limits partitions to a maximum size of 2 TB. Many workarounds have been implemented over the years to address these issues: Logical Block Addressing (LBA) allows the use of larger hard disks. Use of 4,096 byte sectors increases the maximum partition size on a disk. Extended partitions can contain many logical partitions.

ReiserFS

The Reiser file system that is an alternative to the ext3 file system.

fdisk

The fdisk utility is used to manage partitions on a hard disk. The fdisk utility has the following characteristics: > When you create a partition, fdisk requests a beginning/ending sector or size. - The size is indicated using K (kilobytes), M (megabytes), G (gigabytes), or T (terabytes). > When creating a partition, you specify the partition type using a hexadecimal code. Common hexadecimal codes include: 0x82 (Linux swap) 0x83 (Linux partition) 0x85 (Linux extended partition) 0x8e (Linux LVM partition) > Using the -l option displays the current partition configuration on the system. Type fdisk [device_name] at the command prompt to enter the fdisk utility. Within the fdisk utility, you can run the following options: l lists the partition types supported. m displays the help screen. n creates a new partition. p displays the partition table for that device *The /proc/partitions file contains a table with major and minor number of partitioned devices, their number of blocks, and the device name in /dev. q exits fdisk without saving changes. w writes the partition table to disk (saving the file) and exits the fdisk utility. d deletes a partition.

GPT Management Tools

The following utilities can be used to manage GPT partitions.

8.1.4 MBR Partition Management Facts

The master boot record (MBR) partition format has been used by many operating systems, including Linux, for a number of years. This lesson covers the following topics: MBR limitations and workarounds Partition types MBR partition tools

partprobe

The partprobe command makes a request to the operating system to re-read the partition table. The operating system kernel reads the partition table and recognizes the table changes.

/dev/srn

This is a special designation used to identify optical drives in the system. The optical drive with the lowest ID number is addressed as sr0, the optical drive with the next lowest ID number is addressed as sr1, and so on. Many distributions include symbolic links named /dev/cdrom or /dev/dvd that point to the actual device file (sr0).

8.1.6 View the MBR Partition Table

Type fdisk -l at the prompt to answer the following questions about the partition table: Which physical disk is the swap area on? 1st Which disk partition is the swap area on? 5th What is the beginning cylinder for the swap area? 62191 What is the allocated size of the swap area in blocks? 473632 Which physical disk is the boot disk on? 1st Which disk partition is the boot disk on? 1st fdisk -l displays the partition table on the device. Identify the swap volume by looking for "82 Linux swap" at the end of an entry line. /dev/sda5 is on sda, the first (and only) physical disk. /dev/sda5 is the fifth partition on the disk (sda). 62191 is the beginning cylinder for the swap area. 473632 is the allocated size of the swap area in blocks. /dev/sda1 is the Boot partition. Identify the boot volume by looking for the asterisk (*) in the Boot column.

Which file system is a FAT32 file system for Linux?

VFAT VFAT is a FAT32 file system for Linux. VFAT does not support journaling, but includes long name support. Support for VFAT must be compiled into the kernel for the system to recognize the VFAT format.

mount

View the currently mounted volumes on the system.

df

View which file systems are mounted to specific mount points.

8.5.4 Mount a Volume

You recently installed and formatted a new hard drive in your system. Its device file name is /dev/sdb1. Now you want to mount the volume. Remember that: Volumes are mounted to empty directories. A common place to mount volumes is to a directory inside of the /mnt directory. You can use the -t option to specify the file system. In this lab, your task is to: Create the /mnt/disk directory. Mount /dev/sdb1 to the /mnt/disk directory with the ext3 file system. When you are finished, use the mount command to verify that the volume is mounted correctly. Complete this lab as follows: At the prompt, type mkdir /mnt/disk and press Enter. Type mount -t ext3 /dev/sdb1 /mnt/disk and press Enter. Type mount and press Enter to verify that the volume is mounted correctly.

8.4.8 Create a Swap Area

You recently upgraded your computer and added an extra 512 MB of RAM. Consequently, you want to increase your swap space by adding a new swap area. The second hard disk has an unused partition (/dev/sdb2) that you want to format for the swap area. In this lab, your task is to: Create a swap partition on /dev/sdb2. Activate the swap partition. Complete this lab as follows: At the prompt, type mkswap /dev/sdb2 and press Enter. Type swapon /dev/sdb2 and press Enter.

8.4.6 Format a Hard Disk with ext3

You've installed a new hard drive and created a partition on the drive. Now you need to format the partition before you can save data on the new hard drive. In this lab, your task is to format the /dev/sdb1 partition with the ext3 file system. Complete this lab as follows: At the prompt, type one of the following commands: mke2fs -j /dev/sdb1 and press Enter (the -j switch enables journaling). mkfs -t ext3 /dev/sdb1 and press Enter.mkfs.ext3 /dev/sdb1 and press Enter.

8.3.4 Create a Logical Volume

You've installed a second hard drive and created one partition on the drive. You have also installed a third hard drive and created two partitions on the drive. In this lab, your task is to create a logical volume using the first partition on each new drive as follows: Use pvcreate to initialize the partitions for use with LVM. Use vgcreate to create a volume group call data using these two partitions. Use lvcreate to create a 1 Terabyte logical volume called art from the data volume group. Create a directory called product where you can mount the new logical volume. Format the new logical volume with ext4. Mount the logical volume to the product directory. Change to the product directory and create a file call newproduct. Verify the creation of the file and amount of disk space available on this new volume. Complete this lab as follows: At the prompt, type ls /dev/sd* and press Enter to view the partition information. Note that partitions sdb1, sdc1, and sdc2 are available on the new hard drives. Type pvcreate /dev/sdb1 /dev/sdc1 and press Enter to initialize the first two partitions on each drive for use with LVM. Type vgcreate data /dev/sdb1 /dev/sdc1 and press Enter to create the volume group. Type vgs and press Enter to verify the creation of the new volume group. Type lvcreate --size 1t -n art data and press Enter to create the new volume. Type mkdir product and press Enter to create a new folder to mound the logical volume in. Type mkfs.ext4 /dev/data/art and press Enter to create the file system. Type mount -t ext4 /dev/data/art product and press Enter to mount the volume in the product folder. Type cd product and press Enter to change into the product folder. Type touch newproduct and press Enter to create a file. Type ls and press Enter to view the new file. Type df -h and press Enter to view the logical volume.

8.4.7 Format a Hard Disk with ext4

You've installed a third hard drive (sdc) and created two partitions on the drive. Now you need to format both partitions. In this lab, your task is to format the partitions with the ext4 file system. Complete this lab as follows: > At the prompt, type ls /dev/sd* and press Enter to view the available partitions. sdc1 and sdc2 are the partitions on the third hard drive. > Type one of the following commands and press Enter to format the first partition on the third drive: mke2fs -t ext4 /dev/sdc1 mkfs -t ext4 /dev/sdc1 mkfs.ext4 /dev/sdc1 > Type one of the following commands and press Enter to format the other partition: mke2fs -t ext4 /dev/sdc2 mkfs -t ext4 /dev/sdc2 mkfs.ext4 /dev/sdc2

A technician recently added a new disk drive to a system, and the drive is not available. Which of the following commands scans the host bus adapter (HBA) and detects the newly added drive? echo "- - -" > /sys/class/scsi_host0/scan lvscan mdadm pvscan

echo "- - -" > /sys/class/scsi_host0/scan echo "- - -" > /sys/class/scsi_host/host0/scan re-scans the bus to detect the newly added drive. pvscan scans all disks for physical volumes and displays all found physical volumes on the system and their associated volume groups. lvscan scans all known volume groups in the system for logical volumes and displays the result.The mdadm utility can be used to manage and monitor software RAID devices.

Which of the following is the MOST common Linux file system? JFS XFS ext4 ReiserFS

ext4 Ext4 is the most common Linux file system. XFS, JFS and ReiserFS are newer and less popular Linux file systems.

The system requirements for a new Linux computer show that the system will primarily be used to store documents of small size. Which of the following file systems would be the MOST efficient at storing these documents on a Linux system? HPFS ext4 ext2 ext3

ext4 The Ext4 file system is more efficient at storing small files than most file systems. Ext2 and Ext3 store small files less efficiently than Ext4. HPFS is more efficient for storing files than most files systems, but HPFS is not a Linux file system.

Which of the following Linux file systems support journaling? ext4 ext2 VFAT swap

ext4 The ext4 file systems support journaling. Journaling is a method used to help ensure data and file system integrity and minimize boot times after system crashes. The ext2 file system does not support journaling. VFAT is a FAT32 file system for Linux and does not support journaling. The swap file system is a pseudo file system and is used as virtual memory.

/dev/fdn

fd files identify floppy drives. Device numbering begins at 0. For example, /dev/fd0 is the first floppy drive.

Which of the following commands/command sequences can be used to view the partition information on the first hard disk? (Select TWO.) fdisk /dev/sd1, then press p fdisk /dev/sda, then press p cat /proc/part cat /etc/part fdisk -l

fdisk /dev/sda, then press p fdisk -l Both the fdisk -l command and the fdisk /dev/sda command followed p can be used to view partition information for the first hard disk. The /proc/partitions file also holds partition information, but is difficult to read. The cat /proc/part command will most likely return "No such file or directory" since the /etc/part file does not likely exist. The cat /etc/part command will most likely return "No such file or directory" since the /etc/part file does not likely exist. The fdisk /dev/sd1 command will return "No such file or directory" since the /dev/sd1 file does not exist. (The first disk is sda, not sd1.)

Which of the following commands partitions the second hard disk on a Linux system? fdisk /sd0-1 format /dev/sdb1 fdisk /dev/sdb fdisk /dev/sdc

fdisk /dev/sdb The fdisk /dev/sdb command can be used to open the fdisk utility to partition the second hard disk. The fdisk /sd0-1 command will return "No such file or directory" since the /sd0-1 device file does not exist. The format /dev/sdb1 command will format the first partition on the second disk. It will not partition the second hard disk. The fdisk /dev/sdc command can be used to open the fdisk utility to partition the third hard disk, but not the second hard disk.

Which partition management utility can be used to define and change various different GUID partition configurations without committing the configuration to the disk until the w command is used? lsblk gdisk fdisk parted

gdisk The gdisk utility allows you to define and change various different GUID partition configurations. The configurations are only saved in memory until you are ready to commit them to disk. The fdisk utility allows you to do the same thing, but only with MBR partitions. The parted utility writes the configuration to disk immediately as you define it. The lsblk utility is used to list block devices.

You have installed a new blank hard drive on you Linux system. This is the second drive on the system, so it is represented in the file system by the /dev/sdb file. You need to create GUID partitions on this drive. What command do you use to start the GUID disk management utility to create partitions on the /dev/sdb drive?

gdisk /dev/sdb The GUID disk management utility is called gdisk. It works very much like the fdisk utility that is used to manage MBR partitions. To start up the gdisk utility to create partitions on the /dev/sdb drive, you enter gdisk /dev/sdb.

gdisk

gdisk: Creates and delete GPT partitions. Displays information about a partition. Changes the name and type of a partition. Verifies a hard disk. Backs up and restores a disk's partition table. Converts an MBR partition table to a GPT partition table. The syntax for using gdisk is gdisk device_name. The following options can be used within gdisk: ? displays the help screen. b backs up GPT information to a file. c changes a partition's name. d deletes a partition. i displays detailed partition information. l lists partition type codes. n adds a new partition. o creates a new GUID partition table. p prints the partition table. q quits gdisk without saving changes. s sorts the list of partitions. t changes a partition's type code. v verifies a storage device. w writes changes to the partition table of the storage device and exits gdisk. gdisk /dev/sdc opens gdisk and edits the partition table on the third storage device in the system.

Which of the following commands creates a logical volume named video from the home volume group and configures it with 2 TB of disk space? vgcreate -L 2T -n home video vgcreate -L 2T -n video home lvcreate -L 2T -n video home lvcreate -L 2T -n home video

lvcreate -L 2T -n video home The lvcreate -L 2T -n video home command creates a logical volume named video from the home volume group and configures it with 2 TB of disk space. The lvcreate -L 2T -n home video command creates a logical volume named home from the video volume group and configures it with 2 TB of disk space. The vgcreate -L 2T -n video home command is normally used to create physical volumes, but will return an error since there is no -L option. The vgcreate -L 2T -n home video command is normally used to create physical volumes, but will return an error since there is no -L option.

You are using LVM on your Linux system to manage the existing volumes. What command do you enter to scan for logical volumes on the system?

lvscan The lvscan command is a Logical Volume Manager (LVM) command that scans all known volume groups or all supported LVM block devices in the system for logical volumes. LVM provides an alternative method to manage partitions on a Linux system. LVM gives a system administrator more flexibility while allocating storage on a system.

Which of the following utilities is used to manage and monitor software RAID devices? pvscan /dev/mapper lvscan mdadm

mdadm mdadmin is a utility used to manage and monitor software RAID devices. /dev/mapper is the directory where logical volumes and RAIDs can be found. lvscan scans all known volume groups in the system for logical volumes and displays the result. pvscan scans all disks for physical volumes and displays all found physical volumes on the system and their associated volume groups.

Which of the following commands formats the second partition on the fourth disk drive with the ext3 file system? format -e3 sdb2 mke2fs -e3 /dev/sdd2 mke2fs -j /dev/sdd2 fdisk -e3 /dev/sdb2

mke2fs -j /dev/sdd2 Use the mke2fs -j /dev/sdd2 to make an ext3 filesystem. You could also use the mkfs -t ext3 /dev/sdd2 command. format is not a standard Linux command. fdisk is used for partitioning a drive, not for creating a filesystem. mke2fs -e3 /dev/sdd2 will return an error because there is no -e3 option.

You need to create an ext4 file system on the first partition on the second hard disk drive. What command should you enter at the command prompt?

mkfs.ext4 /dev/sdb1 Use one of the following commands to format the first partition on the second drive: mkfs.ext4 /dev/sdb1 mke2fs -t ext4 /dev/sdb1 mkfs -t ext4 /dev/sdb1 The Ext4 file system is the latest version in the ext file system family. Ext4 can handle files up to 16 terabytes and disk sizes up to 1 exabyte.

One of the Linux servers for the accounting department needs additional memory to fix recent performance issues. You have ordered the memory, but it is backordered, so you decide to add a swap partition to the server to help the performance issues immediately. Which of the following commands will add a swap partition to the first partition on the third hard drive? mkswap /dev/sdc1 vmstat swapon /dev/sdc1 fdisk

mkswap /dev/sdc1 mkswap creates a swap partition that is used to write information when an operating system runs out of RAM. fdisk is used to create standard partitions. swapon is used to active a swap partition. vmstat provides virtual memory statistics and is used to monitor, collect, and display OS memory, processes, and the like.

parted

parted: Creates and delete GPT partitions. Modifies GPT partitions. *The parted command writes partition changes to disk immediately. Carefully plan any partition changes to be made before using parted. The syntax is to run parted at the shell prompt. The following commands can be used within parted: > select device_name identifies which storage device to edit. > mkpart partition_type start_point end_point creates a new partition. For example: - To create a standard Linux partition, specify a partition type of Linux. - To create a partition that starts at 1 GB and ends at 21 GB, specify a start point of 1024 and an end point of 21504. > print displays a list of partitions on the device. > name partition_name renames a partition. > move partition start_point end_point moves a partition to a different location on the storage device. > resize partition start_point end_point resizes a partition. > rm partition deletes a partition. parted starts the parted utility.

Marco recently made some partition changes, and the kernel is not recognizing the partitions. Which of the following commands should Marco use to resolve the problem? cat /etc/partitions fdisk -l df partprobe

partprobe The partprobe command makes a request to the operating system to re-read the partition table. The operating system kernel reads the partition table and recognizes the table changes. cat /etc/partitions displays the currently recognized partitions, but does not perform an update. df displays partition information. fdisk -l displays partition information.

Which of the following commands initializes a physical volume? pvscan lvcreate pvcreate vgcreate

pvcreate The pvcreate command initializes physical volumes for later use by the Logical Volume Manager (LVM). LVM provides an alternative method to manage partitions on a Linux system. LVM gives a system administrator more flexibility in allocating storage on a system. The pvscan command scans all disks for physical volumes and displays the result. The vgcreate command creates a new volume group. The lvcreate command creates a new logical volume in a volume group.

You are using LVM on your Linux system to manage hard disk partitions. What command do you enter to scan for physical volumes on the system?

pvscan The lvscan command is a Logical Volume Manager (LVM) command that scans all known volume groups or all supported LVM block devices in the system for logical volumes. LVM provides an alternative method to manage partitions on a Linux system. LVM gives a system administrator more flexibility while allocating storage on a system.

/dev/sdxn

sd files identify hard drives. A letter (beginning with a) follows the sd designation and identifies the ID of the hard drive. At the end is appended a number (beginning with 1) that identifies the partition on the drive. Examples include: sda2 is the second partition (2) on the hard drive with the lowest ID number (a). sdc1 is the first partition (1) on the hard drive with the third lowest ID number (c). sda1 is the first partition (1) on the hard drive with the lowest ID number (a). sdb3 is the third partition (3) on the hard drive with the second lowest ID number (b). sdc2 is the second partition (2) on the hard drive with the third lowest ID number (c). sdd1 is the first partition (1) on the drive with the forth lowest ID number (d).

/dev/stn

st files identify SCSI tape devices. Device numbering begins at 0.

You have a Linux system with two activated swap partitions, sda3 and sdb2. Which of the following commands can you use to deactivate only the sda3 swap partition? swapoff /dev/sda3 pvcreate /dev/sda3 swapoff -a fdisk d /dev/sda3

swapoff /dev/sda3 The swapoff /dev/sda3 command will deactivate the sda3 swap partition. The swapoff -a command will deactivate all swap partitions listed in /etc/fstab. The pvcreate command is used to create LVM physical volumes. The fdisk command creates and displays partitions; however, fdisk d /dev/sda3 is the incorrect syntax for the fdisk utility.

/dev/ttyn

tty files identify local terminals on the system. Device numbering begins at 0. Subsequent terminals are represented with files that increment by one (for example, the file for terminal two is /dev/tty1, and so on).

/dev/ttySn

ttyS files identify serial ports. Device numbering begins at 0. Files for subsequent serial ports are represented by files that increment by one (for example, the file for serial port two is /dev/ttyS1, and so on).

Which of the following commands creates a volume group named backup and initializes it by adding the third disk in a Linux system to the volume group? vgextend /dev/sdc backup vgcreate /dev/sdc backup vgcreate backup /dev/sdc lvcreate backup /dev/sdc pvcreate /dev/sdc backup

vgcreate backup /dev/sdc The vgcreate backup /dev/sdc command creates a volume group named backup on the third disk in the system. vgcreate is a Logical Volume Manager (LVM) command that creates volume groups. LVM provides an alternative method for managing partitions on a Linux system. LVM gives a system administrator more flexibility in allocating storage on a system. The pvcreate command initializes physical volumes for later use by the Logical Volume Manager (LVM). The pvscan command scans all disks for physical volumes and displays the result. The lvcreate command creates a new logical volume in a volume group. The vgextend command adds one or more initialized physical volumes to an existing volume group to extend its size.

You are using LVM on your Linux system to manage the existing volumes. After adding and initializing the fourth hard drive to the system and creating a physical volume, what command should you use to add it to the backup volume group?

vgextend backup /dev/sdd vgextend backup /dev/sdd adds the physical volume on the fourth hard drive to the backup volume group. vgextend is a Logical Volume Manager (LVM) command that adds one or more initialized physical volumes to an existing volume group to extend its size. LVM provides an alternative method to manage partitions on a Linux system. LVM gives a system administrator more flexibility while allocating storage on a system.


Conjuntos de estudio relacionados

Chapter 8 Racial and ethnic theories

View Set

English IV — Frankenstein Chapters 7-14

View Set

NCLEX LPN Physiological Adaptation 1

View Set

CITI training responsible conduct

View Set

RMI 3502 Topic 5 - Insurance Regulation

View Set

GOOGLE HACKING FOR PEN TESTERS, GOOGLE HACKING FOR PENETRATION TESTERS, 3RD EDITION; TOPIC GOOGLE HACKING

View Set

Network+ Chapter 5 Review Questions

View Set

Week 3 Chapter 14: Gene Expression Transcription

View Set

Business Associations - Business Judgment Rule & Fiduciary Duties

View Set

S2 / 2.2.2 Study: The Scientific Revolution

View Set