LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices


Reply
  Search this Thread
Old 07-18-2009, 04:20 PM   #1
Skaperen
Senior Member
 
Registered: May 2009
Location: WV, USA
Distribution: Xubuntu, Slackware, Amazon Linux
Posts: 1,997
Blog Entries: 20

Rep: Reputation: 128Reputation: 128
Installing grub on /dev/sdb or /dev/sdc


When I install Ubuntu to /dev/sda, all works well. However, when I install Ubuntu to an SD card on /dev/sdb or a USB memory key on /dev/sdc, it still puts GRUB on /dev/sda. I didn't see any option to change that. What's really annoying is /dev/sda becomes unbootable unless /dev/sdb or /dev/sdc is present after that is done. I can fix /dev/sda. But it doesn't accomplish the real goal which is to make /dev/sdb and /dev/sdc independently bootable even when /dev/sda is wiped to binary zero (or otherwise corrupt, or contains something else like Windows).

So how can I get Ubuntu to (1) do NOT touch /dev/sda at all, even if it thinks it sees GRUB already there, and (2) install everything, including GRUB, onto the target device (/dev/sdb or /dev/sdc)?

I know the details of how to do this, and could do it by manually copying data around, etc. I've done such things in Slackware. But I want to do this in Ubuntu AND use Ubuntu's installation tools exclusively. I know I can cheat, after the fact, but that's not what I'm looking for.
 
Old 07-18-2009, 04:33 PM   #2
linus72
LQ Guru
 
Registered: Jan 2009
Location: Gordonsville-AKA Mayberry-Virginia
Distribution: Slack14.2/Many
Posts: 5,573

Rep: Reputation: 469Reputation: 469Reputation: 469Reputation: 469Reputation: 469
Alright
The way I did this is I unhooked my hardrive from motherboard

I booted up the ubuntu livecd
at desktop I inserted clean ext3 4gb usb
and opened nautilus as root
sudo nautilus

the usb automounted and I then created a boot/grub folders
mkdir -p /media/disk/boot/grub
and installed grub to usb, recognized as only hd by grub

grub-install --root-directory=/media/disk /dev/sda

it sees my usb as sda, with hd hooked up it would say sdb

then, to make sure, get the grub prompt
grub
root (hd0,0)
setup (hd0)
quit

yeah, now it's simmering

that's it

What's the Bonus of this little cheat??
Grub will always think it's booting the first hd
thus even on a pc/lappy that won't boot from usb
will be able to on most if you use plop bootmanager

on pc's that boot from usb it will again be reconized first and booted 1st

NOTE: when I did this on my HP PC, if I had my bios set to boot from floppy or cd
before hd, I would get a grub error when booting usb

if the bios was set to boot hd 1st, cdrom second, the usb boots right?

so, but if that's cheating I'll do it
 
Old 07-18-2009, 06:11 PM   #3
scottro11
Member
 
Registered: Jun 2009
Location: NYC
Posts: 262

Rep: Reputation: 59
Note that in an Ubuntu installation, in the very last screen before installation begins, there's a little button on the lower right, marked Advanced. It gives you the opportunity to install grub somewhere else (and probably to further configure it, I'm not sure.)

If you already knew that, I apologize, but looking at the first post, it seems as if you may have, as I did the first couple of times playing with it, overlooked it.
 
Old 07-18-2009, 07:24 PM   #4
Skaperen
Senior Member
 
Registered: May 2009
Location: WV, USA
Distribution: Xubuntu, Slackware, Amazon Linux
Posts: 1,997

Original Poster
Blog Entries: 20

Rep: Reputation: 128Reputation: 128
If I unhook the harddrive, then the SD card will be sda, and if anything in the installation configured stuff to look for stuff in sda, then it won't be doing as intended. I want the SD card to work as sdb, and for everything that might be hard configured to the device node name to do so for sdb and not sda. That way I can put in the SD card and boot from it without accessing sda other than to see what's on it (and elsewhere, to defeat automounting it). Ideally, the only hard part is finding partitions to mount. That should be done by labels or UUID. Then everything else finds stuff by paths which will be as expected when the mounts are right.
 
Old 07-18-2009, 07:45 PM   #5
linus72
LQ Guru
 
Registered: Jan 2009
Location: Gordonsville-AKA Mayberry-Virginia
Distribution: Slack14.2/Many
Posts: 5,573

Rep: Reputation: 469Reputation: 469Reputation: 469Reputation: 469Reputation: 469
OH, sorry for not re-iterating

once you hook the hd back up and rweboot
the usb will be recognized by YOUR pc as sdb1, etc
not sda

you see, we're tricking grub, not the pc

grub thinks it's 1st hd, doesn't matter sda, hda, etc


example, right now I'm running from my usb on fedora 11 persistent
and my pc sees the usb as sdb1
grub thinks it's first hd

only problem you will have is if you try to boot 1st hd from usb
you'll just reboot into the usb

meaning the only limitation it has is that you will have issues trying to
boot your hd from the sd card, which most people don't care about anyway

just try it dude an you'll see
I got 5 computers in all
3 won't boot from usb
all will boot the ext3 usb with grub
the 3 I have to use plop bootmanager cd, usb, or floppy

look here's my menu.lst and otuput of fdisk -l for usb

Code:
Disk /dev/sdb: 4045 MB, 4045930496 bytes
255 heads, 63 sectors/track, 491 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x0005318e

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1         491     3943926   83  Linux
menu.lst
Code:
title Xtras - Menu
root (hd0,0)
configfile /boot/grub/xtras-menu.lst

title Super Grub DisK
root (hd0,0)
kernel /boot/syslinux/memdisk
initrd /boot/sgd/sgd.gz

title zorOS-3.6 IDE
root (hd0,0)
kernel /boot/syslinux/linuz TOOLSLANG=1 initrd=/boot/syslinux/full.img vga=788 load_ramdisk=1 ramdisk_size=53248 prompt_ramdisk=0 rw root=/dev/ram rootfstype=ext2 apm=off
initrd /boot/syslinux/full.img

title zorOS-3.6 SATA
root (hd0,0)
kernel /boot/syslinux/linuz TOOLSLANG=1 initrd=/syslinux/full.img vga=788 load_ramdisk=1 ramdisk_size=53248 prompt_ramdisk=0 rw root=/dev/ram rootfstype=ext2 apm=off libata.atapi_enabled=1 ide0=noprobe ide1=noprobe
initrd /boot/syslinux/full.img

title Grub bootloader - USB-Menu
root (hd0,0)
configfile /boot/grub/usb/grub-menu.lst

title Grub4DOS USB-Menu
root (hd0,0)
configfile /boot/grub/usb/usb-menu.lst

title PLOP Bootmanager USB
root (hd0,0)
kernel /boot/plpbt

title SystemRescueCD-1.2.2 - Menu
root (hd0,0)
configfile /boot/grub/sysrescue-menu.lst

title Fedora 11 Live
root (hd0,0)
configfile /boot/grub/fed-menu.lst

title Clonezilla Live 2009-jaunty
root (hd0,0)
configfile /live/clonez-menu.lst

title Sidux-2009-02
root (hd0,0)
configfile /boot/grub/sidux-menu.lst

title Mini-PartedMagic
root (hd0,0)
kernel /minipm/bzImage root=/dev/ram0 init=/linuxrc ramdisk_size=100000 vga=791
initrd /minipm/initrd

title PartedMagic - USB-Menu
root (hd0,0)
configfile /boot/grub/usb/pmagic-menu.lst

title ClamAV Anti-Virus LiveUSB
root (hd0,0)
configfile /boot/grub/usb/clamusb-menu.lst

title TinyCore_2.1 with JWM USB-Menu
root (hd0,0)
configfile /boot/grub/usb/tc-menu.lst

title RescuePuppy49 USB-Menu
root (hd0,0)
configfile /boot/grub/usb/pupusb-menu.lst

title NetbootCD 3.1.2 USB Net-install a Major Distro
root (hd0,0)
kernel /boot/kexec.bzI quiet base norestore nolocal waitusb=5
initrd /boot/nbinit3.gz
so, I don't see why it won't work on yours?

Last edited by linus72; 07-18-2009 at 07:46 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
device order (dev/sdb,dev/sdd) changes why ? comtmr Linux - Enterprise 5 06-26-2012 04:28 AM
iscsi: which local device (/dev/sda, /dev/sdb) is used WITHOUT dmesg? knikkerr Linux - Software 3 08-13-2010 04:30 AM
Installing RIP LinuX on a USB drive - device name /dev/sdc becomes /dev/sda Mleahy Linux - Software 1 07-30-2008 08:57 PM
grub on /dev/sdc and live-usb on /dev/sdc1 fitzov Linux - General 2 04-25-2007 11:11 AM
forcing the order of /dev/sda /dev/sdb etc.. jdaniel Linux - Software 5 05-23-2006 07:41 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu

All times are GMT -5. The time now is 09:48 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration