# Moving from IDE to SATA problems

## Muddy

Greetings all, 

Just a quick note on my hardware if it helps.

Asus A7N8X-E Deluxe 

Seagate 7200.7 80g drives (x2)

(Moving from 40g IBM Deskstar ATA100 drive)

So I dig for 3 days through the forums, get my SATA drives setup in raid0, fdisk both drives to be the same, setup my raidtab I can mount and use the bootable sda1 and sdb1 partitions.

I can also mount /dev/md0 and use it (howeverALL of this is booting off my IDE drive)

So I don't really have a problem IN linux, it's getting my bios to boot off SATA 1 or 2 is my problem.

I changed my bios to boot SCSI and played around removing IDE devices and changing boot order.

Nothing works, it just sits there at "Verifying DMI pool data...."

So I'm thinking maybe my boot partitions are messed up.

I logged back in (now) and just verified that the partitions on sda and sdb are bootable and both have the same data as my hda1 partition.

I used cp -aR to get all the data from my hda1 to the sda1 and sda2 partitions (yea I should of only done sda1 but have seen a few posts about machines using sdb1 for some reason)

I don't think I've missed anything but then again, if I had not it would be working.  :Wink: 

Any help would be fantastic, thank you.

----------

## DayLung

Did you set up your bootlaoder on the sata drive so that the MBR on the sata drive has the right information on it? If so how did you do this?

----------

## Muddy

```
 # ls -lha

total 11M

drwxr-xr-x   3 root root 1.0K May 27 10:18 .

drwxr-xr-x  24 root root  592 May 26 20:08 ..

-rw-r--r--   1 root root 1.1M Mar  4 12:39 System.map-2.4.26-gentoo-muddy

-rw-r--r--   1 root root 1.2M May 24 23:31 System.map-2.6.11-ck8-r1-muddy

-rw-r--r--   1 root root 1.1M Dec 26 03:35 System.map-2.6.9-gentoo-r12

lrwxrwxrwx   1 root root    1 May 27 10:18 boot -> .

-rw-r--r--   1 root root  37K Mar  4 12:39 config-2.4.26-gentoo-muddy

-rw-r--r--   1 root root  37K May 24 23:31 config-2.6.11-ck8-r1-muddy

-rw-r--r--   1 root root  37K Dec 26 03:35 config-2.6.9-gentoo-r12

drwxr-xr-x   2 root root 1.0K Dec 26 06:18 grub

-rw-r--r--   1 root root 2.6M May 24 23:31 kernel-2.6.11-ck8-r1-muddy

-rw-r--r--   1 root root 2.2M Mar  4 12:38 kernel-2.6.9-gentoo-muddy

-rw-r--r--   1 root root 2.2M Dec 26 03:35 kernel-2.6.9-gentoo-r12

-rw-r--r--   1 root root    0 May 27 10:18 this_is_sda1

```

after I set it up in fdisk I formatted it for ext3 then use the "cp -aR" command to copy from hda1 to sda1 they are the same except for the "this is sda1" file I put on it

----------

## DayLung

I believe the MBR is not copied by a normal cp command, setting up grub or lilo on the sata disk should work.

----------

## Muddy

 *DayLung wrote:*   

> I believe the MBR is not copied by a normal cp command, setting up grub or lilo on the sata disk should work.

 

Ok, let me see if I can figure that out. Thanks.

----------

## Muddy

well I think it's a config problem in grub now..

when I boot it goes...

```

grub grub grub grub grub grub grub
```

all across the screen and scrolls, haha..

here is my grub config on sda1

```
 Which listing to boot as default. 0 is the first, 1 the second, etc..

default 0

# How many seconds to wait before the default listing is booted.

timeout 15

# Nice, fat splash-image to spice things up :)

# Comment out if you do not have a graphics card installed

spashimage=(hd0,0)/grub/splash.xpm.gz

#title=Gentoo Linux 2.6.9-r12

# Partition where the kernel image (or OS) is located

#root (hd0,0)

#kernel /kernel-2.6.9-gentoo-r12 root=/dev/hda3

# initrd /

#title=Gentoo Linux 2.6.9-muddy

# Partition where the kernel image (or OS) is located

#root (hd0,0)

#kernel /kernel-2.6.9-gentoo-muddy root=/dev/hda3

# initrd /

title=Gentoo Linux 2.6.11-muddy

# Partition where the kernel image (or OS) is located

root (hd0,0)

kernel /kernel-2.6.11-ck8-r1-muddy root=/dev/md0

# initrd /
```

I'd be very happy if someone could point me to the light so to speak.   :Wink: 

----------

## Muddy

*bump*

I also removed hda and hdb from my devices.map in the grub folder and unplugged my hda and hdb drives.

When I do that it boots then right out of the bios it gives me a grub disk error.

At least i know the mobo is getting me to the sata drives, now only to figure how to setup grub it seems.

Any ideas?

ok I've tried removing my ide drives, my usb reader (which used to be sda) and changing my grub from (0,0) to all sorts of things (0,1 2,0 3,0) and so on.

Still all I get is ..

```
GRUB Hard Disk Error
```

----------

## Muddy

bump

----------

## NeddySeagoon

Muddy,

There are two ways of doing software raid in linux with your motherboard. I can't for sure tell which you are using.

If you need Windows compatibility, you must use BIOS software raid, otherwise known as dmraid.

You put your drives into a raid set in the BIOS, then partition the raid set (not the individual drives). The only reason for doing it this way is Windows and Linux can both see the raid set.

The other way, is to partition your two drives identically, then put the partitions into raid devices. After you have done this, with one exception, you never reference the individual devices again. The exceptiion is the install of grub. 

Grub will not boot from a raid0 volume, so your /boot must either be a standard volume or raid1.

You do not copy things to the two halfs of a mirror (raid1 set), you mount the /dev/md0 somewhere cand topy to that.

Please post your /etc/raidrab and /proc/mdstat and explain which raid set-up and raid levels you are trying to use.

I don't think its a grub.conf issue, since the problem seems to be in the BIOS. Its not getting as far as reading grub.conf yet.

----------

## Muddy

```
 # cat /etc/raidtab

 #

       # sample raiddev configuration file

       # 'old' RAID0 array created with mdtools.

       #

       raiddev /dev/md0

           raid-level              0

           nr-raid-disks           2

           persistent-superblock   0

           chunk-size              16

           device                  /dev/sda3

           raid-disk               0

           device                  /dev/sdb3

           raid-disk               1

```

```

# cat /proc/mdstat

Personalities : [raid0] [raid1]

md0 : active raid0 sdb3[1] sda3[0]

      155525248 blocks 16k chunks

unused devices: <none>

```

I'm using sda1 and sdb1 as boot ext3 partitions and since I've seen elsewhere that people have seen their bios use both for bootings (not at the same time but it could choose either) I copied the same thing to both just in case.

```
Disk /dev/sda: 80.0 GB, 80026361856 bytes

255 heads, 63 sectors/track, 9729 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *           1          12       96358+  83  Linux

/dev/sda2              13          48      289170   82  Linux swap / Solaris

/dev/sda3              49        9729    77762632+  fd  Linux raid autodetect

Disk /dev/sdb: 80.0 GB, 80026361856 bytes

255 heads, 63 sectors/track, 9729 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System

/dev/sdb1   *           1          12       96358+  83  Linux

/dev/sdb2              13          48      289170   82  Linux swap / Solaris

/dev/sdb3              49        9729    77762632+  fd  Linux raid autodetect

Disk /dev/md0: 159.2 GB, 159257853952 bytes

2 heads, 4 sectors/track, 38881312 cylinders

Units = cylinders of 8 * 512 = 4096 bytes

    Device Boot      Start         End      Blocks   Id  System

```

Even the md0 shows up as the correct size.

I can mount md0, sdb1 and sda1 and use all three partitions without fail if I boot using my current ide drives then mount the partiions

However when I boot with all my ide drives removed it just fails to "Grub Hard Drive Error" and stops.

----------

## NeddySeagoon

Muddy,

Info grub says

```
Hard Disk Error

     The stage2 or stage1.5 is being read from a hard disk, and the

     attempt to determine the size and geometry of the hard disk failed.
```

Is your BIOS set to use logical block addressing?

Linux fdisk does not fill in the C/H/S entries in the partition table because that have not been used for years.

They can only describe up to the first 8Gb of a drive.

----------

## Muddy

 *NeddySeagoon wrote:*   

> Muddy,
> 
> Info grub says
> 
> ```
> ...

 

I have no clue as I don't believe that option exists in the Bios.

I found there is an update, let me flash it and see if that option exists.

----------

## NeddySeagoon

Muddy,

BIOS flashing is an option of last resort.

Try removing the IDE drives, booting the liveCD, then instaling grub on both SATA drives,

They will be (hd0  and (hd1 then.

You say you have changed your /boot/grub/device.map file. However, you have several.

One in each /boot/grub. You have as many /boot/grub/grub.conf files too.

Which one is used depends on the drive you choose to boot from.

You need to get all that sorted out in your mind, or at least keep it all in sync.

I made my /boot raid1 as it was less to keep track of and keep in sync.

----------

## Muddy

Ok, I'll save my grub.conf and reinstall grub to both sda1 and sdb1 from the livecd.

I'll report back in a bit.

Actually I can't install grub from install cd, as my / is on /dev/md0 and can't be mounted by the install cd.

----------

## NeddySeagoon

Muddy,

You need to modprobe raid0 (or whatever raid personality you need) then you should be able to mount your raid partitions.

----------

## Muddy

ah, see I am not as smart as i thought.    :Shocked: 

Let me see if I can do that.

----------

## Muddy

ok, modprobe'd sata_sil, sata_nv, raid0

now I have a /dev/rd

what do I mount?

----------

## NeddySeagoon

Muddy,

You mount /dev/md0 /mnt/gentoo

then mount /dev/sda1 on /mnt/gentoo/boot

Do the chroot steps and install grub on sda1  (hd0,0) ?

I hope I have your partitions right, if not, you use the right ones.

----------

## Muddy

 *NeddySeagoon wrote:*   

> Muddy,
> 
> You mount /dev/md0 /mnt/gentoo
> 
> then mount /dev/sda1 on /mnt/gentoo/boot
> ...

 

Hmm... there is no /dev/md0 however if I cat proc/mdstat

it does show raid0

----------

## Muddy

I do not have an MD device in /dev

is there a way to make it?

I have tried with no success to use mdadm to make the /dev/md0 but it's not working either.

update*

rebooted with ide drive and mounted /dev/md0 and it's working just fine.

also reinstalled grub with grub-install to temp mounted /dev/sda1 and /dev/sdb1

will reboot and try again

----------

## Muddy

Progress!

I re-ran my kernel make and such.. installed it to sda1 and sdb1 as well as re-ran grub-install putting it to both sda1 and sda2 now when I boot without my ide drives it i get 

```
GRUB Loading stage1.5

GRUB loading, please wait...

Error 17
```

so this is farther than I've ever been before, now to edit my grub.conf files to point to a diff drive maybe?

----------

## Muddy

Ok, last test now i'm clearing out both sata drives.. 

I hooked both ide drives back up but changed grub to use the /dev/md0 as root instead of /dev/hda3 to see if it was that or my sata boot that was causing the problems, well it started to boot and the drives are corrupted or something so I know for a fact it was the mbr on sda that was causing the problems.

What is the best way to move my data and setup sda/sdb as the mbr and root drives?

I still want to keep one ide drive as storage.

----------

## NeddySeagoon

Muddy,

info grub says 

```
17 : Cannot mount selected partition

     This error is returned if the partition requested exists, but the

     filesystem type cannot be recognized by GRUB.
```

This suggests that your 

```
(hdX,Y)
```

 is wrong in grub.conf and points to a partition grub does not understand.

e.g. an extended partition or swap partition.

----------

## Muddy

I can't believe I have not posted this yet..

```
title=Gentoo Linux 2.6.11-muddy

# Partition where the kernel image (or OS) is located

root (hd3,0)

kernel /kernel-2.6.11-ck8-r1-muddy root=/dev/md0

# initrd /

```

That is my grub config for this. 

Also here is my devices.map file.

```

(fd0)   /dev/fd0

(hd0)   /dev/hda

(hd1)   /dev/hdb

(hd2)   /dev/sda

(hd3)   /dev/sdb

```

Ok I tried to use /hda1 as my boot and as above used /dev/md0 my raid0 disks as my root 

to see if I could bypass my /sda1 and /sdb1 problems and it does some very strange stuff.

gets to grub then  when it tires to load and  boot it crashes with this:

```

md: Autodetecting RAID arrays.

md: invalid raid superblock magic on sda3

md: sda3 has invalid sb, not importing!

md: invalid raid superblock magic on sdb3

md: sdb3 has invalid sb, not importing!

md: autorun ...

me: ... autorun DONE.

ReiserFS: md0: warning: sh-2006: read_super_block: bread failed 
```

and then to a line for ext3, ext2, vfat that is can't read the superblock then it dies.

However it's Xfs not any of the above.

I think I might be able to pass to grub that it's xfs, looking for the command now.

----------

## NeddySeagoon

Muddy,

It looks like you don't have the xfs filesystem driver built into whatever kernel you are trying to boot.

The kernel tries all the ones it knows in turn, until it works or its tried all its options.

----------

## Muddy

 *NeddySeagoon wrote:*   

> Muddy,
> 
> It looks like you don't have the xfs filesystem driver built into whatever kernel you are trying to boot.
> 
> The kernel tries all the ones it knows in turn, until it works or its tried all its options.

 

slams head into wall... ugh.. I was thinking something similar to that.

Let me reboot into the ide drives and check my make menuconfig.

Xfs was selected however I went ahead and re-checked all things to do with sata drivers and file systems and whatever was a module I made part of the kernel and now I'm re-installing the kernel.

----------

## NeddySeagoon

Muddy,

Be careful to install it to the right drives /boot

----------

## Muddy

new kernel and same thing, i'm trying to use my hda1 as my boot so I removed the previous kernel from there and put in my new one (same name) and get the same error. It's very strange.

is there a way to tell grub to use xfs?

now  this is interesting...

got into  grub using the e command and tying different root (hd0,0) options and it's seeing my 1st ide drive as hd0 as it should my 2nd ide drive as hd1 and one of my sata drives as hd2 however it does not see the 2nd sata drive at all.

----------

## NeddySeagoon

Muddy,

Please post your kernel .config file and run 

```
uname -a
```

to check the build timestamp.

----------

## Muddy

uname -a gives me

```

Linux Corsair 2.6.11-ck8-r1 #3 Sun May 29 11:22:25 EDT 2005 i686 AMD  Athlon(tm)

XP 1900+ AuthenticAMD GNU/Linux
```

as for the kernel config I'm at the end of wiping my md0 reformatting with reiserfs and copying all the data back over to it, should be in a few min and rebooting.

----------

## Muddy

Ok, grub is history I'm tired of it.

After seeing so many posts about people going back to lilo to get their raid working I'm doing the same.

Any idea's on the best way to set it up?

I'm doing the config now.

----------

## Muddy

*edit*

ok i need to get grub off my mbr.. any ideas?

put lilo on it and it deleted grub, no prob.

now I can't get lilo setup right.

Here is what I have thus far.

```

# MBR to install LILO to:

boot = /dev/sda

map = /System.map-2.6.11-ck8-r1-muddy

image = /boot/kernel-2.6.11-ck8-r1-muddy

        root = /dev/md0

        label = 2.6.11-muddy

        read-only # read-only for checking

disk=/dev/md0 bios=0x82  # see this as the third BIOS disk

disk=/dev/sda bios=0x80  # see this as the first BIOS disk

disk=/dev/sdb bios=0x81  # see this as the second BIOS disk
```

----------

## NeddySeagoon

Muddy,

That /dev/md0 looks a bit strange. The BIOS cannot see linux kernel raid volumes. They only exist to the kernel.

I gave up on lilo when RedHat dropped it. I have grub and kernel raid here - the /boot must be raid1 because grub makes its own arrangements for reading disks and it does not understand raid at all.

----------

## Muddy

 *NeddySeagoon wrote:*   

> Muddy,
> 
> That /dev/md0 looks a bit strange. The BIOS cannot see linux kernel raid volumes. They only exist to the kernel.
> 
> I gave up on lilo when RedHat dropped it. I have grub and kernel raid here - the /boot must be raid1 because grub makes its own arrangements for reading disks and it does not understand raid at all.

 

Well, since I'm still using the ide drives I've no problem starting all over again on the raid setup. If you have suggestings on how to migrate I'm more than willing to give it a shot.

Better yet tell me how you did yours and I'll try that.   :Wink: 

----------

## NeddySeagoon

Muddy,

Heres my ideas in this thread https://forums.gentoo.org/viewtopic-t-342707-highlight-.html

----------

