Re: Accessing raw devices (hard drives) with Java ?
Roedy Green wrote:
On Mon, 10 Sep 2007 07:33:38 -0700, S??bastien de Mapias
<sglrigaud@gmail.com> wrote, quoted or indirectly quoted someone who
said :
traverse its bytes: is there a way to access this data from Java ?
Has anyone already tried to write such a program ?
You need to write some low level accessing code in C with JNI glue..
You shouldn't need to with Solaris.
With every passing year this gets harder and harder to write as
security in OSes tightens.
The only security on a device special file in Solaris is the basic filesystem
permissions on the device special file itself. If you have read permission on
that file you can open it and read the contents.
Basically all you need is a read( offset, length ) and write(offset,
length).
Keep in mind there will be many parts of the disk the OS will not let
you touch, e.g. the paging file or the bootsector.
Not in Solaris. A device special file provides you with read (and/or write)
access to the raw disk/partition. If you read direct from the device special
file Solaris makes no interpretation of the contents of that raw
disk/partition, it is simply a stream of bytes just as any other binary file.
To do this sort of
thing properly, you need to use the Boot-It approach where you boot to
a very simple OS without security from CD. Then you can do anything
you want without OS interference.
Alternatively, just use the facilities provided by the OS you already have
installed...
--
Nigel Wade, System Administrator, Space Plasma Physics Group,
University of Leicester, Leicester, LE1 7RH, UK
E-mail : nmw@ion.le.ac.uk
Phone : +44 (0)116 2523548, Fax : +44 (0)116 2523555