LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   Grub2 on removable hard disk (http://www.linuxquestions.org/questions/linux-software-2/grub2-on-removable-hard-disk-913413/)

King_DuckZ 11-14-2011 02:36 AM

Grub2 on removable hard disk
 
Hello, I have recently installed Sabayon Linux at work on a esata disk, and I have problems at boot if the disk is switched off.

The original configuration of the machine was:
sda1: generic hard disk
sdb1/sdb2: windows 7 partitions

and sdb2 is the boot partition.
Now, I installed my Linux on sdc1, which is the esata disk, and during installation I put grub on sdb.
If sdc is switched off at boot, grub can't load and gets to recovery mode. I would rather expect the usual list to show up normally. I kind of understand what the problem is, but being no grub expert I'm asking for help here!

Larry Webb 11-14-2011 04:34 AM

You will need to configure grub to partition on sdb, now when you switch off your sdc all that is left is the mbr of your sdb pointing the boot at sdc1 which is no longer there. One solution would be to make a small boot partition on sdb say of 20 meg. If you are using windows 7 I understand its bootloader can be used to boot a linux distro also.

King_DuckZ 11-14-2011 05:51 AM

If I don't know much about Grub, I know absolutely nothing about Windows' boot loader :) That said, I'm interested in the solution of making a 20 mib partition. Can you guide me a little please? Like, what file system should I use, how can I resize the ntfs partition? sdb is an SSD, if that matters.
Also, once I get the partition ready, how do I change the loader in the mbr to point to the new place?

syg00 11-14-2011 07:19 AM

I would suggest you reconsider.
If you proceed as you plan, that external will only be usable on that machine. If you install grub to the MBR of the external, it will be portable in that you can take it to another machine and boot it directly if the BIOS supports external booting.
Let's get some data data on your set-up - go here, do as it says and post the RESULTS.txt

Larry Webb 11-14-2011 07:43 AM

Quote:

Originally Posted by syg00 (Post 4523569)
I would suggest you reconsider.

He is right, I did not consider you moving this from one machine to another.

Another thought is using a cd to boot with.

King_DuckZ 11-15-2011 02:34 AM

Ok, here is the file you asked:
Code:

                  Boot Info Script 0.60    from 17 May 2011


============================= Boot Info Summary: ===============================

 => Windows is installed in the MBR of /dev/sda.
 => Grub2 (v1.99) is installed in the MBR of /dev/sdb and looks at sector 1 of
    the same hard drive for core.img. core.img is at this location and looks
    in partition 1 for .
 => Windows is installed in the MBR of /dev/sdc.

sda1: __________________________________________________________________________

    File system:      ntfs
    Boot sector type:  Windows Vista/7
    Boot sector info:  No errors found in the Boot Parameter Block.
    Operating System: 
    Boot files:       

sdb1: __________________________________________________________________________

    File system:      ntfs
    Boot sector type:  Windows Vista/7
    Boot sector info:  No errors found in the Boot Parameter Block.
    Operating System: 
    Boot files:        /bootmgr /BOOTMGR /boot/bcd /BOOT/bcd /Boot/bcd
                      /boot/BCD /BOOT/BCD /Boot/BCD

sdb2: __________________________________________________________________________

    File system:      ntfs
    Boot sector type:  Windows Vista/7
    Boot sector info:  No errors found in the Boot Parameter Block.
    Operating System:  Windows 7
    Boot files:        /Windows/System32/winload.exe

sdc1: __________________________________________________________________________

    File system:      ext4
    Boot sector type:  -
    Boot sector info: 
    Operating System:  This is .()
    Boot files:        /boot/grub/grub.cfg /boot/grub/grub.conf /etc/fstab
                      /boot/grub/core.img

sdc2: __________________________________________________________________________

    File system:      swap
    Boot sector type:  -
    Boot sector info: 

sdc3: __________________________________________________________________________

    File system:      ext4
    Boot sector type:  -
    Boot sector info: 
    Operating System: 
    Boot files:       

============================ Drive/Partition Info: =============================

Drive: sda _____________________________________________________________________

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes

Partition  Boot  Start Sector    End Sector  # of Sectors  Id System

/dev/sda1              2,048 1,953,521,663 1,953,519,616  7 NTFS / exFAT / HPFS


Drive: sdb _____________________________________________________________________

Disk /dev/sdb: 128.0 GB, 128035676160 bytes
255 heads, 63 sectors/track, 15566 cylinders, total 250069680 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes

Partition  Boot  Start Sector    End Sector  # of Sectors  Id System

/dev/sdb1    *          2,048      206,847      204,800  7 NTFS / exFAT / HPFS
/dev/sdb2            206,848  250,066,943  249,860,096  7 NTFS / exFAT / HPFS


Drive: sdc _____________________________________________________________________

Disk /dev/sdc: 251.0 GB, 251000193024 bytes
255 heads, 63 sectors/track, 30515 cylinders, total 490234752 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes

Partition  Boot  Start Sector    End Sector  # of Sectors  Id System

/dev/sdc1    *          2,048    52,430,847    52,428,800  83 Linux
/dev/sdc2          52,430,848    77,596,671    25,165,824  82 Linux swap / Solaris
/dev/sdc3          77,596,672  490,233,855  412,637,184  83 Linux


"blkid" output: ________________________________________________________________

Device          UUID                                  TYPE      LABEL

/dev/sda1        86CEC90FCEC8F887                      ntfs      WD 1 TB
/dev/sdb1        4CE0728CE0727BD0                      ntfs      System Reserved
/dev/sdb2        1E2A81782A814E29                      ntfs     
/dev/sdc1        a1fce21e-fc0a-4593-b3fe-cd646c9fab62  ext4     
/dev/sdc2        6b8a485f-2416-4303-96df-210a14092745  swap     
/dev/sdc3        0e98187b-f194-4c1f-a5dd-e9f2c111f7d6  ext4     

================================ Mount points: =================================

Device          Mount_Point              Type      Options

/dev/sdc1        /                        ext4      (rw,commit=0)
/dev/sdc3        /home                    ext4      (rw,commit=0)


=========================== sdc1/boot/grub/grub.cfg: ===========================

--------------------------------------------------------------------------------
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_fonts ###
### END /etc/grub.d/00_fonts ###

### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
  load_env
fi
set default="${saved_entry}"
if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}

function load_video {
  insmod vbe
  insmod vga
  insmod video_bochs
  insmod video_cirrus
}

insmod part_msdos
insmod ext2
set root='(hd2,msdos1)'
search --no-floppy --fs-uuid --set=root a1fce21e-fc0a-4593-b3fe-cd646c9fab62
if loadfont /usr/share/grub/unicode.pf2 ; then
  set gfxmode=1024x768
  load_video
  # vga= is deprecated, grub2 handles this just fine
  # making grub2 res == linux fb res
  set gfxpayload=keep
  insmod gfxterm
  insmod part_msdos
  insmod ext2
  set root='(hd2,msdos1)'
  search --no-floppy --fs-uuid --set=root a1fce21e-fc0a-4593-b3fe-cd646c9fab62
  set locale_dir=($root)/boot/grub/locale
  set lang=en_US
  insmod gettext
fi
terminal_output gfxterm
if sleep --interruptible 0 ; then
  set timeout=5
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_distro_theme ###
insmod part_msdos
insmod ext2
set root='(hd2,msdos1)'
search --no-floppy --fs-uuid --set=root a1fce21e-fc0a-4593-b3fe-cd646c9fab62
insmod png
if background_image /boot/grub/default-splash.png ; then
  set color_normal=white/black
  set color_highlight=magenta/black
else
  set menu_color_normal=cyan/blue
  set menu_color_highlight=white/blue
fi
### END /etc/grub.d/05_distro_theme ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Sabayon GNU/Linux, with Linux x86_64-2.6.39-sabayon' --class sabayon --class gnu-linux --class gnu --class os {
        load_video
        insmod gzio
        insmod part_msdos
        insmod ext2
        set root='(hd2,msdos1)'
        search --no-floppy --fs-uuid --set=root a1fce21e-fc0a-4593-b3fe-cd646c9fab62
        echo        'Loading Linux x86_64-2.6.39-sabayon ...'
        linux        /boot/kernel-genkernel-x86_64-2.6.39-sabayon ro init=/linuxrc splash=silent,theme:sabayon vga=791 console=tty1 quiet dokeymap keymap=it domdadm resume=swap:UUID=6b8a485f-2416-4303-96df-210a14092745 real_resume=UUID=6b8a485f-2416-4303-96df-210a14092745 root=UUID=a1fce21e-fc0a-4593-b3fe-cd646c9fab62 docrypt
        echo        'Loading initial ramdisk ...'
        initrd        /boot/initramfs-genkernel-x86_64-2.6.39-sabayon
}
menuentry 'Sabayon GNU/Linux, with Linux x86_64-2.6.39-sabayon (recovery mode)' --class sabayon --class gnu-linux --class gnu --class os {
        load_video
        insmod gzio
        insmod part_msdos
        insmod ext2
        set root='(hd2,msdos1)'
        search --no-floppy --fs-uuid --set=root a1fce21e-fc0a-4593-b3fe-cd646c9fab62
        echo        'Loading Linux x86_64-2.6.39-sabayon ...'
        linux        /boot/kernel-genkernel-x86_64-2.6.39-sabayon ro single init_opts=single init=/linuxrc splash=verbose,theme:sabayon vga=791 console=tty1 quiet dokeymap keymap=it domdadm resume=swap:UUID=6b8a485f-2416-4303-96df-210a14092745 real_resume=UUID=6b8a485f-2416-4303-96df-210a14092745 root=UUID=a1fce21e-fc0a-4593-b3fe-cd646c9fab62 docrypt
        echo        'Loading initial ramdisk ...'
        initrd        /boot/initramfs-genkernel-x86_64-2.6.39-sabayon
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Windows 7 (loader) (on /dev/sdb1)" --class windows --class os {
        insmod part_msdos
        insmod ntfs
        set root='(hd1,msdos1)'
        search --no-floppy --fs-uuid --set=root 4CE0728CE0727BD0
        chainloader +1
}
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###
--------------------------------------------------------------------------------

========================== sdc1/boot/grub/grub.conf: ===========================

--------------------------------------------------------------------------------
default=0
timeout=10
title=Sabayon Linux (kernel-genkernel-x86_64-2.6.39-sabayon)
        root (hd0,0)
        kernel /boot/kernel-genkernel-x86_64-2.6.39-sabayon BOOT_IMAGE=/boot/kernel-genkernel-x86_64-2.6.39-sabayon ro init=/linuxrc splash=silent,theme:sabayon vga=791 console=tty1 quiet dokeymap keymap=it domdadm resume=swap:UUID=6b8a485f-2416-4303-96df-210a14092745 real_resume=UUID=6b8a485f-2416-4303-96df-210a14092745 root=UUID=a1fce21e-fc0a-4593-b3fe-cd646c9fab62 docrypt
        initrd /boot/initramfs-genkernel-x86_64-2.6.39-sabayon
        savedefault

--------------------------------------------------------------------------------

=============================== sdc1/etc/fstab: ================================

--------------------------------------------------------------------------------

#
# /etc/fstab
# Created by anaconda on Thu Nov 10 18:42:54 2011
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=a1fce21e-fc0a-4593-b3fe-cd646c9fab62 /                      ext4    defaults        1 1
UUID=0e98187b-f194-4c1f-a5dd-e9f2c111f7d6 /home                  ext4    defaults        1 2
UUID=6b8a485f-2416-4303-96df-210a14092745 swap                    swap    defaults        0 0
tmpfs                  /dev/shm                tmpfs  defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                  /sys                    sysfs  defaults        0 0
proc                    /proc                  proc    defaults        0 0
--------------------------------------------------------------------------------

=================== sdc1: Location of files loaded by Grub: ====================

          GiB - GB            File                                Fragment(s)

  0.132469177 = 0.142237696    boot/grub/core.img                            1
  18.184619904 = 19.525586944  boot/grub/grub.cfg                            1
  20.158660889 = 21.645197312  boot/grub/grub.conf                            1
  20.133995056 = 21.618712576  boot/grub/stage2                              1
  7.754722595 = 8.326569984    boot/initramfs-genkernel-x86_64-2.6.39-sabayon  2

=============================== StdErr Messages: ===============================

unlzma: (stdin): Compressed data is corrupt
umount: /tmp/BootInfo0/sdb2: device is busy.
        (In some cases useful info about processes that use
        the device is found by lsof(8) or fuser(1))
  No volume groups found
mdadm: No arrays found in config file or automatically

I'm not really concerned about moving the hard disk around. I'm currently using this config at work because I volounteered to port an existing game to Linux. In order to better convince the boss, I asked for an external drive, that way I can switch it off when I don't work on Linux and save power. You see, they kind of don't know what Linux is here, so opting for the less intrusive option "it's as if it wasn't there" was my best bet - that said, the disk should never leave this computer.
Hopefully, as the maintainer I can start to permanently work on Linux later, but one step at a time :)

Larry Webb 11-15-2011 04:27 AM

In your case I would think a boot cd would be the best option, then you would not have to change your bios. There are a lot of tutorials and downloads for (Super) grub2 boot cd in google.


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