← Back to list

고정 마운트 대신 AutoFS를 통한 ZFS Automount 전환

AutoFS 기반 Indirect Map, Soft 옵션 적용 방법

해달 · 2025-09-12 01:23 · 0 claps · 5.8 min read
#linux #redhat-linux #rhel-8 #auto-mount #autofs
Open on Medium ↗
Wiki topics: 🔓 · Open Source

고정 마운트 대신 AutoFS를 통한 ZFS Auto mount 전환

기존에는 디렉터리를 고정 마운트(/etc/fstab) 방식으로 연결했습니다. 이 설정은 서버 부팅 순서 또는 네트워크 상태에 따라 마운트 실패가 발생할 수 가능성을 고려할 필요가 있었습니다. AutoFS는 클라이언트가 파일 시스템에 접근할 때만 자동으로 마운트되는 기능입니다. 이번 글에서는 접근 시 자동으로 마운트되는 유연한 환경을 구축하는 방법을 정리했습니다. 이를 통해 네트워크 자원 효율성을 높이고, 관리 편의성을 개선할 수 있습니다.

Mount

  • 파일 시스템을 특정 디렉토리에 연결하여 사용자가 접근 가능하게 함
  • Soft mount: 서버 연결 실패 시 지정 횟수만큼 시도 후 오류 반환, 마운트 종료
  • Hard mount: 서버 연결 실패 시 지정 시간(TimeOut)까지 계속 재시도
  • 서버 export 설정 파일: /etc/export
  • 클라이언트 고정 마운트파일: /etc/fstab

Automount (AutoFS)

  • AutoFS: 클라이언트가 파일 시스템에 접근 시 자동 마운트되고, 일정 시간 미사용 시 자동 언마운트
  • autofsd: /etc/auto.master를 감시하며 필요 시`mount 실행
  • 고정 마운트(/etc/fstab)와 달리 클라이언트가 필요할 때만 마운트하여 네트워크 자원 효율적
  • 설정 파일: /etc/autofs.conf, /etc/auto.master

/etc/fstab은 부팅 시 자동으로 마운트되어 항상 연결을 유지하여 네트워크 부하 발생 가능하며, autofs는 클라이언트가 지정 경로에 접근할 때만 마운트하여 일정 시간 미사용 시. 자동 언마운트 되어 네트워크 자원을 효율적으로 관리 가능합니다.

AutoFS Map 종류

  • Master map: 전체 마운트 포인트 정의(/etc/auto.master)
  • Direct map: 절대 경로에 파일 시스템 직접 마운트, 사용자별 다른 파일 시스템 마운트 시 활용 (Ex. /etc/auto.user)
  • Indirect map: 특정 경로 하위 전체 자동 마운트(* 와일드카드 사용), 다수 디렉터리 접근 시 유용 (Ex. /etc/auto.*)

/etc/auto.master 필드

mount-point map-file [options]
  • mount-point: 자동 마운트할 경로
  • map-file: mount-point에 대한 상세 규칙이 정의된 파일
  • options (선택): mount 동작 시 공통 적용할 옵션

Mapfile 필드

key [mount-options] location
  • key: 실제 마운트될 디렉토리 이름 (*: 모든 요청, &: key 값을 location에 치환)
  • *mount-options: 마운트할 때 적용되는 옵션 (,로 구분)
  • location: 실제 원격 공유할 파일시스템 경로

*mount-options 종류

  1. -fstype=[filesystem]: 파일시스템 종류
  1. rw: 읽기/쓰기 가능
  1. soft: 서버 응답 없으면 실패 처리되는 횟수 지정
  1. timeo: 타임아웃 시간
  1. retrans: 재시도 횟수

사전 설정

  • ZFS 설치
  • NFS 구성

서버 설정

  1. NFS 공유 디렉터리 설정
vi /etc/exports
  • ADD-TO
/user [private_ip]/[cidr](rw,sync,no_root_squash)
  1. 변경사항 적용
exportfs -ra
  1. 현재 export 상태 확인
exportfs -v
  1. NFS 서버 데몬 재시작
systemctl restart nfs-server
  1. NFS 디렉터리 목록 확인
showmount -e

클라이언트 설정

  1. autofs 설치 확인
rpm -qa | grep autofs
  1. autofs 설치
dnf install autofs -y
  1. autofs 설치 재확인
rpm -qa | grep autofs
  • 출력 확인

  1. autofs 데몬 시작
systemctl start autofs
  1. autofs 데몬 활성화
systemctl enable autofs
  1. autofs 상태 확인
systemctl status autofs
  • 출력 확인

Master map

  1. Master Map 설정 파일 열기
vi /etc/auto.master
  • AS-IS
#
# Sample auto.master file
# This is a ‘master’ automounter map and it has the following format:
# mount-point [map-type[,format]:]map [options]
# For details of the format look at auto.master(5).
#
/misc /etc/auto.misc
#
  • TO-BE
#
# Sample auto.master file
# This is a ‘master’ automounter map and it has the following format:
# mount-point [map-type[,format]:]map [options]
# For details of the format look at auto.master(5).
#
/misc /etc/auto.misc
/user /etc/auto.user # add
#
  1. 사용자 정의 맵 파일 생성
vi /etc/auto.user
  • ADD-TO
*       -fstype=nfs,rw,soft     [private_ip]:/user/&
  1. autofs 서비스 재시작하여 설정 적용
systemctl restart autofs

설정 확인

  1. Master Map 적용
mount -a
  1. 마운트 확인
mount | grep autofs
  • 출력 확인
  1. 디렉터리 공유 확인
cd /user
ls -lart
  • 서버 출력 확인

  • 클라이언트 출력 확인

/user 디렉터리에 처음 접근할 때는 아무 것도 표시되지 않지만, 하위 디렉터리에 접근하면 그 시점에 자동으로 마운트되어 /user 아래의 디렉터리를 확인할 수 있습니다.

  1. 마운트 상태 재확인
mount | grep autofs
  • AS-IS

  • TO-BE


메타데이터
post_id
2c95074cf32f
slug
고정-마운트-대신-autofs를-통한-zfs-automount-전환-2c95074cf32f
url
https://medium.com/@haedall/%EA%B3%A0%EC%A0%95-%EB%A7%88%EC%9A%B4%ED%8A%B8-%EB%8C%80%EC%8B%A0-autofs%EB%A5%BC-%ED%86%B5%ED%95%9C-zfs-automount-%EC%A0%84%ED%99%98-2c95074cf32f
canonical_url
https://medium.com/@haedall/%EA%B3%A0%EC%A0%95-%EB%A7%88%EC%9A%B4%ED%8A%B8-%EB%8C%80%EC%8B%A0-autofs%EB%A5%BC-%ED%86%B5%ED%95%9C-zfs-automount-%EC%A0%84%ED%99%98-2c95074cf32f
author_url
https://medium.com/@haedall
status
ok
fetched_at
2026-06-24 13:29:15