Using MEMDISK to etherboot a diskless DOS

Please, read also the general memdisk introduction.

This page is about using memdisk to run DOS, plus a virtual harddrive in RAM.

Diskless DOS (big ram disk)

Cloning a harddisk, in its simplest form, is just like cloning a floppy. Assumptions:

  • we already have a harddisk of the same size we want to clone
  • it's bootable, ie. it has an active DOS partition formated with system transferred
  • all required DOS utilities and application programs installed
  • server:/tftpdir is exported (nfs) and mounted (rw,norootsquash) at xterm:/tftpdir

Then here's what we do to clone this harddisk in our diskless xterm:

  • Connect (temporary) the target harddisk to xterm as /dev/hda
  • Boot xterm (from network) into linux
  • Upload the harddisk image and (optionally) gzip it:
         [root@xterm root]# mount server:/tftpdir /tftpdir
         [root@xterm root]# dd if=/dev/hda of=/tftpdir/bigdos 
         [root@xterm root]# gzip -9 /tftpdir/bigdos
  • Go to server, build our net boot image (nbi) as before:
         [root@server root]# cd /tftpdir
         [root@server tftpdir]# mkelf-linux --ip=rom --rdnopad memdisk bigdos.gz > bigdos.nb
  • As before, we have to reconfigure dhcpd to specify bigdos.nb as the net boot image next time xterm starts.

Of course, you could also disconnect the harddrive from the client and connect it to a linux box, read it out there.

Things get a bit tricky if we want our ram disk to contain only a small partition of a big harddisk. In theory, we can choose any partition of any size as long as we have enough ram to cover every sector of the harddisk from the start (MBR) upto the end of our target partition. In practice however, we prefer partition 1 starting from cylinder 1 to cylinder n because memdisk does not like fractional cylinders in partitions and space between MBR and our target partition will likely be a waste of RAM. Here's what we'll tell dd to copy (instead of the whole disk as before):

[root@xterm root]# dd if=/dev/hda of=/tftpdir/bigdos bs=512 count=S 

where S is the total number of sectors from sector 0 (MBR) upto the end of our target partition. We use the -l option in fdisk (linux) to determine the harddisk's geometry and partition information then get S by:

S = number of sectors/track(s) x number of heads(h) x ending cylinder number(n)

Alternatively, some people prefer copying the MBR track and the partition separately like this:

  • copy the master boot record (mbr) and remaining sectors on the same track:
    [root@xterm root]# dd if=/dev/hda of=/tftpdir/mbr bs=512 count=s

    Note: s here is the number of sectors from start of harddisk (MBR) to start of target partition which, in most cases, is the 'number of sectors/track' as before.

  • copy the target partition to a separate image file
    [root@xterm root]# dd if=/dev/hda1 of=/tftpdir/hda1
  • glue them together and gzip
    [root@xterm root]# cat /tftpdir/{mbr,hda1} | gzip -9 > /tftpdir/bigdos.gz

QR Code
QR Code disklessdos (generated for current page)