Unix File Systems

From Colettapedia
(Redirected from Mount)
Jump to navigation Jump to search

NFS vs CIFS

  • NFS works at the system (root) level and doesn’t require a username/password to mount.
  • When the filesystem is mounted, the usual unix file permissions are used to determine who has access to the files.
  • SMB/CIFS (samba) requires authentication to mount the filesystem.

Configuring NFS mount between two computers

  • On instrument machine: edit /etc/exports to allow compute server to mount the filesystem. Start the nfs server.
  • On compute server: edit /etc/fstab to nfs mount the filesystem
  • You might have to create a local group matching the one used on instrument machine (same gid) and make all the valid users a member of that group to give them access to the mounted files.

Files

/etc/fstab

  • Filesystem table, maintained by sysadmin
  • One filesystem per line
  • Comment out file systems using #

The Six Fields

  1. fs_spec - device or remote filesystem. NFS mounts use form <host>:<dir>. Can substitute UUID=... or LABEL=...
  2. fs_file - mount point. If mount point contains spaces they should be escaped using \040
  3. fs_vfstype - Type of file system. Must appear in /proc/filesystems
  4. fs_mnt_ops - Comma-separated list of options. Includes: user, rw, suid, dev, exec, auto, nouser, async, noauto (no automount when running mount -a). Available mount options given in man mount.
  5. fs_freq - 1= dump this file system if dump command is used, 0 if not
  6. fs_passno - fsck order of operations, drives to be checked at reboot time. Boot drive should be 1

/etc/mtab

  • Table of *currently mounted* filesystems (mtab is contraction of mounted file systems table)
  • Format similar to that of fstab
  • Automatically edited when the mount command is used to indicate which filesystems are in use and how they are being used

/etc/nfsmount.conf

  • Configuration file for NFS mounts

/etc/data.map

  • Contains automount information (lgsg01, 03, 09 and 10)

/proc/filesystems

  • List of filesystems supported by given OS/kernel

Commands

List disk devices

  • df - shows all MOUNTED devices
  • sudo lshw -class disk - not on all distros; gives comprehensive output

mount

  • Just list all the drive mounted and their mountpoint
  • mount options can also be placed in fstab file

General (filesystem-independent) mount options

  • defaults - contain the following options
    • rw - Mount the filesystem read-write.
    • suid - Allow set-user-identifier or set-group-identifier bits to take effect.
    • dev - Interpret character or block special devices on the filesystem
    • exec - Permit execution of binaries.
    • auto - Allow mount with mount -a option
    • nouser
    • async - All I/O to the filesystem should be done asynchronously
  • non-default options
    • user - Allow an ordinary user to mount the filesystem. The name of the mounting user is written to mtab so that he can unmount the filesystem again. This option implies the options noexec, nosuid, and nodev (unless overridden by subsequent options, as in the option line user,exec,dev,suid).
    • remount - e.g., mount -o remount,rw /dev/foo /dir. Attempt to remount an already-mounted filesystem. This is commonly used to change the mount flags for a filesystem, especially to make a readonly filesystem writable. It does not change device or mount point.
    • context - SELinux stuff

mount.nfs4

  • This space is intentionally left blank.

mount.cifs

  • "Common Internet File System" protocol
  • Formerly SAMBA, which implemented the "Server Message Block" protocol
  • mount.cifs -o username=XXX,mfsymlinks \\\\servername.irp.nia.nih.gov\\...
  • Environment variables
    • USER - username. can be used to set both username and password by using the format username%password.
    • PASSWD - password
    • PASSWD_FILE - Pathname of a file to read the password from. A single line of input is read and used as the password.

ntfs

  • sudo su
  • yum install ntfs-3g
  • Compare output of fdisk -l before and after plugging in. Get the device/partition, e.g., /dev/sdc2
  • mount -t ntfs-3g /dev/sdc2 rosti_hard_drive/

umount

  • detaches the file system(s) mentioned from the file hierarchy.
  • -a = All of the file systems described in /etc/mtab are unmounted
  • -t <vfstype> = indicate the type of virtual mounting system that should be affected, eg "-t nfs"
  • -l = lazy unmount -- very good at dropping stale mounts

fsck

  • check and repair a Linux file system
  • xfs_repair - repair an XFS filesystem
  • e2fsck - check a Linux ext2/ext3 file system

ZFS

  • Compiling ZFS 0.8.* in Raspbian
  • sudo modprobe zfs
  • zpool create 20200120_Coletta_ZFS_Photo_Storage sda
    • -o feature@userobj_accounting=disabled -o feature@project_quota=disabled
  • sudo zpool attach -f Coletta_ZFS_Photo_Storage_00 sda sdb
  • sudo zpool import -a
  • zpool list
  • zpool status
  • sudo zpool checkpoint Coletta_ZFS_Photo_Storage_00
  • sudo zpool export Coletta_ZFS_Photo_Storage_00
  • zpool import --rewind-to-checkpoint testpool
  • zpool checkpoint --discard testpool