Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works
Photo

How to prevent grub to boot from backup HD


  • Please log in to reply

#1
Mikkee0

Mikkee0

    New Member

  • Member
  • Pip
  • 6 posts
Hello,

I have WinXP (for games only) and Ubuntu 9.04 on the same harddisk. I also have a mirror disk (same size and same brand as the other one) made with clonezilla that i would use as a backup.

Booting with grub is no problem, but if my external USB HD (seagate agentpro) is on, grub seems to boot from the mirror disk. So i am loosing some of the changes made under linux and i'm back on from the day i made the backup on the mirror disk (or is it an old session saved somewhere ?). If the external USB HD is off when booting i got everything back as normal.

Thing to know:

-In the Bios i turned off the boot sequence to USB and also from the secondary HD.
-There is no operating system on the USB-HD


The simple solution i'm looking to try is a grub commands that i could add in the menu.lst that could prevent booting from the mirror disk. Anyone knows?

Thanks

Mike

Edited by Mikkee0, 20 May 2009 - 08:52 PM.

  • 0

Advertisements


#2
Kemasa

Kemasa

    Nobody

  • Technician
  • 1,645 posts
I suspect that what is happening is that the disk numbering is changing when the USB drive is attached. The first step is to look at the menu.lst and see what drive is listed. Check both the current disk and the mirror. You can add an additional entry in the mirror to point to the real disk, also change the default to be something else and a long time until it boots that OS, so that you are aware of what it is doing.

When you boot into the mirror, what is the real disk named? (from root you can do "fdisk -l" to list all the partitions). There are other programs which can show it too, I have a perl script called "hinv". Also "cat /proc/partitions" and other files in /proc.
  • 0

#3
Mikkee0

Mikkee0

    New Member

  • Topic Starter
  • Member
  • Pip
  • 6 posts

The first step is to look at the menu.lst and see what drive is listed. Check both the current disk and the mirror.

Doesn't seem to have any drive listed except the Windows partition

title		Ubuntu 9.04, kernel 2.6.28-11-generic
uuid		4a1a1f31-cbeb-4329-8eaa-92a8d6ff72a2
kernel		/boot/vmlinuz-2.6.28-11-generic root=UUID=4a1a1f31-cbeb-4329-8eaa-92a8d6ff72a2 ro quiet splash 
initrd		/boot/initrd.img-2.6.28-11-generic
quiet

title		Ubuntu 9.04, kernel 2.6.28-11-generic (recovery mode)
uuid		4a1a1f31-cbeb-4329-8eaa-92a8d6ff72a2
kernel		/boot/vmlinuz-2.6.28-11-generic root=UUID=4a1a1f31-cbeb-4329-8eaa-92a8d6ff72a2 ro  single
initrd		/boot/initrd.img-2.6.28-11-generic

title		Ubuntu 9.04, memtest86+
uuid		4a1a1f31-cbeb-4329-8eaa-92a8d6ff72a2
kernel		/boot/memtest86+.bin
quiet

### END DEBIAN AUTOMAGIC KERNELS LIST

# This is a divider, added to separate the menu items below from the Debian
# ones.
title		Other operating systems:
root


# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/sda1
title		Windows NT/2000/XP (loader)
root		(hd0,0)
savedefault
makeactive
chainloader	+1


You can add an additional entry in the mirror to point to the real disk, also change the default to be something else and a long time until it boots that OS, so that you are aware of what it is doing.


i'm not sure to understand how to do this, im quit new with linux

When you boot into the mirror, what is the real disk named? (from root you can do "fdisk -l" to list all the partitions).


Master disk
Disk /dev/sda: 500.1 GB, 500107862016 bytes
Disk identifier: 0xd6ded6de

Device Boot Start End Blocks Id System
/dev/sda1 * 1 40544 325669648+ 7 HPFS/NTFS
/dev/sda2 40545 60801 162714352+ 5 Extended
/dev/sda5 40545 59974 156071443+ 83 Linux
/dev/sda6 59975 60801 6642846 82 Linux swap / Solaris

Clone disk
Disk /dev/sdb: 500.1 GB, 500107862016 bytes
Disk identifier: 0x7281076d

Device Boot Start End Blocks Id System
/dev/sdb1 * 1 40544 325669648+ 7 HPFS/NTFS
/dev/sdb2 40545 60801 162714352+ 5 Extended
/dev/sdb5 40545 59974 156071443+ 83 Linux
/dev/sdb6 59975 60801 6642846 82 Linux swap / Solaris

USB disk
Disk /dev/sdc: 320.0 GB, 320072933376 bytes
Disk identifier: 0x000decdf

Device Boot Start End Blocks Id System
/dev/sdc1 1 22403 179952066 7 HPFS/NTFS
/dev/sdc2 22404 38912 132608542+ f W95 Ext'd (LBA)
/dev/sdc5 22404 38912 132608511 7 HPFS/NTFS



Someone just suggested me to use the following command

sudo tune2fs -U random /dev/sdb1

  • 0

#4
Kemasa

Kemasa

    Nobody

  • Technician
  • 1,645 posts
You could change the UUID on the mirror drive using the tunee2fs, or you could change the menu.lst to be the drive, rather than looking for the UUID. You need to be careful though since you could make it so that your machine does not boot.

For example, a line from my menu.lst is:

title Man10hda3
kernel (hd0,1)/vmlinuz root=/dev/hda3 devfs=mount acpi=ht resume=/dev/hda5 splash=silent vga=788
initrd (hd0,1)/initrd.img

I boot to a separate boot partition. Root is on hda3. The "(hd0,1)" specifies the first disk.

Is that the complete menu.lst? When your machine boots, does it show a menu of items to select for booting or does it just automatically boot?

At the start of my menu.lst, I have:

timeout 10
color black/cyan yellow/cyan
default 0

So, if you copy a new entry:

title		Ubuntu 9.04, kernel 2.6.28-11-generic
kernel		(hd0,1)/boot/vmlinuz-2.6.28-11-generic root=UUID=4a1a1f31-cbeb-4329-8eaa-92a8d6ff72a2 ro quiet splash
initrd		(hd0,1)/boot/initrd.img-2.6.28-11-generic
quiet

selecting the disk instead of specifying the UUID, it should get the first disk. Don't modify the existing entries since you want to be able to boot if you make a mistake. Just add these lines to the end of the file and then select it when you boot.

You might be able to use "dumpe2fs" to list the UUID for the master drive and change the menu.lst to that. I personally don't care for labels like that as it can get confusing. I prefer to specify the disk.
  • 0

#5
Mikkee0

Mikkee0

    New Member

  • Topic Starter
  • Member
  • Pip
  • 6 posts

Is that the complete menu.lst? When your machine boots, does it show a menu of items to select for booting or does it just automatically boot?

At the start of my menu.lst, I have:

timeout 10
color black/cyan yellow/cyan
default 0


I do have the same and a lots of remarks preceded by # or ##
A menu do appear and it boots accordingly to my choice


So, if you copy a new entry:

title		Ubuntu 9.04, kernel 2.6.28-11-generic
kernel		(hd0,1)/boot/vmlinuz-2.6.28-11-generic root=UUID=4a1a1f31-cbeb-4329-8eaa-92a8d6ff72a2 ro quiet splash
initrd		(hd0,1)/boot/initrd.img-2.6.28-11-generic
quiet

selecting the disk instead of specifying the UUID, it should get the first disk. Don't modify the existing entries since you want to be able to boot if you make a mistake. Just add these lines to the end of the file and then select it when you boot.

Thats the way I want it, but how could i list the HD, I know with gparted that the master is sda and the clone sdb but i know nothing about the (hd0,1) or whatever the numbers are. Is there a terminal command i should use to check even if im quit sure its (hd0,1)?

or tell me if i'm wrong

(hd0,x) is the master disk
(hd1,x) the slave disk
and in my situation the external usb would be
(hd2,x)

and the x will be the partition number?


edit: It doesn't work, it said Error 17: Cannot mount selected partition. I did cut and paste from your input. Is there a space forgotten?

Edited by Mikkee0, 22 May 2009 - 08:20 PM.

  • 0

#6
Mikkee0

Mikkee0

    New Member

  • Topic Starter
  • Member
  • Pip
  • 6 posts
Also tried the command

sudo tune2fs -U random /dev/sdb2

but got:
tune2fs 1.41.4 (27-Jan-2009)
tune2fs: Attempt to read block from filesystem resulted in short read while trying to open /dev/sdb2
Couldn't find valid filesystem superblock.



What's strange is I notice in the boot sequence this:

Boot from (hd0,4) ext3

but had this in both, good and wrong situation. So it looks like grub can't make the difference physically between the slave and the master. This is a new computer and i'm wondering if Master and slave assignment are no longer applicable with the sata2 controler?

Edited by Mikkee0, 22 May 2009 - 10:22 PM.

  • 0

#7
Kemasa

Kemasa

    Nobody

  • Technician
  • 1,645 posts
Yes, (hd0,x) would be the master disk and (hd1,x) would be the second disk. The USB should be hd2, but if you have a DVD or CD, it could be something else.

x would be the partition number, but please realize that it starts with 0, not 1. I boot from hda2 (my boot partition), which is why it is (hd0,1).

(hd0,4) would be on first disk.

For more info on grub, use the command "info grub". There is a section which deals with the naming conventions.
  • 0

#8
Mikkee0

Mikkee0

    New Member

  • Topic Starter
  • Member
  • Pip
  • 6 posts
It seems to work now, i did the command:


sudo tune2fs -U random /dev/sdb[b]5[/b]

And i didn't get old session loaded so far.

Thank you very much for your help and suggestions.

Do you know how could i now find the new UUID created by tune2fs on the clone disk?


Again, thank you very much
  • 0

#9
Kemasa

Kemasa

    Nobody

  • Technician
  • 1,645 posts
You should be able to use dumpe2fs to get the UUID.

You are welcome.
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP