Re: mapping usb disks to devices
On Wed, Aug 16, 2017 at 10:21:59PM +0300, Gabor Szabo wrote: > Hi, > > I have a USB hub connected to my Raspberry Pi and I have several > external Hard disks connected to the USB hub. > It seems the order the hard disks are mapped to the device files > /dev/sda1 /dev/sdb1 /dev/sdc1 is random. On every boot it might be different. > > This of course breaks the mapping I have in /etc/fstab for the mounts. > > How can I solve this so I won't need to update /etc/fstab after every boot? Standard udev rules create on my system the following 4 subdirectories under /dev/disk: by-id by-label by-partuuid by-path by-uuid Each directory has symlinks to either a disk or a partition. One of those should describe your external disk properly. If this is not good enough, you can make your own. $ cat /etc/udev/rules.d/90-backup-usb.rules ACTION=="add", ENV{ID_FS_LABEL}=="backup-boole-*", \ SYMLINK+="backup" And in fstab: /dev/backup /mnt/backup ext4rw,noauto 0 0 There are several backup disks with different labels. The backup disk that is connected is mounted by the backup script, but /dev/backup is created by the udev rule. -- Tzafrir Cohen | tzaf...@jabber.org | VIM is http://tzafrir.org.il || a Mutt's tzaf...@cohens.org.il || best tzaf...@debian.org|| friend ___ Linux-il mailing list Linux-il@cs.huji.ac.il http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il
Re: mapping usb disks to devices
Excellent. Thank you! Gabor On Wed, Aug 16, 2017 at 10:23 PM, Shay Goverwrote: > Use blkid. > > On Wed, Aug 16, 2017 at 10:21 PM, Gabor Szabo wrote: >> >> Hi, >> >> I have a USB hub connected to my Raspberry Pi and I have several >> external Hard disks connected to the USB hub. >> It seems the order the hard disks are mapped to the device files >> /dev/sda1 /dev/sdb1 /dev/sdc1 is random. On every boot it might be >> different. >> >> This of course breaks the mapping I have in /etc/fstab for the mounts. >> >> How can I solve this so I won't need to update /etc/fstab after every >> boot? >> >> Is there a way to map specific hard disks to specific device files? >> >> regards >>Gabor ___ Linux-il mailing list Linux-il@cs.huji.ac.il http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il
Re: mapping usb disks to devices
Use blkid. On Wed, Aug 16, 2017 at 10:21 PM, Gabor Szabowrote: > Hi, > > I have a USB hub connected to my Raspberry Pi and I have several > external Hard disks connected to the USB hub. > It seems the order the hard disks are mapped to the device files > /dev/sda1 /dev/sdb1 /dev/sdc1 is random. On every boot it might be > different. > > This of course breaks the mapping I have in /etc/fstab for the mounts. > > How can I solve this so I won't need to update /etc/fstab after every boot? > > Is there a way to map specific hard disks to specific device files? > > regards >Gabor > > ___ > Linux-il mailing list > Linux-il@cs.huji.ac.il > http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il > ___ Linux-il mailing list Linux-il@cs.huji.ac.il http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il