how to mount USB /dev/sda,/dev/sdb,/dev/sdc/ ... only mount one fixed mount point /run/media/sda1 ?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

how to mount USB /dev/sda,/dev/sdb,/dev/sdc/ ... only mount one fixed mount point /run/media/sda1 ?

ソリューションへジャンプ
3,141件の閲覧回数
gonewithwind-peter
Senior Contributor I

Hi all,

I am playing maaxboard yocto sumo and zeus branch.

as you know, a USB  disk after unplugging and plugging again, the device  should change  from /dev/sda to /dev/sdb , /dev/sdc ... and so on.

1. in zeus branch

if I add the line :/dev/sda1 /run/media/sda1 auto defaults,sync,rw,user 0 0    in /etc/fstab,

after unplugging and plugging once , it will auto mount it at /run/media/sdb1; unplugging and plugging ,it will auto mount it at /run/media/sdc1. but our app read/write only fix at /run/media/sda1

 

how can I do that mount USB /dev/sda,/dev/sdb,/dev/sdc/ ... only mount one mount point at /run/media/sda1 ? in zeus branch?

;;;;

2. but in sumo branch, I can do it well!

I add the below lines in /etc/fstab, it works!  Although after unplugging and plugging once, the device change to /dev/sdb, sdc,sdd ... but it can always mount at the fixed mount point: /run/media/sda1!

  I added in fstab that mean I force mount sdb,sdc,sdd at /run/media/sda1

/dev/sda1 /run/media/sda1 auto rw,user,noauto 0 0
/dev/sdb1 /run/media/sda1 auto rw,user,noauto 0 0
/dev/sdc1 /run/media/sda1 auto rw,user,noauto 0 0
/dev/sdd1 /run/media/sda1 auto rw,user,noauto 0 0
/dev/sde1 /run/media/sda1 auto rw,user,noauto 0 0
/dev/sdf1 /run/media/sda1 auto rw,user,noauto 0 0
/dev/sdg1 /run/media/sda1 auto rw,user,noauto 0 0

...

 

In zues, I added the same,  but it did not work. it worked as I described in 1.

 

How can I do?

 

any help?

 

Thank you very much.

 

 

 

 

 

0 件の賞賛
返信
1 解決策
3,109件の閲覧回数
gonewithwind-peter
Senior Contributor I
I have found the solution  after modified the file  /etc/udev/rules.d/11-usb.rules  that  avnet technical supporter   gave to me
 
KERNEL=="sd[a-z]", NAME="%k", SYMLINK+="sda1", GROUP="users"
ACTION=="add", KERNEL=="sd[a-z][0-9]", SYMLINK+="usbhd-%k", GROUP="users", NAME="%k"
ACTION=="add", KERNEL=="sd[a-z][0-9]", RUN+="/bin/mkdir -p /run/media/sda1"
ACTION=="add", KERNEL=="sd[a-z][0-9]", RUN+="/bin/mount -t auto -o rw,noauto,sync,dirsync,noexec,nodev,noatime /dev/%k /run/media/sda1"
ACTION=="remove", KERNEL=="sd[a-z][0-9]", RUN+="/bin/umount -l /run/media/sda1"
ACTION=="remove", KERNEL=="sd[a-z][0-9]", RUN+="/bin/rm -rf /run/media/sda1"
 
and add lines the /etc/fstab
 
/dev/sda1 /run/media/sda1 auto rw,user,noauto 0 0
/dev/sdb1 /run/media/sda1 auto rw,user,noauto 0 0
/dev/sdc1 /run/media/sda1 auto rw,user,noauto 0 0
/dev/sdd1 /run/media/sda1 auto rw,user,noauto 0 0
/dev/sde1 /run/media/sda1 auto rw,user,noauto 0 0
/dev/sdf1 /run/media/sda1 auto rw,user,noauto 0 0
/dev/sdg1 /run/media/sda1 auto rw,user,noauto 0 0
...

元の投稿で解決策を見る

3 返答(返信)
3,110件の閲覧回数
gonewithwind-peter
Senior Contributor I
I have found the solution  after modified the file  /etc/udev/rules.d/11-usb.rules  that  avnet technical supporter   gave to me
 
KERNEL=="sd[a-z]", NAME="%k", SYMLINK+="sda1", GROUP="users"
ACTION=="add", KERNEL=="sd[a-z][0-9]", SYMLINK+="usbhd-%k", GROUP="users", NAME="%k"
ACTION=="add", KERNEL=="sd[a-z][0-9]", RUN+="/bin/mkdir -p /run/media/sda1"
ACTION=="add", KERNEL=="sd[a-z][0-9]", RUN+="/bin/mount -t auto -o rw,noauto,sync,dirsync,noexec,nodev,noatime /dev/%k /run/media/sda1"
ACTION=="remove", KERNEL=="sd[a-z][0-9]", RUN+="/bin/umount -l /run/media/sda1"
ACTION=="remove", KERNEL=="sd[a-z][0-9]", RUN+="/bin/rm -rf /run/media/sda1"
 
and add lines the /etc/fstab
 
/dev/sda1 /run/media/sda1 auto rw,user,noauto 0 0
/dev/sdb1 /run/media/sda1 auto rw,user,noauto 0 0
/dev/sdc1 /run/media/sda1 auto rw,user,noauto 0 0
/dev/sdd1 /run/media/sda1 auto rw,user,noauto 0 0
/dev/sde1 /run/media/sda1 auto rw,user,noauto 0 0
/dev/sdf1 /run/media/sda1 auto rw,user,noauto 0 0
/dev/sdg1 /run/media/sda1 auto rw,user,noauto 0 0
...
3,130件の閲覧回数
Rita_Wang
NXP TechSupport
NXP TechSupport

Could you tell us which board are you using?

0 件の賞賛
返信
3,122件の閲覧回数
gonewithwind-peter
Senior Contributor I
0 件の賞賛
返信