PDA

View Full Version : Create a Linux boot disk with mkbootdisk



gonzalo76
10th April 2004, 12:58 AM
If you forgot to make a boot disk during the Fedora Core 1 Installation process or mayble you lose it, this how to is just for you.

How to create a boot disk in Linux

The command you'll use to make the boot disk is 'mkbootdisk'. The mkbootdisk can only be executed from a command prompt, that's why you'll have to open a terminal.

1. The first step is to find your running kernel version on the machine. This number has to be exact 'cause it's required by mkbootdisk command. To find the number type: uname -r
Like this:

[root@pc-gonzalo root]# uname -r
2.4.22-1.2174.nptl (Thank you ghenry for this)

2. Log on as root with 'su -' command if you are not already logged on, you'll also need to enter the root password.

[gonzalo@pc-gonzalo gonzalo]$ su -
Password:
[root@pc-gonzalo root]#

3. Make sure that /dev/fd0 is unmounted. To check this type: mount and check if your floppy drive is mounted or not.
If it is mounted, unmount it with the 'umount' command like this:

[root@pc-gonzalo root]# umount /dev/fd0

4. Create the boot disk
Label a floppy disk Linux Boot Disk and place it in the drive. Attention, mkbootdisk will erase and replace all information on the disk.
At the root command prompt enter the mkbootdisk command using the kernel number you obtained before. Like this:

[root@pc-gonzalo root]# /sbin/mkbootdisk 2.4.22-1.2174.nptl

IMPORTANT
You'll have to use the full pathname for the command. Without the full pathname, you'll received a 'Command Not Found' message. With "su", instead of "su -" you did not load roots paths, i.e. "su -" loads roots bash_profile, which tells bash that you can run commands from /sbin/. (Thank you ghenry for this ;))

After pressing [Enter], the following message is displayed:
Insert a disk in /dev/fd0. Any information on the disk will be lost.
Press<ENTER> to continue or ^C to abort:

At this point, press [Enter] to confirm. After mkbootdisk copies the kernel and all other necessary programs to the disk, the command prompt will return.

mkbootdisk copies the following files to the floppy disk:
boot.msg
initrd.img
ldlinux.sys
syslinux.cfg
vmlinuz

boot.msg script:
Press <return> (or wait 10 seconds) to boot your Red Hat Linux system from
/dev/hda5. You may override the default linux kernel parameters by typing
"linux <params>", followed by <return> if you like.


Of course, I edited this script to:
Press <return> (or wait 10 seconds) to boot your Fedora Core Linux system from
/dev/hda5. You may override the default linux kernel parameters by typing
"linux <params>", followed by <return> if you like. Have a Fedora day !!! :p

syslinux.cfg script:
default linux
prompt 1
display boot.msg
timeout 100
label linux
kernel vmlinuz
append initrd=initrd.img ro hdc=ide-scsi apm=off acpi=on root=/dev/hda5

NOTE
/dev/hda5 is where I have the Fedora's boot partition

Don’t forget to test your boot disk !!! ;)

More info at TechRepublic (http://techrepublic.com.com/5100-6270-1043573.html)

This method does not work for Fedora Core 2 and 3.
You'll receive an error message like this one:

[root@linux root]# /sbin/mkbootdisk 2.6.5-1.358
Insert a disk in /dev/fd0. Any information on the disk will be lost.
Press <Enter> to continue or ^C to abort:
cp: writing `/tmp/mkbootdisk.Vm3185/initrd.img': No space left on device
cat: write error: No space left on device
cat: write error: No space left on device
20+0 records in
20+0 records out


For Fedora Core 3
Installing GRUB on a floppy disk

# /sbin/grub-install /dev/fd0

# /sbin/grub-install /dev/fd0
Installation finished. No error reported.
This is the contents of the device map /boot/grub/device.map.
Check if this is correct or not. If any of the lines is incorrect,
fix it and re-run the script `grub-install'.

# this device map was generated by anaconda
(fd0) /dev/fd0
(hd0) /dev/hda
Everytime you install a new kernel you'll need to update your floppy disk running "/sbin/grub-install /dev/fd0" again.

mhelios
10th April 2004, 01:22 AM
Great info gonzalo76.

One point to remember is that this boot floppy will only work with the kernel you currently have installed.

So if you still have a boot floppy disk from the original FC1 installation (2115 version), it's time to follow this HOWTO to update your floppy with the latest (2174) files.

gonzalo76
10th April 2004, 02:44 AM
Oh sure, I forgot that.
Thank you !
greetings
gonzalo

tux2furious
22nd June 2004, 02:50 PM
fyi, to simplify a bit:

/sbin/mkbootdisk `uname -r`

gonzalo76
22nd June 2004, 03:17 PM
fyi, to simplify a bit:

/sbin/mkbootdisk `uname -r`

You forgot to unmount the floppy device first

Anyway, here in Linux, there are multiple ways to make the same thing.
The user is the one who decides which one to choose.

niloshima
22nd June 2004, 05:19 PM
I just tryed the things u have ask me to do. but i get some mesages like
20+0 records in
20+0 records out
when i put my FDD to the drive an f when i execuite the
[root@localhost proporta]# /sbin/mkbootdisk 2.4.22-1.2115.nptl


Please help me

tux2furious
22nd June 2004, 05:38 PM
Have you read the instructions above?

Anyway,
1) # su -
2) # /sbin/mkbootdisk `uname -r`

Results:
[root@fedora root]# /sbin/mkbootdisk `uname -r`
Insert a disk in /dev/fd0. Any information on the disk will be lost.
Press <Enter> to continue or ^C to abort:
20+0 records in
20+0 records out
[root@fedora root]#

foolish
23rd June 2004, 01:03 AM
Great guide there. Good work.

(this is where we all press the scale and add to gonzalo76s reputation.)

imdeemvp
23rd June 2004, 04:29 PM
i am sorry this does not work with FC2! :mad: it only works for FC1!!

tux2furious
23rd June 2004, 04:36 PM
i am sorry this does not work with FC2! :mad: it only works for FC1!!

still can't get it work huh?

i'm using FC2, and it's working fine...

better not say "does not work with FC2"
should say "does not work on my FC2 machine"
;)

niloshima
23rd June 2004, 11:41 PM
Please some tell me why i am getting

20+0 records in
20+0 records out

I do not unstand.


am i doing this correcr way?:(

Here is the things i can see in the teminal


[proporta@localhost proporta]$ su
Password:
[root@localhost proporta]# uname -r
2.4.22-1.2115.nptl
[root@localhost proporta]# mount
/dev/hda7 on / type ext3 (rw)
none on /proc type proc (rw)
none on /dev/pts type devpts (rw,gid=5,mode=620)
usbdevfs on /proc/bus/usb type usbdevfs (rw)
/dev/hda6 on /boot type ext3 (rw)
none on /dev/shm type tmpfs (rw)
[root@localhost proporta]# /sbin/mkbootdisk 2.4.22-1.2115.nptl
Insert a disk in /dev/fd0. Any information on the disk will be lost.
Press <Enter> to continue or ^C to abort:
20+0 records in
20+0 records out
[root@localhost proporta]# /sbin/mkbootdisk `uname -r`
Insert a disk in /dev/fd0. Any information on the disk will be lost.
Press <Enter> to continue or ^C to abort:
20+0 records in
20+0 records out
[root@localhost proporta]# :

tux2furious
23rd June 2004, 11:50 PM
that is not error. try put in that boot disk and restart your computer...
make sure your floppy priority in bios is higher than your hard drive

i'm also not sure what is 20+0 records in and out...

niloshima
24th June 2004, 12:20 AM
I tryed from ths boot disk i have made but got a error Boot Failed

ghenry
24th June 2004, 12:31 AM
Yes, you have only written 20 blocks.

Type:

info coreutils dd for more info

I would try a different method.

ghenry
24th June 2004, 01:08 AM
Hi
thanks for helping me. but i do not undsand the way to it.

Please help me

what version have mkbootdisk do you have?

rpm -q mkbootdisk

mkbootdisk-1.5.1-1.1 for me.

niloshima
24th June 2004, 01:34 AM
Hi i have this one

mkbootdisk-1.5.1-1
THanks

zabbadu
26th June 2004, 10:48 AM
Maybe it's because I've gone through all the other documentation on all the other sites, plus about 8 install attempts but..

Really, all I wanted to do was get a boot diskette made, just like I did after RH9's install process. [Wondering why FC2 didn't include this nice feature - *sigh* oh well.]

Anyway, what I've experienced is: hda is for XP, hdg is for FC2. I allowed GRUB to be installed. After I rebooted, I got the GRUB geom error. Which wouldn't be such a problem, except that I don't have a boot disk.

So, I've gone into the rescue cd, which boots me into sh. I tried

mkbootdisk --device /dev/fd0 2.6

per the command line instructions after entering just mkbootdisk. The message received was something like module doesn't exist in ...

Since I've gone through so many reboots trying to get this to work, I cannot remember all that I've tried. Can't say for sure that I was su - or not, but I definitely didn't do

mkbootdisk 'uname -r'

I'll try that, but I'm a little wary.. I'll keep you posted (yeah, I'm sure everyone here just can't wait to know the results) 'cause I may need more instruction afterwards..

zabbadu!

cyberwufff
30th August 2004, 02:15 PM
Hi there! I made all the steps in the recovery mode and it worked until I've got a message that said that the floppy drive can only be read. I changed the floppy so it can be written but it still doesn't work. What do I have to do now? :confused: :confused: :confused: Plz help me! I'm distressed! : >

DaPi
7th September 2004, 09:14 PM
It would seem that with my FC2, the boot image won't fit on a floppy!


[root@linux root]# uname -r
2.6.5-1.358

[root@linux root]# umount /dev/fd0
umount: /dev/fd0: not mounted

[root@linux root]# /sbin/mkbootdisk 2.6.5-1.358
Insert a disk in /dev/fd0. Any information on the disk will be lost.
Press <Enter> to continue or ^C to abort:
cp: writing `/tmp/mkbootdisk.Vm3185/initrd.img': No space left on device
cat: write error: No space left on device
cat: write error: No space left on device
20+0 records in
20+0 records out

[root@linux root]# ls -Al /mnt/floppy
total 1430
-rwxr-xr-x 1 root root 0 Sep 7 21:42 boot.msg
-rwxr-xr-x 1 root root 257024 Sep 7 21:42 initrd.img
-r-xr-xr-x 1 root root 8104 Sep 7 21:42 ldlinux.sys
-rwxr-xr-x 1 root root 0 Sep 7 21:42 syslinux.cfg
-rwxr-xr-x 1 root root 1199031 May 8 15:21 vmlinuz

[root@linux tmp]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/hda1 2464432 2157060 182180 93% /
/dev/sda1 2023920 1908936 12172 100% /mnt/scsi
/dev/fd0 1430 1430 0 100% /mnt/floppy

imdeemvp
7th September 2004, 11:25 PM
what version have mkbootdisk do you have?

rpm -q mkbootdisk

mkbootdisk-1.5.1-1.1 for me.


i have same and still not been able to make a floppy in fc2.......i dont understand why tux2furios says it works in fc2....as far as i know the kernel image is too big for a floppy.

i agree it works in fc1 but not fc2.

superbnerd
7th September 2004, 11:29 PM
I wander if there is a better compression to use like bzip2 instead of bzip (unless they are the same). simple solutions

linusrees
8th September 2004, 03:32 PM
Hi

If you are having a problem making a boot floppy -- like I did -- then you can make a boot cd with the -iso option. (I don't think all the files can fit on a 1.44 floppy.)

As stated ealier. Find out your active Kernel

[root@fedora linus]# uname -r
2.6.7-1.494.2.2

Then create the cd with:

[root@fedora linus]# /sbin/mkbootdisk --verbose --iso --device /root/boot.iso 2.6.7-1.494.2.2
Installing isolinux... done
Copying /boot/vmlinuz-2.6.7-1.494.2.2... done.
Copying /boot/initrd-2.6.7-1.494.2.2.img... done.
Configuring bootloader... done.

This command asks mkbootdisk to use its verbose mode to tell you what it's doing and then to create an iso image called boot.iso in the /root directory.

Simply burn this image to a cd-r or cd-rw with K3B or your favourite burning app and boot from it.

FYI using:

[root@fedora linus]# /sbin/mkbootdisk --verbose --iso --device /root/boot.iso 'uname -r'

failed for me, and I can't explain why. So you may have to write the kernel version out in full.

HTH

Linus

DaPi
8th September 2004, 06:05 PM
Linus,

Thanks for the CD method.


Linus & zabbadu,

I think you'll find those need to be "back quotes" aound `uname -r` not "straight" ones as you have posted. (technically they're grave accents)

imdeemvp
8th September 2004, 07:46 PM
agree nice info.......now for every kerne a new cd? i guess is worth the try.

DaPi
8th September 2004, 07:59 PM
agree nice info.......now for every kerne a new cd? i guess is worth the try. Well, these days a CD costs about the same as a floppy . . . just seems a waste to have 698Mb unused :)

superbnerd
8th September 2004, 09:11 PM
or just use an cd-rw ;)

imdeemvp
9th September 2004, 07:16 AM
superbnerd,

that makes sense....

linusrees
10th September 2004, 08:56 AM
Hi

Thanks for pointing this out (I need new glasses)



I think you'll find those need to be "back quotes" aound `uname -r` not "straight" ones as you have posted. (technically they're grave accents)

Worked for me:

[root@fedora linus]# /sbin/mkbootdisk --verbose --iso --device /root/boot2.iso `uname -r`
Installing isolinux... done
Copying /boot/vmlinuz-2.6.7-1.494.2.2... done.
Copying /boot/initrd-2.6.7-1.494.2.2.img... done.
Configuring bootloader... done.

Size of boot image is 4 sectors -> No emulation

Linus
:)

bmupton
31st October 2004, 12:07 AM
Hi

If you are having a problem making a boot floppy -- like I did -- then you can make a boot cd with the -iso option. (I don't think all the files can fit on a 1.44 floppy.)

As stated ealier. Find out your active Kernel

[root@fedora linus]# uname -r
2.6.7-1.494.2.2

Then create the cd with:

[root@fedora linus]# /sbin/mkbootdisk --verbose --iso --device /root/boot.iso 2.6.7-1.494.2.2
Installing isolinux... done
Copying /boot/vmlinuz-2.6.7-1.494.2.2... done.
Copying /boot/initrd-2.6.7-1.494.2.2.img... done.
Configuring bootloader... done.

This command asks mkbootdisk to use its verbose mode to tell you what it's doing and then to create an iso image called boot.iso in the /root directory.

Simply burn this image to a cd-r or cd-rw with K3B or your favourite burning app and boot from it.

FYI using:

[root@fedora linus]# /sbin/mkbootdisk --verbose --iso --device /root/boot.iso 'uname -r'

failed for me, and I can't explain why. So you may have to write the kernel version out in full.

HTH

Linus

I've made a cd with this method. I'm sure it will work...if I could boot the thing. I've only got a SCSI cd-rom device, and my BIOS will not let me boot from it. Is there a way to boot from a floppy that automatically fires up the boot from the cd-rom?

TIA,
-Brent

not2fast
18th January 2005, 04:40 AM
What if I can't boot after my install? Does the boot disk have to come from my install or will any base fc3 boot disk work? If so where can I get one?

Void Main
18th January 2005, 07:22 AM
For those that can't boot off CD you can install grub or LILO on a floppy to bootstrap a kernel you have on CD. Personally, there is nothing I haven't been able to recover from using rescue mode so I don't even bother creating boot floppies/CDs anymore. Of course you'll need to be able to boot the rescue CD to do that.

not2fast
18th January 2005, 06:09 PM
So what is rescue mode exactly?

I created a boot image from the bootimage.iso on FC3 D1. It boots into what looks like the initial screen. So how to I get it to boot my freshly installed FC3?

biffle
1st February 2005, 04:28 PM
it seems that my problem is that there is no file mkbootdsk anywhere in my distribution (which works nicely otherwise). Can this be downloaded from somewhere?

markp4289
7th May 2005, 03:34 AM
Ok guys;
I modified the mkbootdisk to copy the ks.cfg file I made for my system, how do I re-install the os using the ks file.

markp4289 " always :) cuz :( never helps "

arjunmallik
13th July 2005, 07:14 AM
Hi ,
I have followed the beflow procedure and tried to create a boot floppy.

/sbin/grub-install /dev/fd0

the above command is successful.

But with this floppy iam not able to boot the sysetem.

Are there any other steps to be followed.

After this what i need to do to boot the systm with the floppy.

Please guide me.

varun
23rd April 2006, 07:49 AM
If you forgot to make a boot disk during the Fedora Core 1 Installation process or mayble you lose it, this how to is just for you.

How to create a boot disk in Linux

The command you'll use to make the boot disk is 'mkbootdisk'. The mkbootdisk can only be executed from a command prompt, that's why you'll have to open a terminal.

1. The first step is to find your running kernel version on the machine. This number has to be exact 'cause it's required by mkbootdisk command. To find the number type: uname -r
Like this:

[root@pc-gonzalo root]# uname -r
2.4.22-1.2174.nptl (Thank you ghenry for this)

2. Log on as root with 'su -' command if you are not already logged on, you'll also need to enter the root password.

[gonzalo@pc-gonzalo gonzalo]$ su -
Password:
[root@pc-gonzalo root]#

3. Make sure that /dev/fd0 is unmounted. To check this type: mount and check if your floppy drive is mounted or not.
If it is mounted, unmount it with the 'umount' command like this:

[root@pc-gonzalo root]# umount /dev/fd0

4. Create the boot disk
Label a floppy disk Linux Boot Disk and place it in the drive. Attention, mkbootdisk will erase and replace all information on the disk.
At the root command prompt enter the mkbootdisk command using the kernel number you obtained before. Like this:

[root@pc-gonzalo root]# /sbin/mkbootdisk 2.4.22-1.2174.nptl

IMPORTANT
You'll have to use the full pathname for the command. Without the full pathname, you'll received a 'Command Not Found' message. With "su", instead of "su -" you did not load roots paths, i.e. "su -" loads roots bash_profile, which tells bash that you can run commands from /sbin/. (Thank you ghenry for this ;))

After pressing [Enter], the following message is displayed:
Insert a disk in /dev/fd0. Any information on the disk will be lost.
Press<ENTER> to continue or ^C to abort:

At this point, press [Enter] to confirm. After mkbootdisk copies the kernel and all other necessary programs to the disk, the command prompt will return.

mkbootdisk copies the following files to the floppy disk:
boot.msg
initrd.img
ldlinux.sys
syslinux.cfg
vmlinuz

boot.msg script:
Press <return> (or wait 10 seconds) to boot your Red Hat Linux system from
/dev/hda5. You may override the default linux kernel parameters by typing
"linux <params>", followed by <return> if you like.


Of course, I edited this script to:
Press <return> (or wait 10 seconds) to boot your Fedora Core Linux system from
/dev/hda5. You may override the default linux kernel parameters by typing
"linux <params>", followed by <return> if you like. Have a Fedora day !!! :p

syslinux.cfg script:
default linux
prompt 1
display boot.msg
timeout 100
label linux
kernel vmlinuz
append initrd=initrd.img ro hdc=ide-scsi apm=off acpi=on root=/dev/hda5

NOTE
/dev/hda5 is where I have the Fedora's boot partition

Don’t forget to test your boot disk !!! ;)

More info at TechRepublic (http://techrepublic.com.com/5100-6270-1043573.html)

This method does not work for Fedora Core 2 and 3.
You'll receive an error message like this one:

[root@linux root]# /sbin/mkbootdisk 2.6.5-1.358
Insert a disk in /dev/fd0. Any information on the disk will be lost.
Press <Enter> to continue or ^C to abort:
cp: writing `/tmp/mkbootdisk.Vm3185/initrd.img': No space left on device
cat: write error: No space left on device
cat: write error: No space left on device
20+0 records in
20+0 records out


For Fedora Core 3
Installing GRUB on a floppy disk

# /sbin/grub-install /dev/fd0

Everytime you install a new kernel you'll need to update your floppy disk running "/sbin/grub-install /dev/fd0" again.


helllo i got an error /tmp/mkbootdisk.cJ3184 permission denied

varun
23rd April 2006, 07:51 AM
helllo i got an error /tmp/mkbootdisk.cJ3184 permission denied


helllo i got an error /tmp/mkbootdisk.cJ3184 permission denied

wat shld i do...

varun
23rd April 2006, 07:52 AM
helllo i got an error /tmp/mkbootdisk.cJ3184 permission denied


helllo i got an error /tmp/mkbootdisk.cJ3184 permission denied

whn i was creating a boot disk

wat shld i do...

Stagea
28th June 2006, 03:11 PM
Hi ,
I have followed the beflow procedure and tried to create a boot floppy.
/sbin/grub-install /dev/fd0
the above command is successful.

But with this floppy iam not able to boot the sysetem.

I read this thread initially because I did not want to touch my MBR, I wanted to install FC4 and load it with a boot floppy when required. The information below may well be contained elsewhere here but I couldn't find it. I've had FC4 running for a day, and am coming from Win98. I think that the FC installer should definitely still make a boot floppy as part of the process for people who don't want to touch their MBR. I still don't know if I want to keep a linux partition, and I don't want the commitment/risk of GRUB on my MBR.

Anyway, seeing as the kernel is too big for a floppy now, the boot floppy will have to contain GRUB alone and information to find the kernel. The data GRUB needs to boot linux is:

root [location of linux primary partition in GRUB parlance]
kernel [kernel location] [kernel's partition in linux parlance]
initrd [initrd location]
boot

In my case this is:
root (hd1,1)
kernel /boot/vmlinuz-2.6.11-1.1369_FC4 root=/dev/hdb2
initrd /boot/initrd-2.6.11-1.1369_FC4.img
boot

My linux partition is the primary partition on my second drive, so that's (hd1,1) in GRUB speak, IIRC.

To find the other information I needed to boot with Knoppix. Once Knoppix was running I looked in /boot to find the full name of my kernel and initrd, and also it confirmed that my linux / partition was called hdb2 in linux speak. (Without Knoppix I had no way to look at what FC4 had installed on my disk as I had not installed GRUB on my MBR.)


So to summarise, now that you have GRUB boot floppy:

Download Knoppix ISO, burn Knoppix live CD, boot PC with live CD.
Find out name of linux / partition and full name/location of kernel and initrd.
Find out what GRUB calls your / partition (read GRUB manual if necessary)

Then use this information to boot FC. When satisfied, edit the file menu.lst on the GRUB boot floppy to include your information. My menu.lst now begins like this:

default 0
timeout 15
fallback 1

title Fedora Core 4
root (hd1,1)
kernel /boot/vmlinuz-2.6.11-1.1369_FC4 root=/dev/hdb2
initrd /boot/initrd-2.6.11-1.1369_FC4.img
boot

So now my GRUB floppy starts FC4, while my MBR remains untouched. I still think the installer should make a boot floppy anyway, regardless of whether GRUB goes on the MBR.

marisdembovskis
1st August 2006, 02:52 PM
Hey!
How to make boot-floppy for BIOS.
I have to put 3 files on the floppy, plus I need to make that floppy bootable.
Can I do it with mkbootdisk?

amfpg
12th March 2009, 10:23 AM
can i burn this into cd ?