Skip to contentSkip to conversation

USB Device Access

DISCUSSION Jeba Anandhan A 2 participants 2 messages Oct 19, 2004

lore
Share & tools
lore
#0 lore raw

Hi,
i have one USB Flash Disk.when i attached to it,linux 2.4.20-8 detected it as /dev/sda1.my question,i wish to write some raw data and read raw data.it consist fat filesystem.how to do it.[shall i need to mount the device in some directory].
expecting reply
urgent please

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

#1 lore raw

On Tue, 2004-10-19 04:23:46 -0700, Jeba Anandhan A <[email protected]> wrote in message <[email protected]>:

Quoted 2 lines

i have one USB Flash Disk.when i attached to it,linux 2.4.20-8 detected it as /dev/sda1.my question,i wish

No, it doesn't. It will detect it as /dev/sda and additionally create a partition (/dev/sda1) for it).

Quoted 3 lines

to write some raw data and read raw data.it consist fat filesystem.how to do it.[shall i need to mount the device in some directory].

Well, it depends on what you actually want:

- Raw data in a file inside a partition:
Mount the filesystem of the partition somewhere and open() the file

- Raw data inside the partition:
open() the partition (/dev/sda1 in your case); this'll probably destroy the filesystem that it contains.

- Raw data directly on the (unpartitioned) device:
open() the device (/dev/sda) and write to it. That will probably kill the partition table as well as the filesystem in this partition.

By the way, this isn't really a kernel question, and if it's "urgent", you'd probably ask your boss to send us some $$ for helping you...

MfG, JBG

Signature · 4 lines
Jan-Benedict Glaw       [email protected]    . +49-172-7608481             _ O _
"Eine Freie Meinung in  einem Freien Kopf    | Gegen Zensur | Gegen Krieg  _ _ O
 fuer einen Freien Staat voll Freier Bürger" | im Internet! |   im Irak!   O O O
ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));