473,407 Members | 2,676 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Raw disk access

How does one access the raw disk?

I have a USB thumb drive that will have many megabytes of data on it.
What I want to do is access the device raw and do reading from/writing
to the usb device itself. No partitions, no mounting, just raw disk
access to data in predefined structures that is on the device. I have
looked at Advanced Unix Programming (ISBN 0-13-141154-3) by Marc J.
Rochkind and it does mention a few things about it, but I want to know
more. Any documentation/references online that someone is willing to share?

I am running FreeBSD 6.x.

--
Daniel Rudy

Email address has been base64 encoded to reduce spam
Decode email address using b64decode or uudecode -m

Why geeks like computers: look chat date touch grep make unzip
strip view finger mount fcsk more fcsk yes spray umount sleep
Mar 23 '07 #1
7 12144
Daniel Rudy wrote:
How does one access the raw disk?

I have a USB thumb drive that will have many megabytes of data on it.
What I want to do is access the device raw and do reading from/writing
to the usb device itself. No partitions, no mounting, just raw disk
access to data in predefined structures that is on the device. I have
looked at Advanced Unix Programming (ISBN 0-13-141154-3) by Marc J.
Rochkind and it does mention a few things about it, but I want to know
more. Any documentation/references online that someone is willing to share?

I am running FreeBSD 6.x.
Either a BSD group or comp.unix.programmer would be a better place to ask.

--
Ian Collins.
Mar 23 '07 #2
On Mar 23, 9:34 am, Daniel Rudy <spamt...@spamthis.netwrote:
How does one access the raw disk?

I have a USB thumb drive that will have many megabytes of data on it.
What I want to do is access the device raw and do reading from/writing
to the usb device itself. No partitions, no mounting, just raw disk
access to data in predefined structures that is on the device. I have
looked at Advanced Unix Programming (ISBN 0-13-141154-3) by Marc J.
Rochkind and it does mention a few things about it, but I want to know
more. Any documentation/references online that someone is willing to share?
Do a search for USB and "mass storage" devices.

The things that you are looking for might not even exist. USB
implements an interface. There is no knowing what is on the device
itself.

Mar 23 '07 #3
At about the time of 3/23/2007 2:34 AM, Daniel Rudy stated the following:
How does one access the raw disk?

I have a USB thumb drive that will have many megabytes of data on it.
What I want to do is access the device raw and do reading from/writing
to the usb device itself. No partitions, no mounting, just raw disk
access to data in predefined structures that is on the device. I have
looked at Advanced Unix Programming (ISBN 0-13-141154-3) by Marc J.
Rochkind and it does mention a few things about it, but I want to know
more. Any documentation/references online that someone is willing to share?

I am running FreeBSD 6.x.
Opps....

Wrong group. That's what happens when you post at 2AM.
--
Daniel Rudy

Email address has been base64 encoded to reduce spam
Decode email address using b64decode or uudecode -m

Why geeks like computers: look chat date touch grep make unzip
strip view finger mount fcsk more fcsk yes spray umount sleep
Mar 23 '07 #4

To access the USB drive in raw mode in Linux...do not mount the drive.
Just search the device file in the folder /dev
It will probably be /dev/sda or /dev/sdc.

Since all the devices are treated as files in linux.you can use the
file in raw mode
in C/C++ program

eg

FILE* fp=fopen("/dev/sda","r");

etc.
For writing you may probably need to run the program as root.

daya
Mar 23 '07 #5
daya wrote, On 23/03/07 16:54:
To access the USB drive in raw mode in Linux...do not mount the drive.
Just search the device file in the folder /dev
It will probably be /dev/sda or /dev/sdc.

Since all the devices are treated as files in linux.you can use the
file in raw mode
in C/C++ program
I think you mean binary mode, C does not have a raw mode.
eg

FILE* fp=fopen("/dev/sda","r");
That would open it in text mode which is not what you want (although it
does not make much difference on Linux). You should use "rb" for binary.
etc.
For writing you may probably need to run the program as root.
All this would be best discussed on a Linux or Unix programming group
where the specifics of the system are topical. They are not topical here.
--
Flash Gordon
Mar 23 '07 #6
At about the time of 3/23/2007 1:08 PM, Flash Gordon stated the following:
daya wrote, On 23/03/07 16:54:
>To access the USB drive in raw mode in Linux...do not mount the drive.
Just search the device file in the folder /dev
It will probably be /dev/sda or /dev/sdc.

Since all the devices are treated as files in linux.you can use the
file in raw mode
in C/C++ program

I think you mean binary mode, C does not have a raw mode.
No, I mean raw device access mode in Unix, when the disk looks just like
a bunch of data blocks and you can view the partition table and
filesystem structures that the kernel uses to keep track of things on
the disk. In my case, it's a USB flash drive.
>eg

FILE* fp=fopen("/dev/sda","r");

That would open it in text mode which is not what you want (although it
does not make much difference on Linux). You should use "rb" for binary.
It would have to be binary mode.
>etc.
For writing you may probably need to run the program as root.

All this would be best discussed on a Linux or Unix programming group
where the specifics of the system are topical. They are not topical here.
Which is why I posted a follow-up message indicating that I posted to
the wrong group. The poster that you replied to snipped my post that
made a statement to that fact.
--
Daniel Rudy

Email address has been base64 encoded to reduce spam
Decode email address using b64decode or uudecode -m

Why geeks like computers: look chat date touch grep make unzip
strip view finger mount fcsk more fcsk yes spray umount sleep
Mar 24 '07 #7
Daniel Rudy wrote, On 24/03/07 08:53:
At about the time of 3/23/2007 1:08 PM, Flash Gordon stated the following:
<snip>
>All this would be best discussed on a Linux or Unix programming group
where the specifics of the system are topical. They are not topical here.

Which is why I posted a follow-up message indicating that I posted to
the wrong group. The poster that you replied to snipped my post that
made a statement to that fact.
I either did not see or did not remember that. I'm not disputing you
posted it, just pointing out that it is not unusual for these things to
be pointed out more than once.
--
Flash Gordon
Mar 24 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Cloud Burst | last post by:
I'm writing a javascript for my own use. I'd like it to read my disk to get some information. In particular, I want to find out how much disk is being used by some directories. At present, I'm...
5
by: Simon Harvey | last post by:
Hi everyone, I'm hoping for a little bit of advice on the following. I am in the process of making a small application that can send, receive and store email messages. The current area that I am...
2
by: Joe | last post by:
Hi Guys, Is it possible to create a disk management system using .NET entirely. What I mean by the above is having an application possibly a .NET windows service monitoring the disk, creating...
6
by: Rob | last post by:
Hi, I am working on a project that requires a Windows Service which performs the following file transfer functions. 1. It monitors a specific local directory on a Windows 2003 Server. 2. When...
2
by: Loane Sharp | last post by:
Hi there I'm using VB.NET and Office Web Components to access a SQL Server 2005 Express database and draw pictures on the fly in my ASP.NET application. Using .ExportPicture to write the...
12
by: Chris Springer | last post by:
I'd like to get some feedback on the issue of storing data out to disk and where to store it. I've never been in a production environment in programming so you'll have to bear with me... My...
3
by: Bruce | last post by:
I am building a WinForms app that uses Web Services access to a server for most of its data input/output, but I also need to persist some of its data to the local disk (basically as a cache of some...
7
by: ph | last post by:
Similar to many other postings, but just wanted to make sure I'm not doing something stupid before tackling this. New Access 2003 database on 20+ WinXP workstations with backend on Win2003...
6
by: Christine | last post by:
erver Error in '/test' Application. -------------------------------------------------------------------------------- There is not enough space on the disk. Description: An unhandled exception...
10
by: gary0gilbert | last post by:
An unusual spin to this recurring disk or network error in a Terminal Server environment. Access 2000, Terminal Server 2000, file server is windows 2000. All users have a separate copy of the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.