Mounting Devices Part II

Mounting Devices Part II

<p>s Mounting Devices – Part II</p><p>Other examples for creating a Mount: https://www.digitalocean.com/community/tutorials/how-to-set-up- an-nfs-mount-on-centos-6 </p><p> Displaying mounted file systems: To display all mounted file systems, issue the mount command. Or look at the files “ /proc/mounts and /etc/mtab “</p><p> To display all mounts (via cmd): # mount | grep /dev/sdb</p><p> Using “ /proc/mounts “: # cat /proc/mounts | grep /dev/sdb . The kernel provides the info in /proc/mounts in file form, but /proc/mounts doesn’t exist as a file on any hard disk.. Info comes directly from the kernel</p><p> Using “ /etc/mtab “: # cat /etc/mtab | grep /dev/sdb . The /etc/mtab file is not updated by the kernel, but is maintained by the mount command. . don’t edit /etc/mtab manually</p><p> “ df “ command: A more user friendly way to look at mounted file systems is the “ df “ command.. this command has the added benefit of showing you the free space on each mounted disk  Example: # df  Example: # df –h (diplays in human readable format)  Another Example: # df –h | egrep –e “(sdb2|File)”  “ du “ command:  Summarizes disk usage for files and directories. Using “du” on a mount point, you effectively get the disk space used on a file system  Example: du -h /boot /srv/wolf (display each subdirectory recursively)  -s option gives you a total summary for the parent directory  Example: # du –sh /boot /srv/wolf </p><p> Permanent mounts: Until now, we performed all mounts manually, which works nice until the next reboot. There is a way to tell you pc to automatically mount certain file systems during boot.  “ /etc/fstab “ : the file system table located here contains a list of file systems, with an option to automatically mount each of them at boot time</p><p>. Command to see file: # cat /etc/fstab . Adding the following line, we can automate the mounting of a file system: /dev/sdb1 /home/project42 ext3 defaults 0 0</p><p> the “/etc/fstab” file controls how Linux provides access to disk partitions and removable media devices . . . consists of a series of lines that contain six fields each  Example: <file system> <mount point> <type> <options> <dump> <pass> Meaning of example above: 1.<file system>: The first column specifies the mount device. Most distributions now specify partitions by their labels or UUIDs. This practice can help reduce problems if partition numbers change. 2.<mount point>: The second column specifies the mount point. 3.<type>: The file system type code is the same as the type code used to mount a filesystem with the mount command. A file system type code of auto lets the kernel auto-detect the filesystem type, which can be a convenient option for removable media devices. Note that this option may not be available for all filesystems out there. 4.<options>: One (or more) mount option(s). 5.<dump>: You will most likely leave this to 0 (otherwise set it to 1) to disable the dump utility to backup the filesystem upon boot (The dump program was once a common backup tool, but it is much less popular today.) 6.<pass>: This column specifies whether the integrity of the filesystem should be checked at boot time with fsck. A 0 means that fsck should not check a filesystem. The higher the number, the lowest the priority. Thus, the root partition will most likely have a value of 1, while all others that should be checked should have a value of 2.</p><p>Examples: To determine the UUID or Label name, use the following command:  blkid /dev/sdb1 RESULTS: /dev/sdb1: LABEL="Elements" UUID=4E1AEA7B1A6007" Type="ntfs"</p><p> To mount a partition with label “NameHere” at boot time with rw and noexec attributes, add the following line in “/etc/fstab” file:  LABEL=NameHere /mountpath ext4 rw,noexec 0 0</p><p> Securing mounts: File systems can be secured with several mount options..Here are some examples:  “ro” option will mount a file system as read only, preventing anyone from writing: # mount –t ext2 –o ro /dev/hdb1 /home/project42  “noexec” option will prevent the execution of binaries and scripts on the mounted file system: # mount –t ext2 –o noexec /dev/hdb1 /home/project42  “nosuid” option will ignore setuid bit set binaries on the mounted file system: # mount –o nosuid /dev/hdb1 /home/project42  “noacl” option prevents cluttering permissions with acl’s: # mount –o noacl /dev/hdb1 /home/project42 </p><p>Exercise:  Mounting a USB Flash Drive </p>

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    5 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us