mountfs 1.9 KB

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