-
Failsafe GRUB setup
Hi there!
I just joined. Apologies if this is in the wrong forum.
I'm trying to get some advice regarding GRUB and a dual Ubuntu / WinXP installation.
I have:
- ASUS EeePC Netbook
- 1 GB RAM
- 250 GB hard disk
- 16 GB SD card
I want to have the following:
- WinXP installed on the 250 GB hard drive; NTFS (it's already installed)
- Ubuntu 12.04 LTS installed on the 16GB SD card (flash card); ext (it's already installed)
- VERY IMPORTANT: I want the GRUB menu to run off of the hard disk, and NOT the SD Card; Or, stated another way, if the SD card is removed or is not present at the time of booting, I still want to see the GRUB menu when booting and be able to boot into Windows off the hard drive.
Please see my boot-repair script here:
http://paste.ubuntu.com/1154778/
Unfortunately, with that setup, if the SD card is not present at the time of booting, I do not get the GRUB menu, but am taken into the grub rescue> prompt, which I do not want to see.
How can set things up so that: I am always taken to the GRUB menu AND have Ubuntu installed on the SD card AND can choose to remove the SD card prior to boot yet still get to the GRUB menu (to boot into Windows)!
I'm open to any solutions.
If it's necessary to create additional partitions, or use something other than GRUB to achieve this end, then so be it (I have the Linux 'boot-repair-disk')!
Thanks for any help you can provide.
Dan
-
5to9,
Welcome to JustLinux!
You may have tried to install Grub2 to boot off the 250Gb hard disk but Grub2's intelligence is inside /boot/grub which is in the Ubuntu residing in the SD card.
When Grub boots it needs the access to its own intelligence (to understand the commands etc) and will need to load its stage2 file called core.img. When this file is not found Grub2 deafults to "Grub rescue" mode.
I know Grub2 can read a NTFS partition but putting Grub's system files inside it is another matter. When I attempted this I got an error meassage
Code:
grub-setup: error: Cannot read `/grub/core.img' correctly
Therefore you will need a separate Linux partition (created as Type 83 and formatted to say Ext3) in the 250GB hard disk of a size say 0.1Gb to 1Gb. 0.1Gb will do as Grub2 can be put inside a floppy but 1Gb is just a neat number to work with. You then boot up the Ubuntu with the SD card attached and copy the entire directory of /boot/grub into this new partition say /dev/sda2. You then do a grub-install telling Grub2 the sda2 is the new root directory. The command in Ubuntu should be something like the following (assuming your new partition in the 250Gb disk is sda2. Adjust if it is not!)
Code:
sudo su
mkdir /mnt/sda2
mount /dev/sda2 /mnt/sda2
mkdir /mnt/sda2/boot
cp -R /boot/* /mnt/sda2/boot/
grub-install --root-directory=/mnt/sda2 /dev/sda
If no error is reported then your hard disk should have Grub2 permanently.
Theses are the two points you need to work on too.
How to get the 0.1Gb (or 1Gb) partition) - Run Ubuntu's Gparted to resize the Xp partition to get it slightly smaller with an unallocated space at the end for the new partition. After this is done you can use Gparted as a second run (say after a reboot so that the new partition become effective) to create and format the required sda2.
How to change Grub.cfg - It is likely that your SD card was named (hd1) in the presence of your 250Gb which should be called (hd0). Therefore you may need to change every occurance in the /boot/grub/grub.cfg in the sda2
Code:
set root='(hd1,msdos1)'
to
Code:
set root='(hd0,msdos2)'
to reflect the new location of Grub2 is now the the 2nd partition of the 1st hard disk . Grub2 counts the disk from zero and partition from 1 to be same as the MS Windows.
Good luck.
-
Thanks Saikee.
I will try this out and let you know how it goes
As an aside, what is the best way to understand about concepts like 'boot', 'root', 'mnt', swap partitons, mount points, how Ubuntu treats them, how to manage them, the sequence in which things occur, etc.
Also, I wish to understand more about the file system hierarchy, as it differs from what I am used to in Windows -- In Windows, 'Desktop', '(My) Documents', Downloads, 'C:', 'D:', etc are all sub-folders of 'My Computer'). I know that Linux/Ubuntu treats things differently.
Still studying...any suggested resources would be great.
-Dan
-
5to9,
The folder and filing structure in Windows and Linux are similar. The separator used in MS Windows is "\" which you need to change to "/".
MS Windows put everything into "My Documents" folder. Linux does this in /home folder inside which you should find everytthing belonging to you.
The Linux has a finite file structure similar to Unix with /boot for booting, /root for root user's files, /dev for device names etc , etc. You can learn their use as you go along.
Linux has much better hard disk device name structure. It used to assign different device name to SCSI, IDE, Sata, USB disks but now all of them are called sdx where x is the alphabet assigned during hardware detection (in the same order Bios finds them). Linux assign a number to each partition and the 4 primaries have the reserved 1 to 4. Thus every logical partition starts at the 5th position even the first 4 are not used. However logical partitions must be created by using up one of the primary which turned into an extended partition. Thus by looking at the device name number one can ascertain if it is a primary or logical partition in Linux. By looking at the alphabet one knows the order that disk was detected. Therefore sdc4 will be the 4th partition ( a primary) of the 3rd disk.
Linux uses a swap partition so that there is no need to defrag the partition.
Linux is a peculiar system that everything is represented by a file including a mouse, a hard disk or a partition. /dev/sdb is the second hard disk as there is no number meaning the whole disk. Mounting a hardware on a Linux filing system is the user ultimate control of the hardware.
For example
is to partition the first hard disk. This is operating on a hardware.
This command on the other hand is to list the content of the partition sda1 after it has been mounted on /mnt/sda1.
When a USB device is attached to a MS Windows it mounts it for the user. When a user finishes with it one must ask MS Windows for permission to dismount the device (by clicking an icon in the the bottom right hand corner).
This is the same in Ubuntu. You click that device in the desktop to mount it and click it again to dismount it. However in Linux you can also manually mount and dismount the device in a terminal with root privilege.
If you use Linux for a while you will be able to understand a lot of operations in MS Windows.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|