[s3c6410] usb disk automount rules

▶ 11-usb_storage_automount.rules
KERNEL!="ub[a-z][0-9]",GOTO="local_rules_end"

# Global mount options
ACTION=="add",ENV{mount_options}="relatime,users"
# filesystem specific options
ACTION=="add", PROGRAM=="/lib/udev/vol_id -t %N",
RESULT=="vfat|ntfs",
ENV{mount_options}="$env{mount_options},utf8,gid=100,umask=002"

ACTION=="add",RUN+="/bin/mount -o $env{mount_options} /dev/%k /mnt/usb"
ACTION=="remove",RUN+="/bin/umount -l /mnt/usb"

LABEL="local_rules_end"

위 룰 스크립트를 /etc/udev/rules.d에 저장시키고,
/etc/udev/rules.d/udev.rules 파일 내에 SUBSYSTEM이 "block"인 경우 실행하는 스크립트가 제대로 지정되어 있는지 확인한다.

# Media automounting
#SUBSYSTEM=="block", ACTION=="add"    RUN+="/etc/udev/scripts/mount.sh"
#SUBSYSTEM=="block", ACTION=="remove" RUN+="/etc/udev/scripts/mount.sh"
SUBSYSTEM=="block", ACTION=="add"    RUN+="/etc/udev/rules.d/11-usb_storage_automount.rules"
SUBSYSTEM=="block", ACTION=="remove" RUN+="/etc/udev/rules.d/11-usb_storage_automount.rules"



* 내용 추가 - 2014/09/03
udev가 무겁기 때문에 eudev 프로젝트가 생기게 되었다.

eudev는 udev에서 파생 된 만큼 udev에서 사용하는 rule을 적용 시킬 수 있다.

eudev을 사용할 때 usb memory을 자동 마운트/언마운트 하는 rule이다.

** 해당 내용을 " /etc/udev/rules.d/11-usb_storage_automount.rules" 에 저장한 후에, "udevadm control --reload" 명령으로 rule을 다시 읽도록 한다.

KERNEL!="sd[a-z][0-9]", GOTO="media_by_label_auto_mount_end"

 

# Import FS infos

IMPORT{program}="/sbin/blkid -o udev -p %N"

 

# Get a label if present, otherwise specify one

ENV{ID_FS_LABEL}!="", ENV{dir_name}="%E{ID_FS_LABEL}"

ENV{ID_FS_LABEL}=="", ENV{dir_name}="usbhd-%k"

 

# Global mount options

ACTION=="add", ENV{mount_options}="relatime"

 

# Filesystem-specific mount options

ACTION=="add", ENV{ID_FS_TYPE}=="vfat|ntfs", ENV{mount_options}="$env{mount_options},utf8,gid=100,umask=002"

 

# Mount the device

ACTION=="add", RUN+="/bin/mkdir -p /mnt/usbstick", RUN+="/bin/mount -o $env{mount_options} /dev/%k /mnt/usbstick"

 

# clean up after removal

ACTION=="remove", ENV{dir_name}!="", RUN+="/bin/umount -l /mnt/usbstick"

 

# exit

LABEL="media_by_label_auto_mount_end"


'임베디드 > S3C6410' 카테고리의 다른 글

[s3c6410] ffmpeg porting  (0) 2011.06.09
[s3c6410] x264 porting  (0) 2011.06.09
[s3c6410] mplayer 포팅  (0) 2011.04.28
[s3c6410] Keypad device driver 포팅  (0) 2011.04.27
[s3c6410] linux kernel bootloaod 만들기  (0) 2011.04.25