From: Geoff Clements on 20 Apr 2010 13:51 Bruce Richardson wrote: > Dave Gibson <dave+news002(a)gibson-hrd.abelgratis.co.uk.invalid> wrote: >> >> Plug the devices in and use '/lib/udev/vol_id --uuid' to determine the >> UUID of each filesystem on the devices: >> > > Surprised nobody has yet mentioned udevinfo, which will give plenty of > contextual information to choose from. Try something like > > udevinfo --query=all --name=sdb1 > > And you'll see many things you could use in a rule. > > or on debian testing: udevadm info --query=all --name=sdb1 -- Geoff
From: Geoff Clements on 19 Apr 2010 13:48 R. Georgeson wrote: > I want to plug a camera and a USB external disc into a laptop and download > from one to t'other. ATM it sees whichever is plugged in first as sdb and > the second as sdc. What I'd like is to have eg the camera as sdc1 and the > USB disc as sdbn whether or not the other is connected so I can set up the > fstab and the symlinks to make it all easy. > > I started looking at udev and it's rules, seemed a likely place to start, > but didn't understand it much, actually to be honest, at all. > If you want particular device names then udev rules are the way to go, have a look at: http://reactivated.net/writing_udev_rules.html But usually just setting up the correct mount point is good enough. Most modern distros will mount the USB disk under: /media/<label> where <label> is the filesystem label of the disk. Assuming they are vfat filesystems (they usually are but not always) you can read/set the filesystem label with the dosfslabel command as root. -- Geoff
From: alexd on 19 Apr 2010 14:43 On 19/04/10 16:48, R. Georgeson wrote: > I want to plug a camera and a USB external disc into a laptop and download > from one to t'other. ATM it sees whichever is plugged in first as sdb and > the second as sdc. What I'd like is to have eg the camera as sdc1 and the > USB disc as sdbn whether or not the other is connected so I can set up the > fstab and the symlinks to make it all easy. > > I started looking at udev and it's rules, seemed a likely place to start, > but didn't understand it much, actually to be honest, at all. Yeah, I had a go at that once well for a similar scenario and couldn't get anywhere with it. I wanted to kick off a mount + rsync + unmount backup script when a suitably-labelled drive was plugged in. Gave up in the end and now cron does it instead. I just couldn't get udev to do anything upon a device plug in event. Have a look in /dev/disk/by-* You will find each mass storage device has one or more unique handles you can mount it by, possibly including as mentioned elsethread, a label. You can set labels on extN filesystems with e2label. -- <http://ale.cx/> (AIM:troffasky) (UnSoEsNpEaTm(a)ale.cx) 19:32:17 up 10 days, 8:49, 2 users, load average: 0.29, 0.23, 0.19 It is better to have been wasted and then sober than to never have been wasted at all
From: Dave Gibson on 19 Apr 2010 15:23 R. Georgeson <rmg(a)nospam.zen.uk> wrote: > I want to plug a camera and a USB external disc into a laptop and download > from one to t'other. ATM it sees whichever is plugged in first as sdb and > the second as sdc. What I'd like is to have eg the camera as sdc1 and the > USB disc as sdbn whether or not the other is connected so I can set up the > fstab and the symlinks to make it all easy. > > I started looking at udev and it's rules, seemed a likely place to start, > but didn't understand it much, actually to be honest, at all. Plug the devices in and use '/lib/udev/vol_id --uuid' to determine the UUID of each filesystem on the devices: # /lib/udev/vol_id --uuid /dev/sdb1 aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa # /lib/udev/vol_id --uuid /dev/sdb2 bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb # /lib/udev/vol_id --uuid /dev/sdc1 XXXX-XXXX Add entries to /etc/fstab specifying those uuids in the first field instead of the device names: UUID=aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa /media/u1 auto noauto,user 0 0 UUID=bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb /media/u2 auto noauto,user 0 0 UUID=XXXX-XXXX /media/cam auto noauto,user 0 0 Use the mount-point names when mounting and umounting the filesystems. Reformatting a filesystem will change its uuid so /etc/fstab will need to be updated.
|
Pages: 1 Prev: Connecting to a vpn server Next: Debian to Ubuntu transfer difficulties |