mountfs 2.1 KB

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