mountfs 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #!/bin/sh
  2. ########################################################################
  3. # Begin mountfs
  4. #
  5. # Description : File System Mount Script
  6. #
  7. # Authors : Gerard Beekmans - gerard@linuxfromscratch.org
  8. # DJ Lucas - dj@linuxfromscratch.org
  9. # Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
  10. #
  11. # Version : LFS 7.0
  12. #
  13. ########################################################################
  14. ### BEGIN INIT INFO
  15. # Provides: $local_fs
  16. # Required-Start: udev checkfs
  17. # Should-Start:
  18. # Required-Stop: swap
  19. # Should-Stop:
  20. # Default-Start: S
  21. # Default-Stop: 0 6
  22. # Short-Description: Mounts/unmounts local filesystems defined in /etc/fstab.
  23. # Description: Remounts root filesystem read/write and mounts all
  24. # remaining local filesystems defined in /etc/fstab on
  25. # start. Remounts root filesystem read-only and unmounts
  26. # remaining filesystems on stop.
  27. # X-LFS-Provided-By: LFS
  28. ### END INIT INFO
  29. . /lib/lsb/init-functions
  30. case "${1}" in
  31. start)
  32. log_info_msg "Remounting root file system in read-write mode..."
  33. mount -n -o remount,rw / >/dev/null
  34. evaluate_retval
  35. # Remove fsck-related file system watermarks.
  36. rm -f /fastboot /forcefsck
  37. log_info_msg "Recording existing mounts in /etc/mtab..."
  38. > /etc/mtab
  39. mount -f / || failed=1
  40. mount -f /proc || failed=1
  41. mount -f /sys || failed=1
  42. mount -f /run || failed=1
  43. mount -f /dev || failed=1
  44. (exit ${failed})
  45. evaluate_retval
  46. # This will mount all filesystems that do not have _netdev in
  47. # their option list. _netdev denotes a network filesystem.
  48. log_info_msg "Mounting remaining file systems..."
  49. mount -a -O no_netdev >/dev/null
  50. evaluate_retval
  51. exit $failed
  52. ;;
  53. stop)
  54. # Don't unmount tmpfs like /run
  55. log_info_msg "Unmounting all other currently mounted file systems..."
  56. umount -a -d -r -t notmpfs,nosysfs,nodevtmpfs,noproc >/dev/null
  57. evaluate_retval
  58. # Make all LVM volume groups unavailable, if appropriate
  59. # This fails if swap or / are on an LVM partition
  60. #if [ -x /sbin/vgchange ]; then /sbin/vgchange -an > /dev/null; fi
  61. ;;
  62. *)
  63. echo "Usage: ${0} {start|stop}"
  64. exit 1
  65. ;;
  66. esac
  67. # End mountfs