Flash memory stick

New to Debian (Or Linux in general)? Ask your questions here!

Flash memory stick

Postby zwerg » 2010-02-16 05:29

Lenny. I'd like to use a USB flash memory stick to make some backups of plaintext and HTML files. I'd like to plug it in, and as user enter something like "mount /media/usb0" and start using the gizmo as a r/w storage device.

I'd appreciate a sample line for /etc/fstab, and info on how to determine whether the stick is in USB 0 or 1 -- or whatever.

My box has two USB female sockets into which to plug USB devices. One socket is used by my printer; hardinfo, however, shows NO USB devices plugged in at all (wrong, both sockets are used) but identifies my printer correctly. CUPS knows my printer as "Kyocera_FS-920_USB_1", and the URI is "usb://Kyocera/FS-920"; meanwhile lsusb shows

Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

with the stick plugged in.

I thought maybe pmount. So what's the "name" of my memory stick, and if that is not in /dev, can I put it there and make it a block device -- or am I wasting my time with pmount? Would usbmount be better, with this in /etc/fstab, assuming I can figure out what the mount point is for the memory stick?

/dev/sdc1 /media/usb0 vfat defaults,noexec,user,sync 0 0

..and mountpoints, filesystem and mountoptions entered in /etc/usbmount/usbmount.conf.

Thanks for suggestions. I just want this to work, so please keep it simple, to match my brain.
zwerg
 
Posts: 117
Joined: 2006-02-17 12:16
Location: Bangkok, Thailand

Re: Flash memory stick

Postby bodiless » 2010-02-16 09:14

First of all, when you plug your usb stick in doesn't it appear in any of your file managers (Thunar, Nautilus etc.)? If it does you should be able to click on it and it gets mounted so you can use it.

If not then do a dmesg after plugging it in. You should see something like:
Code: Select all
[440531.322816]  sdc: sdc1
[440531.349187] sd 7:0:0:0: [sdc] Attached SCSI removable disk

meaning it is recognized as sdc1
Then mount it wherever you want (mount -t vfat /dev/sdc1 /your_mount_point)
User avatar
bodiless
 
Posts: 270
Joined: 2007-01-24 14:38
Location: Greece

Re: Flash memory stick

Postby zwerg » 2010-02-16 13:54

Confession: I do not like working in the GUI and know next to nothing about it, so it was a slog getting Nautilus to open -- it's not on any of the drop-down menus, which strikes me as crazy, because it's always been installed (according to aptitude), and I certainly tried to put it on a menu (again, I don't know how to work in ToonTown).

Eventually I got Nautilus to open. The results were Zero: the USB stick simply is not shown, either there or in Konqueror or by any other app that shows the hardware. The results for hardinfo do not depend on what is in the /etc/fstab. (It gets worse: at one point, while not being particularly systematic and before I posted here, I got it to show as "The Vast Drive In" -- no kidding -- when I used hardinfo; it was under Storage, not USB. I can't reproduce that bizarre result, unfortunately.)

Dmesg contains nothing helpful. I tried repeated reboots, with and without the stick; I went over everything in /dev (each usb directory) and re-read everything I came across. No joy.

I'd really like to get back to my original questions: how to set up /etc/fstab so I can mount the stick (from the command line, please!), and what the stick is to be called in the $ mount /media/xxxxx command.

I have found no way to learn whether it's in USB 0 or USB 1 or USB Whatever. If I can just get it down to /media/usb0, that will reduce the number of possibilities; I can then try a few likely fstab settings, and probably get it to work without spending hours on a full brute-force attack.

(Edit to correct spelling of a word)
zwerg
 
Posts: 117
Joined: 2006-02-17 12:16
Location: Bangkok, Thailand

Re: Flash memory stick

Postby smallchange » 2010-02-16 15:08

The mount point (/media/usbX) can be whatever you decide to call it. It is just a name that you give to a directory that you create to mount the drive on. The important point is , what do you mount there? The kernel will create a device file in /dev/ through which you will access the drive. If you do not find that file you do not access the drive. Look in /dev/disk. You should see four directories that list the disks known to the kernel by-id, by-uuid,by-label and by-path. Probably the most informative is by-uuid. Run
Code: Select all
ls -l /dev/disk/by-uuid
and you will see that each uuid points to a device. In one case with no USB disk I see this.
lrwxrwxrwx 1 root root 24 Feb 13 11:10 0ed05c08-6467-490c-a750-b4d7e0f085af -> ../../mapper/system-swap
lrwxrwxrwx 1 root root 10 Feb 13 11:10 3814d8b2-e723-447c-973d-35bf362ba619 -> ../../sda6
lrwxrwxrwx 1 root root 10 Feb 13 11:10 3b46bec9-a220-4190-8a2d-b197e8cd9821 -> ../../sda7
lrwxrwxrwx 1 root root 10 Feb 13 11:10 4448D2D248D2C23A -> ../../sda2
lrwxrwxrwx 1 root root 10 Feb 13 11:10 60F4CEDDF4CEB496 -> ../../sda1
lrwxrwxrwx 1 root root 24 Feb 13 11:10 6a3f423a-ab0d-48a8-a8ca-df2eb154c11b -> ../../mapper/system-home
lrwxrwxrwx 1 root root 25 Feb 13 05:10 91aef6bc-4699-4a4d-b383-63a762072705 -> ../../mapper/system-root1
lrwxrwxrwx 1 root root 25 Feb 13 11:10 c607a4bf-0d33-4c96-9e25-11b906f10393 -> ../../mapper/system-root2

Then i plug in a USB disk and wait a few seconds and I see this
lrwxrwxrwx 1 root root 24 Feb 13 11:10 0ed05c08-6467-490c-a750-b4d7e0f085af -> ../../mapper/system-swap
lrwxrwxrwx 1 root root 9 Feb 16 08:48 27E3-463F -> ../../sdb
lrwxrwxrwx 1 root root 10 Feb 13 11:10 3814d8b2-e723-447c-973d-35bf362ba619 -> ../../sda6
lrwxrwxrwx 1 root root 10 Feb 13 11:10 3b46bec9-a220-4190-8a2d-b197e8cd9821 -> ../../sda7
lrwxrwxrwx 1 root root 10 Feb 13 11:10 4448D2D248D2C23A -> ../../sda2
lrwxrwxrwx 1 root root 10 Feb 13 11:10 60F4CEDDF4CEB496 -> ../../sda1
lrwxrwxrwx 1 root root 24 Feb 13 11:10 6a3f423a-ab0d-48a8-a8ca-df2eb154c11b -> ../../mapper/system-home
lrwxrwxrwx 1 root root 25 Feb 13 05:10 91aef6bc-4699-4a4d-b383-63a762072705 -> ../../mapper/system-root1
lrwxrwxrwx 1 root root 25 Feb 13 11:10 c607a4bf-0d33-4c96-9e25-11b906f10393 -> ../../mapper/system-root2

Notice that /dev/disk/by-uuid/27E3-463F is now a link to /dev/sdb. That is the USB disk I just added to the system. In my case you do not see sdb1 for the first partition but you probably willl in yours, or you might see sdb4. That partition is what you want to mount. So I know what to mount on the mount point. Now I need to know what filesystem is on the USB disk. They almost all have a vfat of some sort. If you want the mount point to be /media/usb0, create that with mkdir /media/usb0. You can then mount it with
Code: Select all
mount -t vfat /dev/sdb4 /media/usb0
(use the partition you see, might be 4) and then unmount it with
Code: Select all
umount /media/usb0
or
Code: Select all
umount /dev/sdb4

You could then create an entry in /etc/fstab like
/dev/sdb4 /media/usb0 vfat user,noauto,uid=xxxx,gid=xxxx,rw,exec,nosuid,async
or other mount options that you choose. If you want to read and write to the disk as some user use the uid,gid as above (with your users uid,gid). If you want it to not be mountd automatically use the noauto. After creating the fstab entry yo uwill be able to mount it by referring to either the partition or the mount point alone, as mount will read fstab for the rest of the info it needs.
smallchange
 
Posts: 1740
Joined: 2009-05-04 15:56

Re: Flash memory stick

Postby zwerg » 2010-02-16 18:22

Thanks, smallchange. This all looks straightforward, if unfamiliar. It seems to me things like this used to be simpler.... I'll work through it in the morning. Too sleepy now to get things right.

Edit: morning, and some very positive results indeed. On following smallchange's instructions, I see no difference at all between the results of asking for a list of devices by uuid before and after inserting the flash memory stick, but when I insert the stick, the display goes nuts. So I located an antique Iomega Zip100 USB in the vault and plugged it in. Before I even asked for the uuids in /dev/disk/ the display produced info that correctly identified the Zip100 and told me it would be mounted as sdc4.

I am convinced that the flash memory stick is junk. And for now, to back up files quickly and later burn the new versions to CD, I'm recalling the Zip100 to active duty. Yes, the media are no longer available, but the machine works. I'll wait until every last Zip100 disc I have has died before I spend (waste more?) money on another flash memory whizbang.

Thanks to smallchange for providing a useful HOWTO.
zwerg
 
Posts: 117
Joined: 2006-02-17 12:16
Location: Bangkok, Thailand


Return to Beginners Questions

Who is online

Users browsing this forum: No registered users and 12 guests

fashionable