PDA

View Full Version : USB storage accesing


Martijn - R'dam
2005-07-09, 08:15 AM CDT
Hello there,

if I plug in a MP3 player with 512 MB storage on it, no icon automattically appears on my desktop.
In a log is stated:
Jul 9 16:15:53 a193045 kernel: scsi1 : SCSI emulation for USB Mass Storage devices
Jul 9 16:15:53 a193045 kernel: Vendor: Samsung Model: YP-MT6 Rev: 0100
Jul 9 16:15:53 a193045 kernel: Type: Direct-Access ANSI SCSI revision: 02
Jul 9 16:15:53 a193045 kernel: SCSI device sda: 1014784 512-byte hdwr sectors (520 MB)
Jul 9 16:15:53 a193045 kernel: sda: assuming Write Enabled
Jul 9 16:15:53 a193045 kernel: sda: assuming drive cache: write through
Jul 9 16:15:53 a193045 kernel: sda: sda1
Jul 9 16:15:53 a193045 kernel: Attached scsi removable disk sda at scsi1, channel 0, id 0, lun 0
Jul 9 16:15:54 a193045 scsi.agent[4026]: disk at /devices/pci0000:00/0000:00:01.3/usb2/2-1/2-1:1.0/host1/1:0:0:0

Hence I assume there must be made some connection between it and my computer.
Though when I browse to /sys/devices/pci0000:00/0000:00:01.3/usb2/2-1/2-1:1.0/host1/1:0:0:0 no virtual mass storage space is to be found.

Do you have a idea what a solution might be? I don't know very much about Linux, just that I unconditionally chose for it over Windows.

Thank you in advance,

Martijn from Rotterdam

tejas
2005-07-09, 09:11 AM CDT
make a folder called USB in /mnt

# mkdir /mnt/USB

mount the usb:

# mount -t auto /dev/sda1 /mnt/USB
[-t auto optional.]

and before removing the USB, don't forget to unmount

# umount /dev/sda1

# means run as root

- Tejas Dinkar

jim
2005-07-09, 09:30 AM CDT
You should be able to plug it in a USB port and it should automounted.

plug in the drive and run this command

tail -30 /var/log/messages

Flatron
2005-07-09, 09:37 AM CDT
It mount my pendrive to /media/usbdisk automatically-

Martijn - R'dam
2005-07-09, 11:10 AM CDT
Hey tejas,

it worked! Strangely enough only on second instance.
Thank you very much! That was simple after all.

Martijn - R'dam
2005-07-09, 11:19 AM CDT
However though I encounter the next problem,
it seems to be read only. It did command: chmod 777 dev/sda1 and also chmod 777 mnt/USB
didn' work till now. Have a suggestion?

Martijn - R'dam
2005-07-09, 11:24 AM CDT
I found a way to copy a file to mnt/USB: as root. I am quite happy now. But I would be even more happy If I were able to copy files using Nautilus. Is this possible? It is a problem I always had: act as root in Nautilus.

Martijn - R'dam
2005-07-09, 11:28 AM CDT
Another thing is that I was adviced not to forget to umount dev/sda1 before removing the USB;
however is I get the message: device is busy.
I don't know how risky unplugging without the umount procedure is?

tejas
2005-07-09, 11:53 AM CDT
well, do a (as root)

lsof /dev/sda1
lsof /mnt/USB
and see what is using the pendrive. Most likely, this will be konqueror (I don't know why). Anyway, type
kill P.I.D.NO (It will ususally be a 4digit no with the program) till the device is no longer busy.

to make it easier to mount partitions, you will have to edit /etc/fstab.

Open it in some editor, like kedit, gedit.
Add this line to it:
/dev/sda1 /mnt/USB auto noauto,users 0 0

right below the CD line is fine.

many people will suggest using umask in this line, but this is the simplest.

And now you can mount the drive without being root. Just type in
mount /dev/sda1 (no need for /mnt/USB anymore)
now anyone can edit it

Martijn - R'dam
2005-07-09, 12:26 PM CDT
Thanks for the fstab thing. It worked. Also a complete special icon appears now when starting the filesystem manager.

But the lsof command isn't working, even not when I am in the directory /usr/sbin, where I can see that such an executable file is located.

By the way, I did unplug the cable once already and the changes were effectuated once I checked it on the unconnected mp3 player, without formally unmounting it.

But I am still curious about what program is using the 'pendrive'.

tejas
2005-07-09, 12:38 PM CDT
Just call it

/usr/sbin/lsof <file>

I am pretty sure it is Konqueror (the KDE file manager) that is handling this. In my computer it just refuses to die. I have a small tip. When you are done, make konqueror open some local folder like ~ or /. It will then release the USB.

Also, when unmounting, you cannot b inside the mount point.

ex:
cd /mnt/USB
umount /mnt/USB

will not work. You need to be on the outside

Martijn - R'dam
2005-07-09, 12:56 PM CDT
Well, I checked, now I learnt what PID is, but it isn't Konqueror but a program that is called 'fam' that is mentioned in the lsof list.
I looked on the forum and it seems that this program has to do with the kernel, am I right?

I don't know if this a problem because, without formally unmounting, still I got the data on to the mp3 player.

tejas
2005-07-09, 02:46 PM CDT
Well, OK. I don't think it will have done much damage.

But do not try this on floppy disks. It does some crazy stuff.

and you are going to have a 3 ring circus around there if you try plugging the USB back in.

Here is a clue if you get stuck:
It thinks the old USB is still plugged in. If you put in the USB again, it thinks there are 2 USBs plugged in. the real one will get the title sdb, not sda.
Oh, and you'll need a new mount point.

Of course, all these problems go away by rebooting

Firewing1
2005-07-09, 03:04 PM CDT
Hey,
I would try not to just unplug it. It damages the sectors. If you're really desprate, shutdown first, then unplug it. Shutdown forces it to be unmounted.
Firewing1

Martijn - R'dam
2005-07-11, 05:57 AM CDT
I shutdown 'fam', and I can umount. I don't know if shutting down fam can make problems in the future, but I checked and it seems to be a little programme that makes file listings more accurate up to date. Thanks for the help!