mountfs 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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: modules
  18. # Required-Stop: localnet
  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. failed=0
  43. mount --all --test-opts no_netdev >/dev/null || failed=1
  44. evaluate_retval
  45. exit $failed
  46. ;;
  47. stop)
  48. # Don't unmount virtual file systems like /run
  49. log_info_msg "Unmounting all other currently mounted file systems..."
  50. # Ensure any loop devies are removed
  51. losetup -D
  52. umount --all --detach-loop --read-only \
  53. --types notmpfs,nosysfs,nodevtmpfs,noproc,nodevpts >/dev/null
  54. evaluate_retval
  55. # Make sure / is mounted read only (umount bug)
  56. mount --options remount,ro /
  57. # Make all LVM volume groups unavailable, if appropriate
  58. # This fails if swap or / are on an LVM partition
  59. #if [ -x /sbin/vgchange ]; then /sbin/vgchange -an > /dev/null; fi
  60. ;;
  61. *)
  62. echo "Usage: ${0} {start|stop}"
  63. exit 1
  64. ;;
  65. esac
  66. # End mountfs