LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   /dev/sda ? (https://www.linuxquestions.org/questions/linux-newbie-8/dev-sda-822028/)

hadimotamedi 07-25-2010 06:13 AM

/dev/sda ?
 
Dear All
I tried to install RedHat on my external usb disk from the installation cd.At the prompt, I typed 'expert' and tried to install RedHat on the external usb disk as /dev/sda. But when I reboot and choose to boot from the usb disk at the setup menu, it cannot boot. Can you please let me know how to make a bootable usb disk ?
Thank you

saikee 07-25-2010 06:26 AM

Red Hat uses Grub. Grub identifies a system to boot by the disk number and partition number.

When you install Red Hat you could have your internal hard disk as /dev/sda and the USB disk as /dev/sdb.

When you instruct the Bios to boot the USB disk first then Bios tells the boot loader the USB disk is now /dev/sda and the internal hard disk is /dev/sdb.

That means your original sda is now sdb. To Grub your original (hd0) and (hd1) has swapped positions.

Could this make sense to you? It would to me if you see no sign of Grub when trying to boot the USB disk.

hadimotamedi 07-25-2010 06:52 AM

When I installed RedHat, it showed my internal disk as /dev/hda and the usb disk as /dev/sda so I selected to install os on /dev/sda. Can you please confirm if it was a correct selection ?

saikee 07-25-2010 07:11 AM

That is the correct interpretation if you still run your Red Hat with a IDE disk but the disk order would still be

/dev/hda (hd0)
/dev/sda (hd1)

if you check /boot/grub/device.map of the Red Hat partition.

You did not elaborate the error but just said it could not boot so there is no way we could cure your problem with the information supplied.

According to your description you should should have installed Grub into the USB device so you should be able to see a Grub menu. When selecting Red Hat it fails to boot.

If it can't load the kernel or could not find the required partition because the disk order mismatches you can overcome it by asking Grub to swap the disk order on-the-fly with commands
Code:

map (hd0) (hd1)
map (hd1) (hd0)

If Grub loads the kernel but the Red Hat fails to boot, say with a kernel panic, then your Red Hat has not been configured to boot from a USB device.

If you see a Grub menu then you can investigate all the above and try to boot the system manually in a Grub prompt.

hadimotamedi 07-25-2010 07:21 AM

When I reboot the machine and then press 'Esc' and from the select boot device menu I select to boot from usb disk but I don't see any grub menu. But when I select to boot from internal disk I see the grub menu. Please let me know what can I do to correct it?

saikee 07-25-2010 08:17 AM

That means you have a Grub menu in the internal hard disk and not in the USB hard disk. This can be either your internal hard disk is a Sata so Red Hat calls it /dev/sda, as it does to mine, or your installating Grub in the USB disk was unsuccessful.

You can test the system in the following manner.

Tell the Bios you want the internal hard disk as 1st boot disk and get a booting Grub menu but do not select a system to boot. Instead you press the "c" key to drop into a terminal mode with a Grub prompt. If your Red Hat has a Graphic background then before you press the "c" key you may need to press the "esc" key to change it from a graphic to terminal mode first.

Ask Grub to tell you how many partition has a Grub configuration file by this command
Code:

find /boot/grub/menu.lst
Let say Grub return with one of the choice as (hd1,0) that means in the 1st partition of the 2nd hard disk as Grub counts from 0, then you can fire up this system by command
Code:

root (hd1,0)
configfile /boot/grub/menu.lst

Please do adjust the (hd1,0) according to what Grub reports in your case.

If you succeed in the above then you have installed the Red Hat in the second disk but it has no Grub in its MBR.

Let us know your progress for the next fix.

hadimotamedi 07-25-2010 10:54 PM

Please find below the system reply to your commands :
grub>find /boot/grub/menu.lst
ERROR 15: File not found
grub>root (hd1,0)
Filesystem type is ext2fs,partition type 0x83
grub>configfile /boot/grub/menu.lst
ERROR 15: File not found
Please commend me back.

saikee 07-26-2010 02:22 AM

Ask Grub which partition has /boot/grub/menu.lst by
Code:

find /boot/grub/menu.lst
This command also list the partition layout of the second disk
Code:

geometry (hd1)

hadimotamedi 07-26-2010 02:30 AM

I tried for your commands. Please find below the system reply :
grub>find /boot/grub/menu.lst
Error 15: File not found
grub>geometry (hd1)
Error 21: Selected disk does not exist
Please comment me.

saikee 07-26-2010 06:27 AM

At the top of the Grub screen there is a Grub version number. What version of Grub are you using?

It appears your current Grub fails to find the 2nd hard disk.

You can confirm the 1st hard disk by command
Code:

geometry (hd0)
Current Grub1 0.97 has been patched to read Ext4 partition and work with gpt disks and shows no vserion number at the top of the Grub screen.

It is possible older Grub may not be able to see a USB drive unless the Bios arranges the USB drive as the first boot disk. In other word the older Grub cannot detect such a drive unless it is in the (hd0) position which only the Bios can change.

hadimotamedi 07-26-2010 07:00 AM

It shows my grub version as 0.90 .
When I try for the following :
grub>geometry (hd0)
It shows the internal disk geometry.
I need to press 'Esc' after reboot the machine and select the boot device from :
SATA
CD/DVD
USB
Please help.

saikee 07-26-2010 07:12 AM

Boot up Red Hat and post here the output of
Code:

fdisk -l
When I entered Linux the oldest Grub I could lay my hand on was Grub 0.91 off DSL. You must be using the Red Hat 9 or older.

When you run Red Hat Linux its kernel has the driver for the USB device so you should be aboe to see the USB disk.

You can also confirm the availability of the USB disk in Red Hat's Bash terminal. The USB disk (hd1) will be reported by these commands (inside Red Hat terminal)
Code:

su
grub
geometry (hd0)
geometry (hd1)
find /boot/grub/menu.lst
quit

If you can locate a partition in (hd1), say for example (hd1,0), then you can ask Grub to install itself in the MBR of the USB disk by
Code:

grub
root (hd1,0)
setup (hd1)
quit

Please adjust the partition number that has /boot/grub/menu.lst in disk (hd1) in your case and do not put in (hd1,0) blindly. There shoudl be a partition in (hd0) that has /boot/grub/menu.lst too but it will be from the internal disk.

If you have done the above then instruct the Bios to boot the USB and the Red Har there will be fired up. Not saying it will work but it should boot.

hadimotamedi 07-28-2010 01:17 AM

Please find below the output of 'fdisk' :
#fdisk -l /dev/hda
Disk /dev/hda: 16 heads, 63 sectors, 266305 cylinders
Units= cylinders of 1008 * 512 bytes
/dev/hda1 * 1 102 51376+ 83 Linux
/dev/hda2 103 175186 88242336 83 Linux
/dev/hda3 175187 178826 1834560 82 Linux swap
/dev/hda4 178827 266305 44089416 f Win95 Ext'd (LBA)
/dev/hda5 178827 265004 43433680 83 Linux
/dev/hda6 265005 265784 393088 83 Linux
/dev/hda7 265785 266304 262048 83 Linux

#fdisk -l /dev/sda
Disk /dev/hda: 64 heads, 63 sectors, 19077 cylinders
Units= cylinders of 2048 * 512 bytes
/dev/sda1 * 1 50 51184 83 Linux
/dev/sda2 51 1842 1835008 83 Linux swap
/dev/sda3 1843 13018 11444224 82 Linux
/dev/sda4 13019 19077 6204416 f Win95 Ext'd (LBA)
/dev/sda5 13019 18437 5549040 83 Linux
/dev/sda6 18438 18821 393200 83 Linux
/dev/sda7 18822 19077 262128 83 Linux

Then I tried as :
#su
#grub
grub>geometry (hd0)
drive 0x80: C/H/S = 4161/16/63, The number of sectors = 268435455, /dev/hda
Partition num:0,Filesystem type is ext2fs, partition type 0x83
Partition num:1,Filesystem type is ext2fs, partition type 0x83
Partition num:2,Filesystem type unknown , partition type 0x82
Partition num:4,Filesystem type is ext2fs, partition type 0x83
Partition num:5,Filesystem type is ext2fs, partition type 0x83
Partition num:6,Filesystem type is ext2fs, partition type 0x83
grub>geometry (hd1)
drive 0x81: C/H/S = 19077/64/32, The number of sectors = 39070080, /dev/sda
Partition num:0,Filesystem type is ext2fs, partition type 0x83
Partition num:1,Filesystem type unknown , partition type 0x82
Partition num:2,Filesystem type is ext2fs, partition type 0x83
Partition num:4,Filesystem type is ext2fs, partition type 0x83
Partition num:5,Filesystem type is ext2fs, partition type 0x83
Partition num:6,Filesystem type is ext2fs, partition type 0x83
grub>find /boot/grub/menu.lst
Error 15:file not found
grub>root (hd1,0)
Filesystem type is ext2fs, partition type 0x83
grub>setup (hd1)
Checking if"/boot/grub/stage1" exists ... no
Checking if"/grub/stage1" exists ... no
Error 15: file not found

Please help me, based on the above data.

saikee 07-28-2010 02:30 AM

Try to find Grub's configuration file by

Code:

find /boot/grub/grub.conf
Some Red Hat calls Grub's configuration file "grub.conf" which sometimes is symbolic-linked with "menu.lst". Your version of Red Hat doesn't.

It was my mistake. I should have asked you to search grub.conf.

hadimotamedi 07-28-2010 02:39 AM

The file is present on the (hd0) , as the 'ls' from /boot/grub shows it. But on the grub :
grub>find /boot/grub/grub.conf
Error 15 : file not found
Please help me.

saikee 07-28-2010 05:02 AM

When you boot up your Red Hat do you know which is you /boot? and post here the directory of /boot/grub. My Red Hat 9 looks like the following
Code:

[saikee@localhost saikee]$ su
Password:
[root@localhost saikee]# ls /boot/grub
device.map    ffs_stage1_5  menu.lst          splash.xpm.gz    xfs_stage1_5
device.map~    grub.conf    menu.lst~          stage1
e2fs_stage1_5  grub.conf~    minix_stage1_5    stage2
fat_stage1_5  jfs_stage1_5  reiserfs_stage1_5  vstafs_stage1_5
[root@localhost saikee]#

When I issue a Grub shell and ask Grub to find /boot/grub/grub.conf I got
Code:

    GRUB  version 0.93  (640K lower / 3072K upper memory)
                                                                               
 [ Minimal BASH-like line editing is supported.  For the first word, TAB
  lists possible command completions.  Anywhere else TAB lists the possible
  completions of a device/filename.]
                                                                               
grub> find /boot/grub/grub.conf
 (hd0,9)
 (hd0,10)
 (hd0,20)
 (hd0,21)
 (hd0,23)
 (hd0,24)
 (hd0,28)
 (hd0,29)
 (hd0,32)
 (hd0,46)
 (hd0,57)
 (hd0,58)
 (hd0,59)

My Red Hat 9 is in hda11 or (hd0,10) among the 145 OSes I have booted and documented.
My (hd0,9) is Turbo Linux, (hd0,20) is Blag, (hd0,21) is Fedora Core 4, (hd0,23) is Red Flag, (hd0,24) is Linare, (hd0,28) is Vine, (hd0,29) is Specific, (hd0,32) is Asian Linux, (hd0,46) is Foresight, (hd0,57) is Haansoft, (hd0,58) is Fedora Core 3 and (hd0,59) is Scientific Linux, all of which are based on Red Hat and so have grub.conf inside their partitions.

The Grub in my Red Hat 9 is version 0.93 and the Red Hat 9 has a 2.4.20 kernel from command "uname -r" as indicated below
Code:

[root@localhost saikee]# uname -r
2.4.20-8


hadimotamedi 07-31-2010 02:53 AM

Please find below the stuff of my /boot/grub from the primary disk (hd0):
'device.map e2fs_stage1_5 fat_stage1_5 ffs_stage1_5 grub.conf menu.lst->./grub.conf minix_stage1_5 reiserfs_stage1_5 splash.xpm.gz stage1 stage2 vstafs_stage1_5'
Then I issue grub shell and ask grub to find /boot/grub/grub.conf but I got :
Error 15: file not found
Please find below the output of 'uname -r' :
2.4.7-10
Please comment me back.

saikee 07-31-2010 04:48 AM

According to your information of /boot/grub
Quote:

'device.map e2fs_stage1_5 fat_stage1_5 ffs_stage1_5 grub.conf menu.lst->./grub.conf minix_stage1_5 reiserfs_stage1_5 splash.xpm.gz stage1 stage2 vstafs_stage1_5'
The file grub.conf is inside but your v0.93 Grub refuses to acknowledge it.

If I have guess a reason why Grub behaves like this I would suspect your Grub V0.93 is too old for the job and may not have the driver to read a USB disk during boot time. Once booted the Linux kernel with the help of drivers can see your second hard disk and its contents.

Your Red Hat is indeed very old as I have not worked with such an old 2.4 kernel and such a ancient Grub, even I did have a V0.90 but it was a patched version for DSL.

My guess is even if you manage to get Grub working you still have one hell of an uphill struggle to get Red Hat working with the USB device as that kernel is clearly not equipped to work on USB.

For the cure I am pretty sure you can put a newer version of Grub into your existing installation. You can boot up a recent Linux that has Grub1, say from a Fedora, and copy the booted up /boot/grub directory into your Red Hat directory, which must be of course mounted first. You then used the new Grub from the booted up Fedora, which you use as a Live CD only, to set Grub1 up by command
Code:

grub
root (hd1,0)
setup (hd1)
quit

You should find the new Grub able to detect the (hd1).

Changing the Grub version is a simple matter. I often install Grub on its own this way.

hadimotamedi 07-31-2010 11:42 PM

I have a centos5 machine ,so I burned a cd containing its /boot/grub contents. Then I copied it into the same folder on my redhat machine but nothing changed. Can you please confirm if my understanding of your comment is right?

saikee 08-01-2010 06:52 AM

Here is the verdict.

I attached 2 flash drives, one without any partition and another with several partitions, to one of my boxes and booted up several version of Grub as I keep a few version in floppies.


V0.91, V0.95, V0.97 and v1.97 - All two flash drives (hd1) & (hd2) were reported.

However if I switch in the Bios page "USB legacy support" from "Enabled" to "Disabled" all the flash drives were not reported.

Conclusion : You need the motherboard to have the feature to present USB devices as disks by the Bios before Grub can see them.

hadimotamedi 08-03-2010 06:14 AM

I didn't have success to accomplish this. So I thought if I can resort it and try to install my old redhat on one of my centos partitions and them copy its contents via 'dd if of' to the usb disk (as my centos can recognize the usb disks). Can you please let me know how it can be accomplished (I mean dual booting centos with redhat) ?

saikee 08-03-2010 06:39 AM

Don't think you can dd it out as your hard disk geometry is different to the USB disk.

You could transfer the content of an installed Red Hat by copying every partition of one disk to another disk with the same number of partitions by tar, cp etc commands and then repair Grub and the /etc/fstab. Your Red Hat should be old enough to permit migration.

It is a lot faster if you just take the Red Hat installation CD to the CentOS computer and install it there. I think you should be able to down load the old Red Hat from the Internet.

hadimotamedi 08-03-2010 06:57 AM

I have the redhat install cd but my redhat machine does not recognize usb disk (but my centos does). So I thought if I can install redhat on one of its partitions and then copy its contents to usb disk.

hadimotamedi 08-03-2010 07:06 AM

If so, then how can I make the usb disk geometry the same as my internal disk when formatting it? (I mean making the same number of partitions)

saikee 08-03-2010 12:28 PM

You clone the whole disk. This way you get exactly the same geometry on the target disk as the source disk.

hadimotamedi 08-06-2010 10:41 PM

Sorry. How it can be done with he 'tar' command ?

saikee 08-07-2010 06:41 AM

tar command operates on files inside a partition. It is a file-copying command, not one that transfers boot sectors, partition table, MBR and the entire disk using a sector-by-sector cloning.

hadimotamedi 08-07-2010 06:55 AM

Sorry. You mean it cannot be used as what 'cp' is doing in the following?
#cp -ax / /new-disk

saikee 08-07-2010 04:36 PM

Nop. You are copying folder / to folder /new-disk only.

You use dd to clone disk sda to sdb by
Code:

dd if=/dev/sda of=/dev/sdb
Just make sure the target disk to be written on sdb is bigger or exactly in size to the source disk and do not mount any of them. This way you copy only the "1" and "0" of the hard disk and so the boot sector, partition table and MBR are cloned.

Read

man cp
man tar
man dd

hadimotamedi 08-08-2010 01:32 AM

Sorry. You mean two ide disks? But not one ide and one usb disks? Can you please confirm if your proposed 'dd if of' procedure can be used for one ide disk as primary and one usb disk as secondary?

saikee 08-08-2010 05:54 AM

yes.

The disk types of IDE or Sata do not matter, neither the sizes between 2.5" and 3.5".

However to boot properly without any more work you must use the disk in the same boot disk order as before. This is to say if it been booted up as a sdb before then it should boot same as sdb in the new environment. To alter the disk order in Linux is possible but requiring correction to the boot loader configuration files and fstab. Also certain server type Linux distros, like Red Hat, dislike being moved and have Selinux preventing such a migration. The movement can only be achieve by disabling Selinux at least initially.

If you use an old kernel that sticks to hda to hdd device names and move it to a Sata you need to amend the boot loader configuration and fstab too.

The other golden rule is to use the target disk either exactly in size or just larger than the source disk.

hadimotamedi 08-09-2010 01:56 AM

Thank you very much for your help. So I need to obtain another ide-to-usb adapter and then clone one of the primary working ide disks to another formatted one through 'dd if of' utility. Can you please let me know how can I make my centos dual boot with redhat?

saikee 08-09-2010 02:32 AM

You don't need any formatting operation if you clone the whole disk?

I can't see why CentOS and Re Hat cannot be dual booted, as these are just 2 of the 30+ Linux in my hard disk. Just remember to use the clone in the same condition as the source disk otherwise you will have to do extra work.

hadimotamedi 08-09-2010 02:58 AM

So , according to you, the second ide disk does not need to be formatted first (it just needs to be of the same geometry as the first one). Can you please let me have a reference link on how to dual boot my centos with redhat?

saikee 08-09-2010 06:27 AM

When you clone a first hard disk onto a second hard disk you force the second hard disk to become a mirror image of the first. Both disks have identical partition table and inside the area prescribed by this partition table every binary bit is the same in the two disk. Formatting the second disk is just a waste of time regardless you can get it right or not. The second disk by default will have the same geometry of the former.

Both CentrOS and Red Hat use a Linux boot loader which can be Lilo or Grub. Grub is the preferred choice in all the versions I have come across these two distros.

Any Grub, be it a Grub1 or Grub2, can boot any Linux directly. Additionally a decent boot loader like Grub can indrectly boot any other PC boot loader from Windows, BSD and Solaris.

Therefore there is no installed PC operating system Grub cannot boot!!!!!!!!!!!!!

If you must see a link to convince yourself this thread has one Grub booting 145 operating system using indirfect method because it is easier. Red Hat and CentSO were the 2 among the 145 system. They were installed in hda11 and hdc11 respectively.


All times are GMT -5. The time now is 06:16 PM.