fstab은 자동으로 마운트 지점을 만듭니다.

Jan 02 2021

여기 에서 언급했듯이 "파티션을 마운트하기 전에 마운트 지점을 만들어야합니다." 하지만 fstab에 다음 줄을 추가하고 시스템을 재부팅 한 후

/dev/sdxy /media/user/hdd_mount_point ext4 defaults 0 0
tmpfs /mnt/tmpfs_mount_point tmpfs rw,nosuid,noatime,nodev,size=4G,mode=1777 0 0

포인트 (대상 디렉토리)를 장착 hdd_mount_point하고 tmpfs_mount_point그들이 존재하지 않는 경우 자동으로 생성됩니다. 매뉴얼 페이지에 언급 된대로 command에 X-mount.mkdir옵션을 추가하여 마운트 지점이 존재하지 않는 경우 만들 수 있다는 것을 알고 있지만, fstab을 통해 파일 시스템을 마운트 할 때이 옵션이 암시 적으로 사용되는지 알고 싶습니다.mount

그리고 아니요 , / etc / fstab에 파일 시스템 자동 추가와 중복되지 않습니다.

답변

3 mook765 Jan 03 2021 at 00:43

그리고 여기에 문서 의 필수 부분이 있습니다 .

Mount units may either be configured via unit files, or via /etc/fstab
(see fstab(5) for details). Mounts listed in /etc/fstab will be converted
into native units dynamically at boot and when the configuration of the
system manager is reloaded. In general, configuring mount points through
/etc/fstab is the preferred approach. See systemd-fstab-generator(8) for
details about the conversion.

더 아래에서 다음을 찾을 수 있습니다.

Where=

    Takes an absolute path of a file or directory for the mount point;
    in particular,the destination cannot be a symbolic link. If the
    mount point does not exist at the time of mounting, it is created
    as directory.
6 MartinThornton Jan 03 2021 at 00:07

이것은 사실 이었지만 여전히 클래식 mount명령 을 사용하려는 경우 입니다.

최근 몇 년 동안의 항목은 systemd/etc/fstab의해 부팅시 마운트되어 옵션 의 존재 여부에 관계없이 필요에 따라 누락 된 마운트 지점이 자동으로 생성됩니다 .X-mount.mkdir

또한 마운트 할 디렉토리를 수동으로 생성하지 않고 파티션을 직접 마운트하려는 systemd-mount경우에 대한 대안으로 명령 을 제공합니다 mount.