how to expand dosubcd.img and make it still bootable?
Moderators: Icecube, StopSpazzing
-
- Posts: 19
- Joined: Fri Jun 13, 2008 11:06 am
how to expand dosubcd.img and make it still bootable?
I was trying to expand dosubcd.img to ~10Mb so that I can put more files in. I tried to "Change format...->select custom image format" in WinImage and expended dosubcd.img to ~10Mb. I re-zipped dosubcd.img to dosubcd.igz in /images. But now FreeDos is no longer bootable. Any help would be greatly appreciated!!!
See http://syslinux.zytor.com/wiki/index.ph ... ppy_images.
You need linux to make the image.If you find that a 1.44MB or 2.88MB disk image is not enough you can grow the image and still be able to boot off this image. Images as large as 10MB have been successfully deployed. The procedure to grow you image is as follows:
* Start with a working bootable 1.44MB or 2.88MB image
* Use the mkfloppyimg.sh or newmkfloppyimg.sh script from http://people.cs.uchicago.edu/~gmurali/ ... loads.html to grow the image size.
* When booting it with MEMDISK or mounting it using mtools, dont forget to specify the non-standard geometry (which is given my the scripts).
* Now that you have more space you are free to add more stuff to the image.
-
- Posts: 19
- Joined: Fri Jun 13, 2008 11:06 am
-
- Posts: 19
- Joined: Fri Jun 13, 2008 11:06 am
I have made an hard disk image from the freedos image.
To add files to the hard disk image, boot into linux.
- Make a directory dosubcdhd in your home directory (~/dosubcdhd):
- cd to the dosubcdhd folder:
- Download the hard disk image:
- Check if the file is downloaded correctly:
- The output should be: dosubcdhd.img.tar.bz2: OK.
- Extract dosubcdhd.img out of dosubcdhd.img.tar.bz2. It is a hard disk image of 25MiB.
- Make a directory inside ~/dosubcdhd, also called dosubcdhd (~/dosubcdhd/dosubcdhd/):
- Make you root (on ubuntu sudo su, on slax maybe su only (I never used slax so see for yourself how to gain temporary root acces)
- Mount the hard disk image into your filesytem with the following commands
- Now you can copy files to the image file by copying files into ~/dosubcdhd/dosubcdhd/.
- If you have copied all the files that you want to copy to the image, write zeros to the empty space of the hard disk image, so you can compress the image better.
Unmount the image and remove the loop device
- Type "exit" to loose root rights.
Compress dosubcdhd.img with gzip and rename the gzipped image to dosubcd.igz and place it in "/images/" of your ubcd folder.
To add files to the hard disk image, boot into linux.
- Make a directory dosubcdhd in your home directory (~/dosubcdhd):
Code: Select all
mkdir ~/dosubcdhd
Code: Select all
cd ~/dosubcdhd/
Code: Select all
wget http://ubcd.110mb.com/download/dosubcdhd/dosubcdhd.txt
wget http://ubcd.110mb.com/download/dosubcdhd/dosubcdhd.md5.txt
wget --base=http://ubcd.110mb.com/download/dosubcdhd/ -i dosubcdhd.txt --output-document=dosubcdhd.img.tar.bz2
Code: Select all
md5sum -c dosubcdhd.md5.txt
- Extract dosubcdhd.img out of dosubcdhd.img.tar.bz2. It is a hard disk image of 25MiB.
Code: Select all
bzip2 -dc dosubcdhd.img.tar.bz2 | tar xvf -
Code: Select all
mkdir dosubcdhd
- Mount the hard disk image into your filesytem with the following commands
Code: Select all
losetup -o 32256 /dev/loop0 dosubcdhd.img
mount -t vfat /dev/loop0 ./dosubcdhd
- If you have copied all the files that you want to copy to the image, write zeros to the empty space of the hard disk image, so you can compress the image better.
Code: Select all
dd if=/dev/zero of=~/dosubcdhd/dosubcdhd/zerodisk.txt
rm ~/dosubcdhd/dosubcdhd/zerodisk.txt
Code: Select all
umount dosubcdhd
losetup -d /dev/loop0
Compress dosubcdhd.img with gzip and rename the gzipped image to dosubcd.igz and place it in "/images/" of your ubcd folder.
Last edited by Icecube on Wed Jun 25, 2008 11:25 am, edited 3 times in total.
-
- Posts: 19
- Joined: Fri Jun 13, 2008 11:06 am
Icecube, thank you so much for spending this significant amount of time to solve my headache. And you are a real good doctor^_^
I have downloaded dosubcdhd.bz2. After I run bunzip2 dosubcdhd.bz2, what I got is a file called "dosubcdhd" instead of "dosubcdhd.img". I tried to rename it to .img file, but Slax doesn't allow me to mount this .img to a folder. So I got stuck here, not knowing how to "Extract dosubcdhd.img out of dosubcdhd.bz2. It is a hard disk image of 25MiB."
The "dosubcdhd" file I got is 25MiB, so i think i got the right file, but just don't know how to deal with it.
I have downloaded dosubcdhd.bz2. After I run bunzip2 dosubcdhd.bz2, what I got is a file called "dosubcdhd" instead of "dosubcdhd.img". I tried to rename it to .img file, but Slax doesn't allow me to mount this .img to a folder. So I got stuck here, not knowing how to "Extract dosubcdhd.img out of dosubcdhd.bz2. It is a hard disk image of 25MiB."
The "dosubcdhd" file I got is 25MiB, so i think i got the right file, but just don't know how to deal with it.
I bzipped the dosubcdhd.img with file-roller.
Aparently you have to unbzip the file and afterwards, you have to untar it. I didn't know it myself
. I do this always graphically.
The command that you must use:
I edited my previous post.
I renamed dosubcdhd.bz2 to dosubcdhd.img.tar.bz2 to make it clear that the file is also tarred.
I added the unachiving command:
Aparently you have to unbzip the file and afterwards, you have to untar it. I didn't know it myself

The command that you must use:
Code: Select all
bzip2 -dc dosubcdhd.bz2 | tar xvf -
I renamed dosubcdhd.bz2 to dosubcdhd.img.tar.bz2 to make it clear that the file is also tarred.
I added the unachiving command:
Code: Select all
bzip2 -dc dosubcdhd.img.tar.bz2 | tar xvf -
-
- Posts: 19
- Joined: Fri Jun 13, 2008 11:06 am
Thank you so much ~
I added the files, rezip it as dosubcdhd.img.gz, copy it to /images/dosubcd.igz, but freedos still doesn't start up in UBCD. Is my way wrong?
Without any additional files added in dosubcdhd.img, I zipped it and send it to /images/dosubcdhd.igz, freedos is still not bootable. Have you tried it out?
I added the files, rezip it as dosubcdhd.img.gz, copy it to /images/dosubcd.igz, but freedos still doesn't start up in UBCD. Is my way wrong?
Without any additional files added in dosubcdhd.img, I zipped it and send it to /images/dosubcdhd.igz, freedos is still not bootable. Have you tried it out?
Download it again and follow every instruction.
If you have done the bzip2 -dc dosubcdhd.img.tar.bz2 | tar xvf - step, you should get an image file dosubcdhd.img.
The output of the previous command should be: a37b854149b4649e763661419c647abf dosubcdhd.img
If not, there is something wrong with the download.
Use this file as a hard disk image for booting in a virtual machine (e.g. in qemu, virtualbox, vmware). It should boot (It worked for me). If this works, stop the virtual machine and go further with the instructions.
Test the file again in a virtual machine when you have added your files and you have unmounted the image.
If you gzip the image file, rename the gzipped file to dosubcd.igz when you copy it to /images of the ubcd folder.
I don't know if it matters, but I have updated all the isolinux files (isolinux.bin, memdisk, menu.c32, chain.c32). For you, memdisk maybe have to be updated.
See for the relevant part at viewtopic.php?t=1350.
There is also a free tool called ImDisk Virtual Disk Driver which is able to mount hard disk images under windows.
See: http://www.ltr-data.se/opencode.html#ImDisk
If you have done the bzip2 -dc dosubcdhd.img.tar.bz2 | tar xvf - step, you should get an image file dosubcdhd.img.
Code: Select all
md5sum dosubcdhd.img
If not, there is something wrong with the download.
Use this file as a hard disk image for booting in a virtual machine (e.g. in qemu, virtualbox, vmware). It should boot (It worked for me). If this works, stop the virtual machine and go further with the instructions.
Test the file again in a virtual machine when you have added your files and you have unmounted the image.
If you gzip the image file, rename the gzipped file to dosubcd.igz when you copy it to /images of the ubcd folder.
I don't know if it matters, but I have updated all the isolinux files (isolinux.bin, memdisk, menu.c32, chain.c32). For you, memdisk maybe have to be updated.
See for the relevant part at viewtopic.php?t=1350.
There is also a free tool called ImDisk Virtual Disk Driver which is able to mount hard disk images under windows.
See: http://www.ltr-data.se/opencode.html#ImDisk
-
- Posts: 19
- Joined: Fri Jun 13, 2008 11:06 am
I tried Imdisk in Windows XP, but when I mounted dosubcdhd.img, its file system could not be recognized.
I tried WinImage and added files to dosubcdhd.img, its not bootable from UBCD.
I tried to mount the image in SLAX following your instruction, SLAX said ./dosubcdhd is busy. When I opened the ./dosubcdhd, nothing was there.
Neither was 'mount -o loop' working, too.
I am not familiar with the DOS emulator too>_< If there's any chance, could you please tell me what emulator you are using and how do you emulate your image file and see if it's bootable? Thank you very very much for your time~~~~
I tried WinImage and added files to dosubcdhd.img, its not bootable from UBCD.
I tried to mount the image in SLAX following your instruction, SLAX said ./dosubcdhd is busy. When I opened the ./dosubcdhd, nothing was there.
Neither was 'mount -o loop' working, too.
I am not familiar with the DOS emulator too>_< If there's any chance, could you please tell me what emulator you are using and how do you emulate your image file and see if it's bootable? Thank you very very much for your time~~~~
here's how to (and no, you don't need linux):
download a bootable disk image of your desired size from here
extract image using either unrar/7zip (or similar). can't remember which (might require both).
use winimage to inject the files you wish to use (in this instance those from dosubcd) into the downloaded bootdisk from above.
save it.
place back in ISO (/images or /custom)
edit the appropriate *.cfg file in /menus from where you'll be launching the boot disk from.
example:
where "fd011520.img" is the name of your image
c(cylinders),h(heads),s(sectors). the above is for an 11520KB image. you can change these values to suit your boot image (use winimage to view the setting you require -> menu ->image -> change format... -> select custom image format -> ok)
you don't need to apply any changes to the image itself.
that's it.
download a bootable disk image of your desired size from here
extract image using either unrar/7zip (or similar). can't remember which (might require both).
use winimage to inject the files you wish to use (in this instance those from dosubcd) into the downloaded bootdisk from above.
save it.
place back in ISO (/images or /custom)
edit the appropriate *.cfg file in /menus from where you'll be launching the boot disk from.
example:
Code: Select all
LABEL fd
MENU LABEL FreeDOS BootDisk
KERNEL memdisk
APPEND initrd=/images/fd011520.img c=240 h=8 s=36 floppy
c(cylinders),h(heads),s(sectors). the above is for an 11520KB image. you can change these values to suit your boot image (use winimage to view the setting you require -> menu ->image -> change format... -> select custom image format -> ok)
you don't need to apply any changes to the image itself.
that's it.
Go to the ImDisk Virtual Disk Driver in the control panel and start it.hoohooslax wrote:I tried Imdisk in Windows XP, but when I mounted dosubcdhd.img, its file system could not be recognized.
Click on "mount new..."
Mount new virtual disk:
- Image file: dosubcdhd.img
Drive Letter: Choose one
Size of virtual disk: (current image file size)
Image file offset (for non-raw disk image file formats):
32256 (in bytes)
(this offset is needed to tell Imdisk to skip the mbr and the first sector of the harddrive image, after this 32256 bytes the partition with freedos "begins. In linux the "losetup -o 32256 /dev/loop0 dosubcdhd.img" command skips this bytes also.
In this case (and in general also), the first partition starts at sector 63. Knowing the sector size (standard is 512 bytes), we can easily calculate the offset in bytes to the first partition: 512 * 63 = 32256.)
Device type: Harddisk volume
I have never used it, but normally it should work with this program also. It is able to modify harddisk images. I haven't test it, it is shareware so you can use it only 30 days for free which sucks. Use Imdisk instead. I have tested it and it works definitely.hoohooslax wrote:I tried WinImage and added files to dosubcdhd.img, its not bootable from UBCD.
* Supports the creation of large images of removable and hard disks under Windows NT and Windows 95. Large images (> 2.88 MB) are not loaded into memory, read and write operations are done directly on image files.
Try it again. I have just copied al the instructions, that I have written down in the first post, to the terminal on a different PC. And everything worked. Are you sure that you didn't cd to ./dosubcdhd two times before mounting the image? It can be, however that slax doesn't support every command.hoohooslax wrote:I tried to mount the image in SLAX following your instruction, SLAX said ./dosubcdhd is busy. When I opened the ./dosubcdhd, nothing was there.
Neither was 'mount -o loop' working, too.
Try the next:
Code: Select all
ls /dev/loop*

/dev/loop0 /dev/loop2 /dev/loop4 /dev/loop6
/dev/loop1 /dev/loop3 /dev/loop5 /dev/loop7
I don't use a DOS emulator. I use QEMU, which is virtual machine (available for linux, windows, Mac OS X, OpenSolaris). Normally it is only a command line tool ,but for linux at least in ubuntu you can use "Qemu Launcher" or "Qemulator" as GUI for QEMU. "Qemu Manager" is a GUI for QEMU if you use windows.hoohooslax wrote:I am not familiar with the DOS emulator too>_< If there's any chance, could you please tell me what emulator you are using and how do you emulate your image file and see if it's bootable? Thank you very very much for your time~~~~
Download QEMU:
See: http://bellard.org/qemu/download.html
Qemu Manager (GUI for Qemu for windows):
See: http://www.davereyn.co.uk/download.htm
Add the harddrive image as hard disk to QEMU.
I hope that this explanation helps and that you can get the image working. I checked the whole tutorial and it worked perfect for me. After adding files to the image, the image is still bootable in my case so normally it should work. I added 2 files to it thought Imdisk and 1 via linux and it was always bootable. I tested the tutorial on 2 different pc's. If you have problems, don't hesitate to ask.
@as702
Hoohooslax tried to do it with winimage and didn't succeed.
"ImDisk Virtual Disk Driver" is probably the easiest way to add files to an existing image in windows because the image just appears in explorer as extra drive letter.
QEMU can be run without admin privileges (useful for on an usb stick), but it is slow. If you have admin privileges you can install KQEMU (linux) or QEMU Accelerator (windows), which makes it possible to run user mode code directly on the host computer's CPU, and using processor and peripheral emulation only for kernel mode and real mode code, which speed up the the process significantly..
Hoohooslax tried to do it with winimage and didn't succeed.
So probably winimage isn't that simple at first glance.hoohooslax wrote:I tried WinImage and added files to dosubcdhd.img, its not bootable from UBCD.

"ImDisk Virtual Disk Driver" is probably the easiest way to add files to an existing image in windows because the image just appears in explorer as extra drive letter.
QEMU can be run without admin privileges (useful for on an usb stick), but it is slow. If you have admin privileges you can install KQEMU (linux) or QEMU Accelerator (windows), which makes it possible to run user mode code directly on the host computer's CPU, and using processor and peripheral emulation only for kernel mode and real mode code, which speed up the the process significantly..
For more information: http://en.wikipedia.org/wiki/QEMUKQEMU
Fabrice BelQEMU Acceleratorlard also wrote a Linux kernel module (with preliminary ports to FreeBSD and MS Windows) named KQEMU or QEMU Accelerator, which notably speeds up x86 emulation on x86 platforms. This is accomplished by running user mode code directly on the host computer's CPU, and using processor and peripheral emulation only for kernel mode and real mode code. KQEMU also supports a kernel emulation mode in which portions of kernel mode code run on the host's CPU.
Unlike KVM, KQEMU can execute code from many guest OSes even if the host CPU does not support hardware virtualization. KQEMU supports both x86 and x86_64 CPUs. As a future development[3] for KQEMU there are plans to support the hardware(CPU) based virtualization extensions introduced by Intel VT and AMD-V families of processors. The increased speed is not expected to be significant so perhaps more important is the plan to include support of SMP for "guest" OS.
@cube
yes, but he hadn't tried my explicit method (i had a similar problem).

whatever works, best of luck to him(?).
Qemu sounds interesting. i'll admit, i did try it out shortly after the post (thanks for the link btw). i agree, it is rather slow and a bit more cumbersome to get up and running than the aforementioned alternatives (at least on windows platform).
vmware is probably the fastest i've come across thus far (albeit it's a bit of a mess). for bog standard unix/linux/dos/winpe bootdiscs, i tend find vpc2007 is quite robust.
yes, but he hadn't tried my explicit method (i had a similar problem).

whatever works, best of luck to him(?).
Qemu sounds interesting. i'll admit, i did try it out shortly after the post (thanks for the link btw). i agree, it is rather slow and a bit more cumbersome to get up and running than the aforementioned alternatives (at least on windows platform).
vmware is probably the fastest i've come across thus far (albeit it's a bit of a mess). for bog standard unix/linux/dos/winpe bootdiscs, i tend find vpc2007 is quite robust.
@as702
VirtualBox is also a very good emulator. It runs on Windows (NT 4.0, 2000, XP, Server 2003, Vista), DOS/Windows 3.x, Linux (2.4 and 2.6), and OpenBSD. It is comparable in speed with VMware and you don't have to register to get a key. I use VirtualBox to run Windows on Ubuntu and it is fast enough for me.
http://www.virtualbox.org/
I use qemu-launcher most of the time to test a simple iso like ubcd or a small live linux distro because it is very easy to select the amount of ram to use and the iso you want to boot without to edit a complete virtual machine like you have to do with vmware, virtualbox and Qemu (Qemu Manager).
VirtualBox is also a very good emulator. It runs on Windows (NT 4.0, 2000, XP, Server 2003, Vista), DOS/Windows 3.x, Linux (2.4 and 2.6), and OpenBSD. It is comparable in speed with VMware and you don't have to register to get a key. I use VirtualBox to run Windows on Ubuntu and it is fast enough for me.
http://www.virtualbox.org/
I use qemu-launcher most of the time to test a simple iso like ubcd or a small live linux distro because it is very easy to select the amount of ram to use and the iso you want to boot without to edit a complete virtual machine like you have to do with vmware, virtualbox and Qemu (Qemu Manager).
-
- Posts: 19
- Joined: Fri Jun 13, 2008 11:06 am
Thanks a lot as702! Your method works! But when I tried to expand the 11M image, it didn't boot again! Do I need to change the c, h, s value accordingly? If you have a clue, please let me know.as702 wrote:where "fd011520.img" is the name of your imageCode: Select all
LABEL fd MENU LABEL FreeDOS BootDisk KERNEL memdisk APPEND initrd=/images/fd011520.img c=240 h=8 s=36 floppy
c(cylinders),h(heads),s(sectors). the above is for an 11520KB image. you can change these values to suit your boot image (use winimage to view the setting you require -> menu ->image -> change format... -> select custom image format -> ok)
Also, I tried to download the 50MB image from the link you provided. I use WINRAR to unzip it to fd500000.ima. However, I couldn't make change to this file in WinImage Unregistered version. Could you please tell me how do you make it editable? Many Thanks!!!
no worries, pal. when you say "expand" do you mean you're trying to change the image size in winimage? if so, then i'm not sure since whenever i've tried this method the image always fails to boot (winimage can prove buggy). what i usually do is resort to downloading the image size i need from the link i provided.Thanks a lot as702! Your method works! But when I tried to expand the 11M image, it didn't boot again! Do I need to change the c, h, s value accordingly? If you have a clue, please let me know.
c,h and s values typically go as follows:
for 005760
for 115200c=240 h=4 s=36
for 050000 it would be:c=240 h=8 s=36
i've tested the 50mb image with these settings and can confirm it DOES work.c=2 h=255 s=63

hmmm...you could try registering your version of winimage. other than that i'm not too familiar with what else is out there.Also, I tried to download the 50MB image from the link you provided. I use WINRAR to unzip it to fd500000.ima. However, I couldn't make change to this file in WinImage Unregistered version. Could you please tell me how do you make it editable? Many Thanks!!!
-
- Posts: 19
- Joined: Fri Jun 13, 2008 11:06 am
as702:
Thanks man! You nailed it! I wonder where do you get the number of the cylinders? I tried to go to Change Format->select custom image format, but it only shows heads and sectors, no info about cylinders?
Icecube:
Thanks for all the tips and tools you provided. They all help me a lot. I enjoy using imgdisk a lot! Many thanks!
Thanks man! You nailed it! I wonder where do you get the number of the cylinders? I tried to go to Change Format->select custom image format, but it only shows heads and sectors, no info about cylinders?
Icecube:
Thanks for all the tips and tools you provided. They all help me a lot. I enjoy using imgdisk a lot! Many thanks!
hoohooslax wrote:as702:
Thanks man! You nailed it! I wonder where do you get the number of the cylinders? I tried to go to Change Format->select custom image format, but it only shows heads and sectors, no info about cylinders?
Code: Select all
capacity = cylinders * number of heads per cylinder * number of sectors per head * 512
if i remember correctly, "sectors per cluster" = cylinder(s)