473,761 Members | 10,057 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 12202
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.progr ammer would be a better place to ask.

--
Ian Collins.
Mar 23 '07 #2
On Mar 23, 9:34 am, Daniel Rudy <spamt...@spamt his.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
1946
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 pasting the output of a command line "du -s" into some text fields and using that information. As I understand it, for security reasons javascript isn't allowed to do disk input/output. Please correct me if I'm wrong.
5
1705
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 thinking about is how to store messages on the hard disk and access them when needed. I dont want to read all the messages in at runtime because that would make startup take to long. What I think I need to do is to load a 'header' file at...
2
3750
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 and adding users and giving them access to store a limited amount of data. The only thing which does this in my knowledge is the FileSystemWatcher component. But how do I then monitor
6
2938
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 it finds files with a specific extension, it queries a SQL Server database to determine what workstation will be the destination of a File.Copy. 3. It copies those files to the appropriate workstations on the LAN,
2
2751
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 GIF/JPEG/PNG image to disk and then load it into the page using the <IMG /> tag is probably not the tidiest or most secure way of doing this, but it is the easiest and allows the greatest flexibility in terms of positioning. (It also seems to be the most...
12
3767
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 question is about storing data in a database. Yes I understand that you can link to a database in your program and read and write to the database etc etc. Well, that's all find and dandy but what if the person you're writing the application for...
3
3025
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 of the Web Services data) in XML format. Since the size of the XML local store could be rather large, I'd prefer to have a random access mechanism for reading and writing to it. It seems that XMLReader /XMLWriter are sequentially fast,...
7
3370
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 Server. Every week or two, some of the workstations will lose their link to the back end and come up with disk error. A logoff/reboot seems to be the only way to clear this problem. Only other app on the workstations is NAI Viruscan V8, which updates...
6
23998
by: Christine | last post by:
erver Error in '/test' Application. -------------------------------------------------------------------------------- There is not enough space on the disk. Description: An unhandled exception occurred during compilation using the CodeDomProvider 'Microsoft.VisualBasic.VBCodeProvider'. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.IO.IOException: There...
10
6161
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 front end db, everyone accesses the back-end db via a network share. To preface, non Terminal Server users (4 or 5 in office) never have this problem. There are two Terminal Servers running win 2000, both basically identical. This error affects...
0
9521
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9945
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9900
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9765
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6599
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5214
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5361
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3442
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2733
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.