sector read and write 
Author Message
 sector read and write

Is there a module that allows perl to read and write disk sectors directly?
(As in raw read/write) If so what is it.
Thanks



Sun, 15 Aug 2004 21:48:11 GMT  
 sector read and write
Hi Doug,

Quote:
> Is there a module that allows perl to read and write disk sectors
> directly? (As in raw read/write) If so what is it.

I've never seen one. On Windows it is possible to use Win32::API and some
simple API calls to do some raw reads/writes to floppies. I doubt any
proper OS would allow raw read/write to an active primary disk directly
from an application (although Win9x might permit it). On un*x, it would
probably take something like 'system ("dd ...")', running as root, but I
haven't tried it.

There are numerous security and stability issues associated with doing,
or permitting, raw i/o to disks. Simple errors end up being VERY fatal.

-bill



Mon, 16 Aug 2004 14:59:00 GMT  
 sector read and write

Quote:

> Hi Doug,

>> Is there a module that allows perl to read and write disk sectors
>> directly? (As in raw read/write) If so what is it.

open(), sysread(), and syswrite() on UNIX-oid systems.

Quote:
> I've never seen one. On Windows it is possible to use Win32::API and some
> simple API calls to do some raw reads/writes to floppies. I doubt any
> proper OS would allow raw read/write to an active primary disk directly
> from an application (although Win9x might permit it). On un*x, it would
> probably take something like 'system ("dd ...")', running as root, but I
> haven't tried it.

FreeBSD lets you do it if you've got permission.  This dumps the first
sector of my first drive.

perl -wle 'open(FD,"</dev/ad0") or die $!; sysread(FD, my $x="", 512)
or die $!; print unpack("H*", $x)'

Parsing the filesystem is the hard part.

Quote:
> There are numerous security and stability issues associated with doing,
> or permitting, raw i/o to disks. Simple errors end up being VERY fatal.

Tune in next time when we'll show you how to write garbage to
/dev/kmem.  :)




Tue, 17 Aug 2004 14:51:57 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. perlish way to read/write absolute sectors from PC disk?

2. perlish way to read/write absolute sectors from PC disk?

3. ping all ip's fron one file without ip's from private sector

4. Reading and writing to a pipe.

5. Reading from a file another process has written

6. Reading/writing memory...

7. prob opening read/write

8. Reading and writing Microsoft unicode files

9. How to read/write Comma Seperated Value Files (CSV)

10. Using perl to read/write Excel and Foxpro?

11. perl program read/write to /proc under linux

12. open pipe with read and write?

 

 
Powered by phpBB® Forum Software