perlish way to read/write absolute sectors from PC disk? 
Author Message
 perlish way to read/write absolute sectors from PC disk?

Is there a way to do this? The bottom line is I'm trying to find a way
to multiboot dozens of PCs between Win32, Linux and Solaris (and
perhaps more) _automatically_ (i.e. without manual intervention at
boot-up time) by issuing a command "reboot into {OS X}" from whichever
OS* is currently running. Plan A is to read and rewrite MBR and/or
boot sectors to acheive this. If there's a Perlish way of doing this
(across all platforms, natch) it would be nice.

(* I'm including Win32 as an 'OS' just to be provocative :-)

John Stumbles
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+



Sat, 17 Apr 2004 13:27:32 GMT  
 perlish way to read/write absolute sectors from PC disk?
Of course under Unix you can use `dd` to do this, something like this:

dd if=/dev/hda of=/bootsect bs=512 count=1

Under DOS you can use `debug` but don't know about NT - I guess it would
complain if you try to write to a raw device.  Here are a few
possibilities but I think you will run into the same problem.

The NT Resource kit includes DISKSAVE.EXE which enables a binary image
of the MBR or Boot Sector to be saved. See...

http://www.windows2000faq.com/Articles/Index.cfm?ArticleID=13754

Also there's a utility called mbredit that might do the job...

http://www.kzin.com/bootsec/
http://www.kzin.com/utillc/bin/mbredit.exe

--
  Simon Oliver



Sat, 17 Apr 2004 15:10:08 GMT  
 perlish way to read/write absolute sectors from PC disk?
Raw disk access is easy on Unix (if you're root); on Windows I believe
that DJGPP and maybe Cygwin provide device nodes for raw disk access,
so you could use a DJGPP-compiled Perl to do it.  But DJGPP's raw
access won't work on NT and its successors.

If you just want multi-boot, on NT the easiest way to do it is
probably the boot.ini file which controls the startup menu.  You can
boot DOS, WinDOS, Linux (and of course NT) from that file, and change
the default choice at boot time.  If you run a telnet or ssh service
on the Windows boxes, you can connect to them and run edlin
non-interactively (woo hoo!) to change the boot.ini file.  Have a look
at <http://www.doc.ic.ac.uk/~epa98/bin/nt_boot_linux>.

--

Finger for PGP key



Sat, 17 Apr 2004 14:28:12 GMT  
 
 [ 3 post ] 

 Relevant Pages 

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

2. sector read and write

3. ANNOUNCE: LibA2 0.003 (read/write Apple II ProDOS disk images)

4. The perlish way to write this?

5. Writing to a file when disk is full?

6. Corrupted disk writes with SDBM

7. Platform independant way of writing hash to disk?

8. Reading C binary data from disk

9. Can MacPerl read a raw disk

10. Reading IBM PC io address space

11. Errornous read/sysread for PC-Perl?

12. Reading from PC serial port

 

 
Powered by phpBB® Forum Software