mountfs 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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 --options remount,rw / >/dev/null
  34. evaluate_retval
  35. # Remove fsck-related file system watermarks.
  36. rm -f /fastboot /forcefsck
  37. # Make sure /dev/pts exists
  38. mkdir -p /dev/pts
  39. # This will mount all filesystems that do not have _netdev in
  40. # their option list. _netdev denotes a network filesystem.
  41. log_info_msg "Mounting remaining file systems..."
  42. mount --all --test-opts no_netdev >/dev/null
  43. evaluate_retval
  44. exit $failed
  45. ;;
  46. stop)
  47. # Don't unmount virtual file systems like /run
  48. log_info_msg "Unmounting all other currently mounted file systems..."
  49. # Ensure any loop devies are removed
  50. losetup -D
  51. umount --all --detach-loop --read-only \
  52. --types notmpfs,nosysfs,nodevtmpfs,noproc,nodevpts >/dev/null
  53. evaluate_retval
  54. # Make sure / is mounted read only (umount bug)
  55. mount --options remount,ro /
  56. # Make all LVM volume groups unavailable, if appropriate
  57. # This fails if swap or / are on an LVM partition
  58. #if [ -x /sbin/vgchange ]; then /sbin/vgchange -an > /dev/null; fi
  59. ;;
  60. *)
  61. echo "Usage: ${0} {start|stop}"
  62. exit 1
  63. ;;
  64. esac
  65. # End mountfs