32.8. systemd.automount를 사용하여 마운트 단위로 필요에 따라 파일 시스템 마운트

다음 절차에서는 마운트 지점을 마운트할 때 마운트 단위를 사용하여 필요에 따라 파일 시스템을 마운트하는 방법을 보여줍니다. 각 마운트에 대해 자동 마운트 장치를 추가하고 활성화해야 합니다.

절차

  1. 마운트 장치를 생성합니다. 예를 들면 다음과 같습니다.

    mount-point.mount
    [Mount]
    What=/dev/disk/by-uuid/f5755511-a714-44c1-a123-cfde0e4ac688
    Where=/mount/point
    Type=xfs
  2. 마운트 단위와 이름이 동일하지만 확장자는 .automount 인 유닛 파일을 만듭니다.
  3. 파일을 열고 [자동 마운트] 섹션을 만듭니다. Where= 옵션을 마운트 경로로 설정합니다.

    [Automount]
    Where=/mount/point
    [Install]
    WantedBy=multi-user.target
  4. 시스템이 새 구성을 등록하도록 새로 생성된 장치를 로드합니다.

    # systemctl daemon-reload
  5. 대신 자동 마운트 장치를 활성화하고 시작합니다.

    # systemctl enable --now mount-point.automount

검증

  1. mount-point.automount 가 실행 중인지 확인합니다.

    # systemctl status mount-point.automount
  2. 자동 마운트된 디렉토리에 필요한 콘텐츠가 있는지 확인합니다.

    # ls /mount/point

추가 리소스

  • systemd.automount(5) 도움말 페이지.
  • systemd.mount(5) 도움말 페이지.
  • systemd 소개.