View previous topic :: View next topic |
Author |
Message |
Gentree Watchman
Joined: 01 Jul 2003 Posts: 5350 Location: France, Old Europe
|
Posted: Sat May 13, 2006 11:06 am Post subject: |
|
|
Just got a link the this guide. Great work. I looked at this a couple of months back and it was taking me too much time. Thanks for this solution.
Quote: | Would not it be possible to use the sync command? I had a usb drive that did not always get written to due to the async in the mount command. |
certainly, just give it time to run . This may be _several minutes_ if you have written a large file. Watch the access led on the usb device.
sync will sync all mounted fs , not just the usb though that is not usually a problem.
if you user cannot umount the device mounted by root , you can use eject. This is allowed by user and will flush the device and umount it correctly , with the additional effect that this device cannot be re-mounted without being unplugged and recreated by being plugged in. This again is probably what is required.
If you just want to flush use sync command, if you intend to unplug the device use eject.
mount -o sync on usb is BAD for a couple of reasons. On "recent" kernels (>2.6.12 from memory) the new (incorrectly documented ) behaviour of the msdos fs driver hammers that FAT. This can lead to premature device failure on some cheaper devices where this is not buffered internally.
Even if that is not an issue , write perfomance will be upto 10x (yes and order of magnitude) slower.
I dont have kde on gentoo but I have looked at this in detail on Suse 9.x and 10.0 and it was a mess . Lots of cases where konqueror could not open the device , users could not umount ... generally a non-functional mess. kde said it suse, suse said it's kde /
My basic conclusion is that linux is not windows and trying to make it "just like windows" is detrimental to linux. linux is better because it's different, dont degrade linux, learn to use it.
That's why I like the simple approach of this guide. Just what I want.
I recommend using async and being are aware of the consequences.
The new kernel driver is ugly, slow and badly designed as far as 0_SYNC goes. This definately needs work. There was a flurry of interest earlier this year when this was again brought up on lkml but I am not aware that it got any further.
The good news is that linux with async can be nearly twice as fast as windows for writting to usb memory devices. My guess is that windows does some flushing automatically that makes it slower than linux async but faster and more reliable than linux sync.
Any one reading this will have no problem coping with async mounting so I say enjoy the speed.
_________________ Linux, because I'd rather own a free OS than steal one that's not worth paying for.
Gentoo because I'm a masochist
AthlonXP-M on A7N8X. Portage ~x86 |
|
Back to top |
|
|
theruck Tux's lil' helper
Joined: 12 Feb 2004 Posts: 83
|
Posted: Wed May 24, 2006 10:18 am Post subject: |
|
|
great tutor thank you very much! |
|
Back to top |
|
|
marcelvs n00b
Joined: 10 Sep 2005 Posts: 30
|
Posted: Wed Aug 09, 2006 11:23 pm Post subject: |
|
|
Gentree wrote: | Just got a link the this guide. Great work. I looked at this a couple of months back and it was taking me too much time. Thanks for this solution.
Quote: | Would not it be possible to use the sync command? I had a usb drive that did not always get written to due to the async in the mount command. |
certainly, just give it time to run . This may be _several minutes_ if you have written a large file. Watch the access led on the usb device.
sync will sync all mounted fs , not just the usb though that is not usually a problem.
if you user cannot umount the device mounted by root , you can use eject. This is allowed by user and will flush the device and umount it correctly , with the additional effect that this device cannot be re-mounted without being unplugged and recreated by being plugged in. This again is probably what is required.
If you just want to flush use sync command, if you intend to unplug the device use eject.
mount -o sync on usb is BAD for a couple of reasons. On "recent" kernels (>2.6.12 from memory) the new (incorrectly documented ) behaviour of the msdos fs driver hammers that FAT. This can lead to premature device failure on some cheaper devices where this is not buffered internally.
Even if that is not an issue , write perfomance will be upto 10x (yes and order of magnitude) slower.
I dont have kde on gentoo but I have looked at this in detail on Suse 9.x and 10.0 and it was a mess . Lots of cases where konqueror could not open the device , users could not umount ... generally a non-functional mess. kde said it suse, suse said it's kde /
My basic conclusion is that linux is not windows and trying to make it "just like windows" is detrimental to linux. linux is better because it's different, dont degrade linux, learn to use it.
That's why I like the simple approach of this guide. Just what I want.
I recommend using async and being are aware of the consequences.
The new kernel driver is ugly, slow and badly designed as far as 0_SYNC goes. This definately needs work. There was a flurry of interest earlier this year when this was again brought up on lkml but I am not aware that it got any further.
The good news is that linux with async can be nearly twice as fast as windows for writting to usb memory devices. My guess is that windows does some flushing automatically that makes it slower than linux async but faster and more reliable than linux sync.
Any one reading this will have no problem coping with async mounting so I say enjoy the speed.
|
I agree with using async is better but as posted before async is not an option when we talk about (v)fat, as we can see typing 'man mount'.
The async option is ignored in certain filesystem in most recent kernels as said here too. My question is: how are you addressing this problem ? I am having to use windows to writte my pendrive and linux only for reading. |
|
Back to top |
|
|
DawgG l33t
Joined: 17 Sep 2003 Posts: 866
|
Posted: Fri Oct 27, 2006 4:42 pm Post subject: superfloppy-formatted doesn't work |
|
|
the script is GREAT! thx a lot!!!
i modified it a little bit so that only the user logged in to X gets all the desktop-stuff and removed some parts i don't need, but basically it's the same and it works.
one big problem where i use it is its inability to use superfloppy-formatted usb-sticks. i guess thats only about ~5% of all of them, but it still happens. those usb-disks do not have an own partition-table and are mounted as (eg) just /dev/sdb.
the beginning of the script checks for the device-name:
Code: |
#Check to see if the device is a sdX1 device
if [[ $base != sd[a-g][1-9] ]]
then
exit
fi
|
and just exits when a device w/out partition-table is inserted.
just deleting the [1-9]-part produces two device-links /dev/sdb and /dev/sdb1 and the according errors. i'm experimenting on it (without wanting to re-write the whole thing); maybe test-mounting /dev/sdb and /dev/sdb1 and checking which one works would do the trick.
better ideas welcome!
i'll post a solution when i have found it. _________________ DUMM KLICKT GUT. |
|
Back to top |
|
|
Truzzone Guru
Joined: 16 Oct 2003 Posts: 492 Location: Italy
|
Posted: Sat Feb 03, 2007 3:58 pm Post subject: |
|
|
Hi to ALL
I make all changes but at boot I see:
Quote: | udevd[978]: add_to_rules: invalid SUBSYSTEM operation
udevd[978]: add_to_rules: invalid rule '/etc/udev/rules.d/10-local.rules:1'
udevd[978]: main: the kernel does not support inotify, udevd can't monitor configuration file changes.
....
....
....
....
udevd[2490]: udev_node_symlink: symlink(md/0, /dev/md0) failed: File exist
#I have two sata hds in raid in /dev/md0 created by mdadm at boot
|
The files:
Quote: | ls -l /etc/udev/rules.d/10-local.rules
-rw-r--r-- 1 root root 54 3 feb 16:49 /etc/udev/rules.d/10-local.rules
cat /etc/udev/rules.d/10-local.rules
BUS="usb", KERNEL="sd?1", NAME="%k", SYMLINK="usb%k"
ls -l /etc/dev.d/block/automount.dev
-rwxr-xr-x 1 root root 1781 3 feb 16:38 /etc/dev.d/block/automount.dev
cat /etc/dev.d/block/automount.dev
#!/bin/bash
base=$(basename $DEVNAME)
#Send info to logger
logger -t automount_dev "`env`"
#Check to see if the device is a sdX1 device
if [[ $base != sd[a-g][1-9] ]]
then
exit
fi
#Do this when adding the plugged device
if [ "$ACTION" == "add" ]
then
#Retrieve info about the added device and store into variables
product=$(udevinfo -a -p $DEVPATH | grep SYSFS{product} -m 1 | cut --delim='"' -f2)
vendor=$(udevinfo -a -p $DEVPATH | grep SYSFS{vendor} -m 1 | cut --delim='"' -f2)
serial=$(udevinfo -a -p $DEVPATH | grep SYSFS{serial} -m 1 | cut --delim='"' -f2)
#Store the device info into a file named after the /dev/sdX1 point
#--Only needed when retrieving info for specific devices when unplugged
#--because you can't query a non-existent device
echo "$base+$DEVPATH+$vendor+$product+$serial" >> /tmp/$base
#If device is my Fuji S5000 by checking the serial of the plugged device
#--do this then exit
#--this device is added into /etc/fstab as...
#--/dev/Fuji_S5000 /mnt/Fuji_S5000/camera auto noauto,gid=100,umask=0707 0 0
if [ "$serial" == "<my camera's serial number>" ]
then
mount /dev/Fuji_S5000
exit
fi
#Create mount point and mount the device to it with proper access
mkdir /mnt/usb/$base
mount -o async,gid=100,umask=0707 /dev/$base /mnt/usb/$base
#Do this when the device is unplugged
elif [ "$ACTION" == "remove" ]
then
#Retrieve the serial number of the device from the /tmp/$base file
#--only needed for checking for specific devices
serial=$(cat /tmp/$base | cut --delim='+' -f5)
#If the device removed was my Fuji S5000
if [ "$serial" == "<my camera's serial number>" ]
then
umount -l /dev/Fuji_S5000
rm -f /tmp/$base
exit
fi
#Unmount the device and cleanup references
umount -l /mnt/usb/$base
rmdir /mnt/usb/$base
rm -f /tmp/link2$base
rm -f /tmp/$base
|
When I plugin my usb key with an ext3 partition (that mount without problems by command lines manually):
Quote: | Feb 3 16:51:27 fileserver hub 4-0:1.0: over-current change on port 1
Feb 3 16:51:27 fileserver hub 4-0:1.0: over-current change on port 2
Feb 3 16:51:28 fileserver hub 1-0:1.0: over-current change on port 5
Feb 3 16:51:28 fileserver hub 1-0:1.0: over-current change on port 6
Feb 3 16:51:28 fileserver usb 1-6: new high speed USB device using ehci_hcd and address 2
Feb 3 16:51:28 fileserver usb 1-6: configuration #1 chosen from 1 choice
Feb 3 16:51:28 fileserver scsi4 : SCSI emulation for USB Mass Storage devices
Feb 3 16:51:28 fileserver usb-storage: device found at 2
Feb 3 16:51:28 fileserver usb-storage: waiting for device to settle before scanning
Feb 3 16:51:33 fileserver Vendor: USB2.0 Model: Mobile Disk Rev: 1.00
Feb 3 16:51:33 fileserver Type: Direct-Access ANSI SCSI revision: 02
Feb 3 16:51:33 fileserver SCSI device sdc: 983808 512-byte hdwr sectors (504 MB)
Feb 3 16:51:33 fileserver sdc: Write Protect is off
Feb 3 16:51:33 fileserver sdc: Mode Sense: 00 00 00 00
Feb 3 16:51:33 fileserver sdc: assuming drive cache: write through
Feb 3 16:51:33 fileserver SCSI device sdc: 983808 512-byte hdwr sectors (504 MB)
Feb 3 16:51:33 fileserver sdc: Write Protect is off
Feb 3 16:51:33 fileserver sdc: Mode Sense: 00 00 00 00
Feb 3 16:51:33 fileserver sdc: assuming drive cache: write through
Feb 3 16:51:33 fileserver sdc: sdc1
Feb 3 16:51:33 fileserver sd 4:0:0:0: Attached scsi removable disk sdc
Feb 3 16:51:33 fileserver sd 4:0:0:0: Attached scsi generic sg2 type 0
Feb 3 16:51:33 fileserver usb-storage: device scan complete
Feb 3 16:51:33 fileserver automount_dev: PHYSDEVPATH=/devices/pci0000:00/0000:00:1d.7/usb1/1-6/1-6:1.0/host4/target4:0:0/4:0:0:0 ID_MODEL=Mobile_Disk ID_REVISION=1.00 ID_BUS=usb SUBSYSTEM=block ID_SERIAL=USB2.0_Mobile_Disk_92e3b8f0e960f1 DEVPATH=/block/sdc MINOR=32 ACTION=add PWD=/ UDEV_LOG=3 MAJOR=8 DEVLINKS=/dev/disk/by-id/usb-USB2.0_Mobile_Disk_92e3b8f0e960f1 /dev/disk/by-path/pci-0000:00:1d.7-usb-0:6:1.0-scsi-0:0:0:0 UDEVD_EVENT=1 DEVNAME=/dev/sdc SHLVL=1 PHYSDEVDRIVER=sd ID_TYPE=disk ID_VENDOR=USB2.0 PHYSDEVBUS=scsi ID_PATH=pci-0000:00:1d.7-usb-0:6:1.0-scsi-0:0:0:0 SEQNUM=1764 _=/usr/bin/env
Feb 3 16:51:33 fileserver automount_dev: PHYSDEVPATH=/devices/pci0000:00/0000:00:1d.7/usb1/1-6/1-6:1.0/host4/target4:0:0/4:0:0:0 ID_MODEL=Mobile_Disk ID_REVISION=1.00 ID_FS_LABEL_SAFE= ID_FS_LABEL= ID_BUS=usb SUBSYSTEM=block ID_SERIAL=USB2.0_Mobile_Disk_92e3b8f0e960f1 ID_FS_UUID=7166e1c2-f95d-4a23-86c8-0a4a0288616a DEVPATH=/block/sdc/sdc1 ID_FS_VERSION=1.0 MINOR=33 ACTION=add PWD=/ UDEV_LOG=3 ID_FS_TYPE=ext3 MAJOR=8 DEVLINKS=/dev/disk/by-id/usb-USB2.0_Mobile_Disk_92e3b8f0e960f1-part1 /dev/disk/by-path/pci-0000:00:1d.7-usb-0:6:1.0-scsi-0:0:0:0-part1 /dev/disk/by-uuid/7166e1c2-f95d-4a23-86c8-0a4a0288616a UDEVD_EVENT=1 DEVNAME=/dev/sdc1 SHLVL=1 ID_FS_USAGE=filesystem PHYSDEVDRIVER=sd ID_TYPE=disk ID_VENDOR=USB2.0 PHYSDEVBUS=scsi ID_PATH=pci-0000:00:1d.7-usb-0:6:1.0-scsi-0:0:0:0 SEQNUM=1765 _=/usr/bin/env
|
the results:
Quote: |
ls -l /mnt/usb/
total 0
|
What I do for work?
Please help me.
Best regards,
Truzzone |
|
Back to top |
|
|
fank l33t
Joined: 16 Oct 2004 Posts: 794 Location: Minsk, Belarus
|
Posted: Sun Feb 04, 2007 3:08 am Post subject: |
|
|
Quote: | udevd[978]: main: the kernel does not support inotify, udevd can't monitor configuration file changes. |
try to enable inotify in your kernel |
|
Back to top |
|
|
Truzzone Guru
Joined: 16 Oct 2003 Posts: 492 Location: Italy
|
Posted: Wed Feb 07, 2007 7:54 pm Post subject: |
|
|
Hi,
thanks for your reply.
I built-in the inotify support and at boot I don't received the first error but always not work I see the same lines on the /var/log/message that detect the usb key and it's partition but not mount or create the directory on /mnt/usb
From my .config:
Quote: | cat .config | grep INO
# CONFIG_X86_SPEEDSTEP_CENTRINO is not set
# CONFIG_USB_DYNAMIC_MINORS is not set
CONFIG_INOTIFY=y
CONFIG_INOTIFY_USER=y
|
Anyone help me?
Best regards,
Truzzone |
|
Back to top |
|
|
DawgG l33t
Joined: 17 Sep 2003 Posts: 866
|
Posted: Tue May 15, 2007 2:54 pm Post subject: does not work with udev 111 |
|
|
i noticed that the script does not work with udev-111 anymore (after i upgraded from udev-103). i have no custom-made rules in /etc/udev/rules.d, just the script in /etc/dev.d/block/.
with the old (before etc-update) and the new rules with udev-111 the script was not executed (didn't have time to really check WHY, maybe later), with udev-103 it ran again. _________________ DUMM KLICKT GUT. |
|
Back to top |
|
|
Raffi l33t
Joined: 17 Mar 2003 Posts: 731 Location: Moscow, Id.
|
Posted: Thu Aug 16, 2007 2:37 pm Post subject: Re: does not work with udev 111 |
|
|
DawgG wrote: | i noticed that the script does not work with udev-111 anymore (after i upgraded from udev-103). i have no custom-made rules in /etc/udev/rules.d, just the script in /etc/dev.d/block/.
with the old (before etc-update) and the new rules with udev-111 the script was not executed (didn't have time to really check WHY, maybe later), with udev-103 it ran again. |
The latest udev has removed all support for /etc/dev.d and /etc/hotplug.d. As of yet, I don't know where to move things to get the functionality back. Anyone have any ideas? |
|
Back to top |
|
|
Raffi l33t
Joined: 17 Mar 2003 Posts: 731 Location: Moscow, Id.
|
Posted: Thu Aug 16, 2007 4:08 pm Post subject: |
|
|
OK. I have a quick answer to how to deal with the changes to udev
If you had a script in /etc/dev.d/block/ called usbauto.dev, you can copy it to /etc/udev/scripts/usbauto.sh and then create a a file in /etc/udev/rules.d called 99-thumb.rules with the content of
Code: |
KERNEL=="sd[a-z]*", SUBSYSTEM=="block", RUN+="/etc/udev/scripts/usbauto.sh %k"
|
This should pretty much duplicate the functionality you had in dev.d. At least it worked for me. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|