/etc/fstab으로 자동으로 마운트하기
https://help.ubuntu.com/community/Fstab
/etc/fstab 파일은 리눅스 시스템이 자동으로 마운트하기 위한 정보를 담고 있다.
아래처럼 6가지 정보를 입력하는데,
<file system> <mount point> <type> <options> <dump> <pass>
각 항목은 탭 또는 스페이스 등의 공백으로 구분한다.
1.
file system: 파일시스템이 있는 장치나 파티션. 전에는/dev/sda1 이런 방식을 쓰는데 이제는 UUID를 사용하는 것이 기본이다.
UUID를 알아내는 방법은 터미널에서 다음의 명령으로 간단히 알아낼 수 있다.
sudo blkid
다음과 같이 장치/파티션, UUID, 파일시스템 타입을 한 눈에 알 수 있다.
/dev/sda1: UUID=”b3450059-0c0a-4342-a3c4-52c1871fd2b4″ TYPE=”ext3″/dev/sda2: UUID=”3cf235dd-9306-42ef-83bc-fb7e1d7c612d” TYPE=”ext4″/dev/sdc3: UUID=”C2D0FC6AD0FC6657″ LABEL=”500Data” TYPE=”ntfs”
ls -l /dev/disk/by-uuid
명령도 UUID를 알 수 있지만 파일 시스템은 안나온다.
여기서는 ntfs타입인 /dev/sdc3를 마운트하는 것으로 예를 들겠다.
UUID=”C2D0FC6AD0FC6657″ <mount point> <type> <options>
<dump> <pass>
이제 나머지 5개 값도 찾아보자.
2.
mount point는 대상 파티션을 어디에 마운트할 것인가 그 경로를 지정하는 것이다. 자기가 하고싶은데에 하면 그만이지만 보통 /mnt나 /media를 사용한다. 여기에서는 /media 를 이용할 것이다. 다음의 명령어로 /media 폴더로 이동한다.
cd /media
여기에 마운트 할 디렉토리를 만든다. sdc3파티션은 유틸리티와 드라마 등이 있으니 그냥 Data라는 이름으로 만들겠다. /media 디렉토리에 폴더를 만들기 위해서는 root 권한이 필요하다. 따라서 우분투 사용자라면
sudo mkdir Data
자, 이제 mout point도 /medai/Data로 정해졌다.
UUID=”C2D0FC6AD0FC6657″ /medai/Data <type> <options> <dump> <pass>
3. type
마운트하려는 파티션의 포맷 타입을 지정해준다.
ntfs의 경우는 ntfs-3g, fat의 경우는 vfat이다. 물론 ext3으로 포맷된 파티션이라면 ext3라고 해주면 된다.
- auto
- vfat – used for FAT partitions.
- ntfs, ntfs-3g – used for ntfs partitions.
- ext2, ext3, jfs, reiserfs, etc.
- udf,iso9660 – for CD/DVD.swap.
등 파일시스템에 맞게 입력해주면 된다.
UUID=”C2D0FC6AD0FC6657″ /medai/Data ntfs-3g <options> <dump> <pass>
4. options
옵션은 파일 시스템과 관련있다. defaults는 rw, suid, dev, exec, auto, nouser, async 등의 속성을 갖는다.
대표적인 옵션들은 아래에 있고 좀 더 많은 정보를 원하는 분은 man mount를 보시면 된다.
- sync/async – All I/O to the file system should be done (a)synchronously.
- auto – The filesystem can be mounted automatically (at bootup, or when mount is passed the -a option). This is really unnecessary as this is the default action of mount -a anyway.
- noauto – The filesystem will NOT be automatically mounted at startup, or when mount passed -a. You must explicitly mount the filesystem.
- dev/nodev – Interpret/Do not interpret character or block special devices on the file system.
- exec / noexec – Permit/Prevent the execution of binaries from the filesystem.
- suid/nosuid – Permit/Block the operation of suid, and sgid bits.
- ro – Mount read-only.
- rw – Mount read-write.
- user – Permit any user to mount the filesystem. This automatically implies noexec, nosuid,nodev unless overridden.
- nouser – Only permit root to mount the filesystem. This is also a default setting.
- defaults – Use default settings. Equivalent to rw, suid, dev, exec, auto, nouser, async.
- _netdev – this is a network device, mount it after bringing up the network. Only valid with fstype nfs.
나는 rw,nosuid,nodev,allow_other 속성을 주었다.
UUID=”C2D0FC6AD0FC6657″ /medai/Data ntfs-3g rw,nosuid,nodev,allow_other <dump> <pass>
5. dump
dump는 백업 유틸리티인데 이걸로 백업을 하느냐 여부를 결정한다.
(우분투 9.10에는 dump도 설치가 안되어 있더군;;; dump를 설치하고 manpage를 보니 ext2/3 filesystem backup이라고 나오는데 ext4나 ntfs같은 것은 덤프를 못하는 것인가…?)
UUID=”C2D0FC6AD0FC6657″ /medai/Data ntfs-3g rw,nosuid,nodev,allow_other 0 <pass>
6. pass
pass는 fsck라는 유틸리티가 파일시스템을 체크하는 순서를 지정하는 것으로
- 0은 안하는 것이고,
- 1이면 먼저
- 2는 나중에
1은 /(root)에 사용하고 나머지는 2를 사용하는 것이 보통이다. 나는 문서나 유틸리티만 모아두는 파티션은 체크를 안한다. 0으로 해주면 된다.
UUID=”C2D0FC6AD0FC6657″ /medai/Data ntfs-3g rw,nosuid,nodev,allow_other 0 0
드디어 끝.
이제 /etc/fstab에 있는 파일시스템을 모두 마운트해서 사용해보자~
sudo mount -a
Related posts
- PCLINUXOS No1.LINUX 설치 후기
- 리눅스가 싫어지고 있다.
- LPIC exam101 합격
- kubuntu gutsy 베타 설치, 설정
- Kubuntu 8.04 Hardy Heron에서 Compiz-Fusion 사용하기
- 쿠분투 8.04 hardy에서 한글입력하기
- DontZap Option in xorg.conf
- 한밤의 노트북 삽질
- 리눅스용 한글2005에 이런 버그가...
| Print article | This entry was posted by 에드 on 2010/07/16 at 2:31 오전, and is filed under linux. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |
