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-Provided-By: LFS
  17. ### END INIT INFO
  18. . /lib/lsb/init-functions
  19. case "${1}" in
  20. start)
  21. message="Remounting root file system in read-write mode..."
  22. mount -n -o remount,rw / >/dev/null
  23. evaluate_retval standard
  24. # Remove fsck-related file system watermarks.
  25. rm -f /fastboot /forcefsck
  26. message="Recording existing mounts in /etc/mtab..."
  27. > /etc/mtab
  28. mount -f / || failed=1
  29. mount -f /proc || failed=1
  30. mount -f /sys || failed=1
  31. mount -f /run || failed=1
  32. (exit ${failed})
  33. evaluate_retval standard
  34. # This will mount all filesystems that do not have _netdev in
  35. # their option list. _netdev denotes a network filesystem.
  36. message="Mounting remaining file systems..."
  37. mount -a -O no_netdev >/dev/null
  38. ln -s /run/shm /dev/shm
  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