LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-02-2020, 09:18 AM   #1
JockVSJock
Senior Member
 
Registered: Jan 2004
Posts: 1,420
Blog Entries: 4

Rep: Reputation: 164Reputation: 164
Question Confirm mbr.bin is working correctly for what it is needed for?


I tried using the search on Linux Questions for this and didn't find anything along with googling Linux Questions and my search terms and couldn't find anything.

How do I confirm that mbr.bin is good, working and able to do its job?

I can't even find mbr.bin under /dev/sda1 which points to /boot? So does this file really live under /dev/sda?

I'm prepping a removable SSD that is 512 GB in size and have created a boot partition under /dev/sdb1 with the size of 512 MB. I want to place mbr.bin under this directory in order to boot correctly.

I've used the following command to generate mbr.bin

Code:
dd if=/dev/sda of=/tmp/mbrsda.bak bs=512 count=1
I can use xxd to do a hexdump of the file

Code:
[root@foo tmp]# xxd mbrsda.bak 
0000000: eb63 9010 8ed0 bc00 b0b8 0000 8ed8 8ec0  .c..............
0000010: fbbe 007c bf00 06b9 0002 f3a4 ea21 0600  ...|.........!..
0000020: 00be be07 3804 750b 83c6 1081 fefe 0775  ....8.u........u
0000030: f3eb 16b4 02b0 01bb 007c b280 8a74 018b  .........|...t..
0000040: 4c02 cd13 ea00 7c00 00eb fe00 0000 0000  L.....|.........
0000050: 0000 0000 0000 0000 0000 0080 0100 0000  ................
0000060: 0000 0000 fffa 9090 f6c2 8074 05f6 c270  ...........t...p
0000070: 7402 b280 ea79 7c00 0031 c08e d88e d0bc  t....y|..1......
0000080: 0020 fba0 647c 3cff 7402 88c2 52be 057c  . ..d|<.t...R..|
0000090: b441 bbaa 55cd 135a 5272 3d81 fb55 aa75  .A..U..ZRr=..U.u
00000a0: 3783 e101 7432 31c0 8944 0440 8844 ff89  7...t21..D.@.D..
00000b0: 4402 c704 1000 668b 1e5c 7c66 895c 0866  D.....f..\|f.\.f
00000c0: 8b1e 607c 6689 5c0c c744 0600 70b4 42cd  ..`|f.\..D..p.B.
00000d0: 1372 05bb 0070 eb76 b408 cd13 730d 5a84  .r...p.v....s.Z.
00000e0: d20f 83de 00be 857d e982 0066 0fb6 c688  .......}...f....
00000f0: 64ff 4066 8944 040f b6d1 c1e2 0288 e888  d.@f.D..........
0000100: f440 8944 080f b6c2 c0e8 0266 8904 66a1  .@.D.......f..f.
0000110: 607c 6609 c075 4e66 a15c 7c66 31d2 66f7  `|f..uNf.\|f1.f.
0000120: 3488 d131 d266 f774 043b 4408 7d37 fec1  4..1.f.t.;D.}7..
0000130: 88c5 30c0 c1e8 0208 c188 d05a 88c6 bb00  ..0........Z....
0000140: 708e c331 dbb8 0102 cd13 721e 8cc3 601e  p..1......r...`.
0000150: b900 018e db31 f6bf 0080 8ec6 fcf3 a51f  .....1..........
0000160: 61ff 265a 7cbe 807d eb03 be8f 7de8 3400  a.&Z|..}....}.4.
0000170: be94 7de8 2e00 cd18 ebfe 4752 5542 2000  ..}.......GRUB .
0000180: 4765 6f6d 0048 6172 6420 4469 736b 0052  Geom.Hard Disk.R
0000190: 6561 6400 2045 7272 6f72 0d0a 00bb 0100  ead. Error......
00001a0: b40e cd10 ac3c 0075 f4c3 0000 0000 0000  .....<.u........
00001b0: 0000 0000 0000 0000 a68b 0e00 0000 8020  ............... 
00001c0: 2100 839f 0619 0008 0000 0040 0600 009f  !..........@....
00001d0: 0719 83fe ffff 0048 0600 0000 0008 00fe  .......H........
00001e0: ffff 83fe ffff 0048 0608 0000 7102 00fe  .......H....q...
00001f0: ffff 05fe ffff 0048 770a 0020 f969 55aa  .......Hw.. .iU.
[root@foo tmp]#
I'm just not familiar enough with this to figure out if its good or not.

Also I've run file against the mbr.bin file and its returning more partitions which I didn't expect.

Code:
[root@foo tmp]# file mbrsda.bak 
mbrsda.bak: x86 boot sector; partition 1: ID=0x83, active, starthead 32, startsector 2048, 409600 sectors; partition 2: ID=0x83, starthead 159, startsector 411648, 134217728 sectors; partition 3: ID=0x83, starthead 254, startsector 134629376, 40960000 sectors; partition 4: ID=0x5, starthead 254, startsector 175589376, 1777934336 sectors, code offset 0x63
 
Old 12-02-2020, 11:09 AM   #2
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,583
Blog Entries: 19

Rep: Reputation: 4454Reputation: 4454Reputation: 4454Reputation: 4454Reputation: 4454Reputation: 4454Reputation: 4454Reputation: 4454Reputation: 4454Reputation: 4454Reputation: 4454
I think mbr.bin is simply the Windows name for the master boot record of a traditional dos disk. This contains the bootloader (or its first stage in the case of GRUB) and the partition table. You will not find it listed under any of the partitions. It belongs to the disk as a whole (/dev/sda), but there is no filesystem for that. The mbr is a "magic space" that lies outside Linux altogether. You can of course copy its contents into a file using the dd command and call the copy mbr.bin or anything you like, and some people like to keep a backup copy of that sort just for safety.

A quick way to list your partition table is to use (as root) the command fdisk -l /dev/sda.

The best way to find out if the mbr is OK is to boot the computer! If it boots, you have nothing to worry about.
 
1 members found this post helpful.
Old 12-02-2020, 11:56 AM   #3
computersavvy
Senior Member
 
Registered: Aug 2016
Posts: 3,345

Rep: Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484
That file, as hazel said, is likely a copy of the MBR.
If the PC boots the MBR is good and a copy is not needed.
If using UEFI to boot then it could be a significant problem to do anything with it.

Your output of mbrsda.bak shows the partition table with each partition defined. That definitely is an MBR boot sector.
Altering the boot sector unnecessarily can break the drive access and booting.
 
1 members found this post helpful.
Old 12-02-2020, 12:53 PM   #4
JockVSJock
Senior Member
 
Registered: Jan 2004
Posts: 1,420

Original Poster
Blog Entries: 4

Rep: Reputation: 164Reputation: 164
This is what I'm trying to do high level: take a custom Linux ISO (RHEL), place it on a SSD and boot from it. Once it boots successfully, move that same SSD to another computer to prove it successfully boots.

I've not really worked with stuff like this in the past. To me, there are a lot of moving pieces to get this working correctly.

I have two partitions

/dev/sdb1 <------ set bootable via fdisk
/dev/sdb2 <---------- iso gets copied here from dd command

I've copied over the mbr.bin to /dev/sdb1 from the RHEL7 workstation that I'm working from.

When I run file command against the iso, I don't show a mbr/dos boot sector, but I do show (bootable) at the end.

The isoinfo command shows bootable too, but still not booting correctly.

Code:
[root@foo kickstart]# isoinfo -i foo.iso -d
CD-ROM is in ISO 9660 format
System id: LINUX
Volume id: foo
Volume set id: 
Publisher id: 
Data preparer id: 
Application id: GENISOIMAGE ISO 9660/HFS FILESYSTEM CREATOR (C) 1993 E.YOUNGDALE (C) 1997-2006 J.PEARSON/J.SCHILLING (C) 2006-2007 CDRKIT TEAM
Copyright File id: 
Abstract File id: 
Bibliographic File id: 
Volume set size is: 1
Volume set sequence number is: 1
Logical block size is: 2048
Volume size is: 4323253
El Torito VD version 1 found, boot catalog is in sector 980
CD-ROM uses ISO 9660:1999 relaxed format
Joliet with UCS level 3 found
Rock Ridge signatures version 1 found
Eltorito validation header:
    Hid 1
    Arch 0 (x86)
    ID ''
    Key 55 AA
    Eltorito defaultboot header:
        Bootid 88 (bootable)
        Boot media 0 (No Emulation Boot)
        Load segment 0
        Sys type 0
        Nsect 4
I just tried to boot off of this SSD and getting "Reboot and Select proper Boot device or Insert Boot Media in selected Boot device and press a key."

I know the ISO is good, because in KVM, I can create a VM, and boot off of this ISO so I know its good.
 
Old 12-02-2020, 04:34 PM   #5
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,716

Rep: Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899
Quote:
take a custom Linux ISO (RHEL), place it on a SSD and boot from it.
An ISO9660 filesystem is only bootable from a hard/flash drive if it is a hybrid ISO or you are using a bootloader like grub or one of the specialty ISO file bootloaders. What exactly is foo.iso i.e installer or live version etc. It is not an image file from a hard drive partition.

You can mount the file via a loop device and inspect its contents.
 
1 members found this post helpful.
Old 12-02-2020, 06:25 PM   #6
computersavvy
Senior Member
 
Registered: Aug 2016
Posts: 3,345

Rep: Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484
Quote:
Originally Posted by JockVSJock View Post
This is what I'm trying to do high level: take a custom Linux ISO (RHEL), place it on a SSD and boot from it. Once it boots successfully, move that same SSD to another computer to prove it successfully boots.

I've not really worked with stuff like this in the past. To me, there are a lot of moving pieces to get this working correctly.

I have two partitions

/dev/sdb1 <------ set bootable via fdisk
/dev/sdb2 <---------- iso gets copied here from dd command

I've copied over the mbr.bin to /dev/sdb1 from the RHEL7 workstation that I'm working from.

When I run file command against the iso, I don't show a mbr/dos boot sector, but I do show (bootable) at the end.

The isoinfo command shows bootable too, but still not booting correctly.

-------

I just tried to boot off of this SSD and getting "Reboot and Select proper Boot device or Insert Boot Media in selected Boot device and press a key."

I know the ISO is good, because in KVM, I can create a VM, and boot off of this ISO so I know its good.
Your method does not create a bootable drive.

You can do an install on one drive then move that drive to another PC and in most cases it will boot. Simply because the iso is copied onto the HDD or SSD does not make the HDD or SSD bootable.

Most of the files on that iso image are in rpm or other compressed format. Assuming that the iso is a live image or installer; Writing that iso image onto a USB using dd, or fedora media writer (or another tool that can put the iso image onto the device at low level) then booting from the USB and doing an install to the SSD should give you what you want.
 
1 members found this post helpful.
Old 12-02-2020, 07:19 PM   #7
JockVSJock
Senior Member
 
Registered: Jan 2004
Posts: 1,420

Original Poster
Blog Entries: 4

Rep: Reputation: 164Reputation: 164
Quote:
Originally Posted by michaelk View Post
only bootable from a hard/flash drive if it is a hybrid ISO or you are using a bootloader like grub or one of the specialty ISO file bootloaders. from a hard drive partition.
I'm not sure how to create a hybrid ISO? Use the isohybrid command?

I've tried a few isohybrid commands against this ISO, but still not successful. I'm pretty sure we are using mkisofs to make this iso, which from what I read online, is not correct to make a bootable ISO from USB/SSD.

I've also tried going the GRUB route too and wasn't successful here either. If you have any pointers or advise, then let me know.

thanks

Last edited by JockVSJock; 12-02-2020 at 07:22 PM.
 
Old 12-02-2020, 07:50 PM   #8
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,716

Rep: Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899
You need a linux system already installed.

https://www.howtogeek.com/196933/how...ur-hard-drive/
 
Old 12-02-2020, 09:42 PM   #9
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,353

Rep: Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590
Quote:
I know the ISO is good, because in KVM, I can create a VM, and boot off of this ISO so I know its good.
Quote:
/dev/sdb1 <------ set bootable via fdisk
/dev/sdb2 <---------- iso gets copied here from dd command
When you use dd to put iso on a dev you need to use whole device not a partition.
dd to /dev/sdb not /dev/sdb2. However this will make the drive read-only.

The other way is to create partitions and filesystems, mount the iso copy the contents over and install bootloader to the mbr. On uefi systems will need an esp partition.

Last edited by colorpurple21859; 12-02-2020 at 09:44 PM.
 
Old 12-03-2020, 07:25 AM   #10
JockVSJock
Senior Member
 
Registered: Jan 2004
Posts: 1,420

Original Poster
Blog Entries: 4

Rep: Reputation: 164Reputation: 164
Quote:
Originally Posted by colorpurple21859 View Post
When you use dd to put iso on a dev you need to use whole device not a partition.
dd to /dev/sdb not /dev/sdb2. However this will make the drive read-only.
I've tried this route too and when the ISO boots, I don't get a splash screen and the process locks up here:

Code:
[    15.034666] loop: module loaded
[    69.692875] random: crng init done

I'm using mkisofs to create the iso. Is this command no suited for bootable SSD media and only for bootable CDROMs/DVDs? If this is the case, what command should I be using to prepare this iso to use SSD instead?

Since I'm using a smaller SSD now, I'm not treating the iso with isohybrid either?

Last edited by JockVSJock; 12-03-2020 at 07:31 AM.
 
Old 12-03-2020, 08:13 AM   #11
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,353

Rep: Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590
I think you will need to use isohybrid on the iso
https://www.mankier.com/1/isohybrid
https://wiki.syslinux.org/wiki/index...itle=Isohybrid

Last edited by colorpurple21859; 12-03-2020 at 08:17 AM.
 
Old 12-03-2020, 09:58 AM   #12
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,716

Rep: Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899
[quote]I'm using mkisofs to create the iso. Is this command no suited for bootable SSD media and only for bootable CDROMs/DVDs? If this is the case, what command should I be using to prepare this iso to use SSD instead?[quote]

Your ISO file is bootable as a DVD/CD because it includes the El Torito boot code (Eltorito defaultboot header but it is not suitable for booting SSD media nor can you use dd to copy the ISO to a partition. Just not enough information about your custom ISO to know how to write it to disk.

I would try mounting the ISO and checking its contents to see if it looks like a regular OS. Create the appropriate partitions and filesystems on the empty drive and just copy the files over. Boot the ISO from a physical optical disk if possible, chroot to the hard drive and install grub. If your customized system does not have all of the grub tools you might be able to get away with using another live DVD.
 
Old 12-03-2020, 09:59 AM   #13
JockVSJock
Senior Member
 
Registered: Jan 2004
Posts: 1,420

Original Poster
Blog Entries: 4

Rep: Reputation: 164Reputation: 164
I've used the
Code:
 --partok
flag when using isohybrid when placing the iso under /dev/sdb1.

Since I'm using a smaller capacity SSD, won't need the
Code:
 --uefi
flag.

So looking at the --help options, I'm at a loss of what isohybrid commands to use against the .iso.

thanks
 
Old 12-03-2020, 11:01 AM   #14
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,353

Rep: Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590
Quote:
flag when using isohybrid when placing them iso under /dev/sdb1
The dd command should be
Code:
dd if=<path to iso> of=/dev/sdb bs=4M
The bs=4M is optional. Other than that as michaelk has alreaDY mentioned, not enough information about the layout of the iso.

Last edited by colorpurple21859; 12-03-2020 at 11:06 AM.
 
Old 12-04-2020, 04:36 PM   #15
JockVSJock
Senior Member
 
Registered: Jan 2004
Posts: 1,420

Original Poster
Blog Entries: 4

Rep: Reputation: 164Reputation: 164
Quote:
Originally Posted by michaelk View Post
Quote:
I'm using mkisofs to create the iso. Is this command no suited for bootable SSD media and only for bootable CDROMs/DVDs? If this is the case, what command should I be using to prepare this iso to use SSD instead?
Your ISO file is bootable as a DVD/CD because it includes the El Torito boot code (Eltorito defaultboot header but it is not suitable for booting SSD media nor can you use dd to copy the ISO to a partition. Just not enough information about your custom ISO to know how to write it to disk.
I kept locking my Linux Questions account at work, so I have to post this from home.

I used the genisofs command to generate the iso and dropped the El Torito flag, used the dd command to copy the .iso file over to /dev/sdb and this is the error message that I got when I tried to boot from it.

Code:
Reboot and select proper boot device or insert boot media in selected boot device and press a key
The isoinfo command didn't show a good status under Boot Media and the file command didn't show mbr/dos status.

EDIT: This is the command that I ran, where I removed the el-torito command

Code:
genisoimage -l -r -J -V "vol_name_goes_here" -b isolinux/isolinux.bin -no-emul-boot -boot-load-size 4 -boot-info-table -c isolinux/boot.cat -o /tmp/name_of_iso_here.iso -no-emul-boot .

Last edited by JockVSJock; 12-07-2020 at 07:49 AM.
 
  


Reply

Tags
dd, hexdump, mbr.bin



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Which program can boot a copy of the MBR (fake MBR) using mbr.bin Xeratul Linux - Software 6 12-03-2010 11:40 PM
echo $PATH = /home/g3rc4n/bin:/usr/local/bin:/usr/bin:/bin:/usr/games ? i_heart_pandas Linux - Software 7 09-18-2009 08:33 AM
sudo /usr/bin/chroot /home/chroot /bin/su - xxx| /bin/su: user xxx does not exist saavik Linux - General 3 07-04-2007 10:30 AM
How do I confirm if I installed NVIDIA driver correctly? Fear58 Linux - General 4 03-24-2006 10:38 AM
confirm clearance of trash bin pablovschby Linux - Software 3 03-03-2004 10:15 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:48 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration