mountfs 1.7 KB

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