Using grub to properly boot from an external backup drive

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












edit: I think I solved my own problem -- see bottom of question for details



I have a copy of all the files under / on an external usb-connected harddrive. To test whether this backup works, i'm trying to boot from it. However, this is proving a bit more difficult than I expected.




  1. In what I assume is the BIOS, I select my external HD as the boot device. However, whether I select this device or my usual drive as the boot device, I am shown the same GRUB menu. This happens whether I manually went and installed GRUB on my external HD or not. So my question is, is GRUB being loaded from my normal boot drive or from the external drive, and does it matter?



    • I found that when using GRUB command line without GRUB installed on my external drive, the external drive was shown as (hd2,gpt1), however after I installed GRUB on the external drive, it came up as (hd0,gpt2).



  2. Perhaps the difficulties I'm having are related to just my first question, but when I boot after specifying linux /boot/vmlinuz-linux root=/dev/sda2, I always get some failure relating to the drive specified as root not being found. This happens even when I specify root by device uuid. My question is, do I need to worry about



    • /etc/fstab? Is this something I need to change in order to make sure that root is found? And does it matter whether I change the /etc/fstab file on my internal drive or on the external one. (I did modify /etc/fstab on the external drive so that the drive with the UUID of the root partition should be mounted to /, but to no avail)


    • Perhaps because it is a usb connected external HD, do I need to do anything special? I noticed seeing the error usb 2-4: device descriptor read/64, error -71 while booting normally, but since this has no apparent effect on the functionality of the drive, I ignored it. This error also appeared on two separate external HD docks, so I assume it is not a hardware issue.




Clarifications:



I created my external backup using Borg, which creates a copy of all the files. It doesn't copy the entire disk over like dd, so for example while installing grub I still need to manually create a partition with the bios_grub flag.



The exact command I use in grub while attempting to boot is



set root=(hd0,gpt2)
linux vmlinuz-linux root=/dev/sda2
initrd initramfs-linux.img
boot



I've managed to boot.



I had tried both linux /boot/vmlinuz-linux root=/dev/sda2 and linux /boot/vmlinuz-linux root=/dev/sdc2 to no avail -- the first because the drive was showing up as (hd0,gpt2) in grub, and the second because the partition gets labeled as /dev/sdc2 when I boot normally. However, neither of these worked, and both dropped me into a strange command line. I discovered that the partition with the correct UUID was actually mounted to /dev/sdb2 for some reason! Using root=/dev/sdb2 I booted the system just fine. I think my previous attempts to boot by specifying UUID failed for one of various reasons (GRUB not being installed, typos in the UUID, etc).



This is pretty anticlimactic. I am still curious about the original questions I had -- namely, 1. how it is decided which GRUB is used when there are multiple drives with GRUB installed? 2. does /etc/fstab play a role in the booting process, or is it irrelevant? -- and I'll award the bounty for answers to those questions.










share|improve this question























  • How did you create the USB? RSync? Can you show an example just to clarify.
    – FreeSoftwareServers
    Nov 26 at 19:37










  • Yes, I used Borg to backup and extract a copy of my files onto the external HD. It backs up everything on the "file level", so it's not quite the same as using dd.
    – shimao
    Nov 26 at 20:02










  • from what I read borg is a BorgBackup (short: Borg) is a deduplicating backup program, this doesn't sound appropriate for making a OS backup that you expect to be bootable, but I could be wrong. I would try RSync. wiki.archlinux.org/index.php/rsync#Full_system_backup
    – FreeSoftwareServers
    Nov 26 at 23:14










  • I backup everything under / using borg, so it should be at least as good as rsync in that respect. rsync probably also doesn't deal with deduplication or encryption, so it's not as suitable for making backups. I don't think it would solve my problem either, since my question deals with how grub works / how the booting process works -- questions I imagine I would still have if I used rsync.
    – shimao
    Nov 27 at 2:56











  • 2 questions : are you using a regular BIOS or UEFI ? Did you make sure your initrd is able to access an usb device (the way to do it depends on your distribution) ?
    – Pierre-Alain TORET
    Nov 27 at 10:29














up vote
1
down vote

favorite












edit: I think I solved my own problem -- see bottom of question for details



I have a copy of all the files under / on an external usb-connected harddrive. To test whether this backup works, i'm trying to boot from it. However, this is proving a bit more difficult than I expected.




  1. In what I assume is the BIOS, I select my external HD as the boot device. However, whether I select this device or my usual drive as the boot device, I am shown the same GRUB menu. This happens whether I manually went and installed GRUB on my external HD or not. So my question is, is GRUB being loaded from my normal boot drive or from the external drive, and does it matter?



    • I found that when using GRUB command line without GRUB installed on my external drive, the external drive was shown as (hd2,gpt1), however after I installed GRUB on the external drive, it came up as (hd0,gpt2).



  2. Perhaps the difficulties I'm having are related to just my first question, but when I boot after specifying linux /boot/vmlinuz-linux root=/dev/sda2, I always get some failure relating to the drive specified as root not being found. This happens even when I specify root by device uuid. My question is, do I need to worry about



    • /etc/fstab? Is this something I need to change in order to make sure that root is found? And does it matter whether I change the /etc/fstab file on my internal drive or on the external one. (I did modify /etc/fstab on the external drive so that the drive with the UUID of the root partition should be mounted to /, but to no avail)


    • Perhaps because it is a usb connected external HD, do I need to do anything special? I noticed seeing the error usb 2-4: device descriptor read/64, error -71 while booting normally, but since this has no apparent effect on the functionality of the drive, I ignored it. This error also appeared on two separate external HD docks, so I assume it is not a hardware issue.




Clarifications:



I created my external backup using Borg, which creates a copy of all the files. It doesn't copy the entire disk over like dd, so for example while installing grub I still need to manually create a partition with the bios_grub flag.



The exact command I use in grub while attempting to boot is



set root=(hd0,gpt2)
linux vmlinuz-linux root=/dev/sda2
initrd initramfs-linux.img
boot



I've managed to boot.



I had tried both linux /boot/vmlinuz-linux root=/dev/sda2 and linux /boot/vmlinuz-linux root=/dev/sdc2 to no avail -- the first because the drive was showing up as (hd0,gpt2) in grub, and the second because the partition gets labeled as /dev/sdc2 when I boot normally. However, neither of these worked, and both dropped me into a strange command line. I discovered that the partition with the correct UUID was actually mounted to /dev/sdb2 for some reason! Using root=/dev/sdb2 I booted the system just fine. I think my previous attempts to boot by specifying UUID failed for one of various reasons (GRUB not being installed, typos in the UUID, etc).



This is pretty anticlimactic. I am still curious about the original questions I had -- namely, 1. how it is decided which GRUB is used when there are multiple drives with GRUB installed? 2. does /etc/fstab play a role in the booting process, or is it irrelevant? -- and I'll award the bounty for answers to those questions.










share|improve this question























  • How did you create the USB? RSync? Can you show an example just to clarify.
    – FreeSoftwareServers
    Nov 26 at 19:37










  • Yes, I used Borg to backup and extract a copy of my files onto the external HD. It backs up everything on the "file level", so it's not quite the same as using dd.
    – shimao
    Nov 26 at 20:02










  • from what I read borg is a BorgBackup (short: Borg) is a deduplicating backup program, this doesn't sound appropriate for making a OS backup that you expect to be bootable, but I could be wrong. I would try RSync. wiki.archlinux.org/index.php/rsync#Full_system_backup
    – FreeSoftwareServers
    Nov 26 at 23:14










  • I backup everything under / using borg, so it should be at least as good as rsync in that respect. rsync probably also doesn't deal with deduplication or encryption, so it's not as suitable for making backups. I don't think it would solve my problem either, since my question deals with how grub works / how the booting process works -- questions I imagine I would still have if I used rsync.
    – shimao
    Nov 27 at 2:56











  • 2 questions : are you using a regular BIOS or UEFI ? Did you make sure your initrd is able to access an usb device (the way to do it depends on your distribution) ?
    – Pierre-Alain TORET
    Nov 27 at 10:29












up vote
1
down vote

favorite









up vote
1
down vote

favorite











edit: I think I solved my own problem -- see bottom of question for details



I have a copy of all the files under / on an external usb-connected harddrive. To test whether this backup works, i'm trying to boot from it. However, this is proving a bit more difficult than I expected.




  1. In what I assume is the BIOS, I select my external HD as the boot device. However, whether I select this device or my usual drive as the boot device, I am shown the same GRUB menu. This happens whether I manually went and installed GRUB on my external HD or not. So my question is, is GRUB being loaded from my normal boot drive or from the external drive, and does it matter?



    • I found that when using GRUB command line without GRUB installed on my external drive, the external drive was shown as (hd2,gpt1), however after I installed GRUB on the external drive, it came up as (hd0,gpt2).



  2. Perhaps the difficulties I'm having are related to just my first question, but when I boot after specifying linux /boot/vmlinuz-linux root=/dev/sda2, I always get some failure relating to the drive specified as root not being found. This happens even when I specify root by device uuid. My question is, do I need to worry about



    • /etc/fstab? Is this something I need to change in order to make sure that root is found? And does it matter whether I change the /etc/fstab file on my internal drive or on the external one. (I did modify /etc/fstab on the external drive so that the drive with the UUID of the root partition should be mounted to /, but to no avail)


    • Perhaps because it is a usb connected external HD, do I need to do anything special? I noticed seeing the error usb 2-4: device descriptor read/64, error -71 while booting normally, but since this has no apparent effect on the functionality of the drive, I ignored it. This error also appeared on two separate external HD docks, so I assume it is not a hardware issue.




Clarifications:



I created my external backup using Borg, which creates a copy of all the files. It doesn't copy the entire disk over like dd, so for example while installing grub I still need to manually create a partition with the bios_grub flag.



The exact command I use in grub while attempting to boot is



set root=(hd0,gpt2)
linux vmlinuz-linux root=/dev/sda2
initrd initramfs-linux.img
boot



I've managed to boot.



I had tried both linux /boot/vmlinuz-linux root=/dev/sda2 and linux /boot/vmlinuz-linux root=/dev/sdc2 to no avail -- the first because the drive was showing up as (hd0,gpt2) in grub, and the second because the partition gets labeled as /dev/sdc2 when I boot normally. However, neither of these worked, and both dropped me into a strange command line. I discovered that the partition with the correct UUID was actually mounted to /dev/sdb2 for some reason! Using root=/dev/sdb2 I booted the system just fine. I think my previous attempts to boot by specifying UUID failed for one of various reasons (GRUB not being installed, typos in the UUID, etc).



This is pretty anticlimactic. I am still curious about the original questions I had -- namely, 1. how it is decided which GRUB is used when there are multiple drives with GRUB installed? 2. does /etc/fstab play a role in the booting process, or is it irrelevant? -- and I'll award the bounty for answers to those questions.










share|improve this question















edit: I think I solved my own problem -- see bottom of question for details



I have a copy of all the files under / on an external usb-connected harddrive. To test whether this backup works, i'm trying to boot from it. However, this is proving a bit more difficult than I expected.




  1. In what I assume is the BIOS, I select my external HD as the boot device. However, whether I select this device or my usual drive as the boot device, I am shown the same GRUB menu. This happens whether I manually went and installed GRUB on my external HD or not. So my question is, is GRUB being loaded from my normal boot drive or from the external drive, and does it matter?



    • I found that when using GRUB command line without GRUB installed on my external drive, the external drive was shown as (hd2,gpt1), however after I installed GRUB on the external drive, it came up as (hd0,gpt2).



  2. Perhaps the difficulties I'm having are related to just my first question, but when I boot after specifying linux /boot/vmlinuz-linux root=/dev/sda2, I always get some failure relating to the drive specified as root not being found. This happens even when I specify root by device uuid. My question is, do I need to worry about



    • /etc/fstab? Is this something I need to change in order to make sure that root is found? And does it matter whether I change the /etc/fstab file on my internal drive or on the external one. (I did modify /etc/fstab on the external drive so that the drive with the UUID of the root partition should be mounted to /, but to no avail)


    • Perhaps because it is a usb connected external HD, do I need to do anything special? I noticed seeing the error usb 2-4: device descriptor read/64, error -71 while booting normally, but since this has no apparent effect on the functionality of the drive, I ignored it. This error also appeared on two separate external HD docks, so I assume it is not a hardware issue.




Clarifications:



I created my external backup using Borg, which creates a copy of all the files. It doesn't copy the entire disk over like dd, so for example while installing grub I still need to manually create a partition with the bios_grub flag.



The exact command I use in grub while attempting to boot is



set root=(hd0,gpt2)
linux vmlinuz-linux root=/dev/sda2
initrd initramfs-linux.img
boot



I've managed to boot.



I had tried both linux /boot/vmlinuz-linux root=/dev/sda2 and linux /boot/vmlinuz-linux root=/dev/sdc2 to no avail -- the first because the drive was showing up as (hd0,gpt2) in grub, and the second because the partition gets labeled as /dev/sdc2 when I boot normally. However, neither of these worked, and both dropped me into a strange command line. I discovered that the partition with the correct UUID was actually mounted to /dev/sdb2 for some reason! Using root=/dev/sdb2 I booted the system just fine. I think my previous attempts to boot by specifying UUID failed for one of various reasons (GRUB not being installed, typos in the UUID, etc).



This is pretty anticlimactic. I am still curious about the original questions I had -- namely, 1. how it is decided which GRUB is used when there are multiple drives with GRUB installed? 2. does /etc/fstab play a role in the booting process, or is it irrelevant? -- and I'll award the bounty for answers to those questions.







boot grub2 grub fstab






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited yesterday









Rui F Ribeiro

38.3k1476127




38.3k1476127










asked Nov 24 at 16:22









shimao

587




587











  • How did you create the USB? RSync? Can you show an example just to clarify.
    – FreeSoftwareServers
    Nov 26 at 19:37










  • Yes, I used Borg to backup and extract a copy of my files onto the external HD. It backs up everything on the "file level", so it's not quite the same as using dd.
    – shimao
    Nov 26 at 20:02










  • from what I read borg is a BorgBackup (short: Borg) is a deduplicating backup program, this doesn't sound appropriate for making a OS backup that you expect to be bootable, but I could be wrong. I would try RSync. wiki.archlinux.org/index.php/rsync#Full_system_backup
    – FreeSoftwareServers
    Nov 26 at 23:14










  • I backup everything under / using borg, so it should be at least as good as rsync in that respect. rsync probably also doesn't deal with deduplication or encryption, so it's not as suitable for making backups. I don't think it would solve my problem either, since my question deals with how grub works / how the booting process works -- questions I imagine I would still have if I used rsync.
    – shimao
    Nov 27 at 2:56











  • 2 questions : are you using a regular BIOS or UEFI ? Did you make sure your initrd is able to access an usb device (the way to do it depends on your distribution) ?
    – Pierre-Alain TORET
    Nov 27 at 10:29
















  • How did you create the USB? RSync? Can you show an example just to clarify.
    – FreeSoftwareServers
    Nov 26 at 19:37










  • Yes, I used Borg to backup and extract a copy of my files onto the external HD. It backs up everything on the "file level", so it's not quite the same as using dd.
    – shimao
    Nov 26 at 20:02










  • from what I read borg is a BorgBackup (short: Borg) is a deduplicating backup program, this doesn't sound appropriate for making a OS backup that you expect to be bootable, but I could be wrong. I would try RSync. wiki.archlinux.org/index.php/rsync#Full_system_backup
    – FreeSoftwareServers
    Nov 26 at 23:14










  • I backup everything under / using borg, so it should be at least as good as rsync in that respect. rsync probably also doesn't deal with deduplication or encryption, so it's not as suitable for making backups. I don't think it would solve my problem either, since my question deals with how grub works / how the booting process works -- questions I imagine I would still have if I used rsync.
    – shimao
    Nov 27 at 2:56











  • 2 questions : are you using a regular BIOS or UEFI ? Did you make sure your initrd is able to access an usb device (the way to do it depends on your distribution) ?
    – Pierre-Alain TORET
    Nov 27 at 10:29















How did you create the USB? RSync? Can you show an example just to clarify.
– FreeSoftwareServers
Nov 26 at 19:37




How did you create the USB? RSync? Can you show an example just to clarify.
– FreeSoftwareServers
Nov 26 at 19:37












Yes, I used Borg to backup and extract a copy of my files onto the external HD. It backs up everything on the "file level", so it's not quite the same as using dd.
– shimao
Nov 26 at 20:02




Yes, I used Borg to backup and extract a copy of my files onto the external HD. It backs up everything on the "file level", so it's not quite the same as using dd.
– shimao
Nov 26 at 20:02












from what I read borg is a BorgBackup (short: Borg) is a deduplicating backup program, this doesn't sound appropriate for making a OS backup that you expect to be bootable, but I could be wrong. I would try RSync. wiki.archlinux.org/index.php/rsync#Full_system_backup
– FreeSoftwareServers
Nov 26 at 23:14




from what I read borg is a BorgBackup (short: Borg) is a deduplicating backup program, this doesn't sound appropriate for making a OS backup that you expect to be bootable, but I could be wrong. I would try RSync. wiki.archlinux.org/index.php/rsync#Full_system_backup
– FreeSoftwareServers
Nov 26 at 23:14












I backup everything under / using borg, so it should be at least as good as rsync in that respect. rsync probably also doesn't deal with deduplication or encryption, so it's not as suitable for making backups. I don't think it would solve my problem either, since my question deals with how grub works / how the booting process works -- questions I imagine I would still have if I used rsync.
– shimao
Nov 27 at 2:56





I backup everything under / using borg, so it should be at least as good as rsync in that respect. rsync probably also doesn't deal with deduplication or encryption, so it's not as suitable for making backups. I don't think it would solve my problem either, since my question deals with how grub works / how the booting process works -- questions I imagine I would still have if I used rsync.
– shimao
Nov 27 at 2:56













2 questions : are you using a regular BIOS or UEFI ? Did you make sure your initrd is able to access an usb device (the way to do it depends on your distribution) ?
– Pierre-Alain TORET
Nov 27 at 10:29




2 questions : are you using a regular BIOS or UEFI ? Did you make sure your initrd is able to access an usb device (the way to do it depends on your distribution) ?
– Pierre-Alain TORET
Nov 27 at 10:29










2 Answers
2






active

oldest

votes

















up vote
3
down vote



accepted










your problem is root=/dev/sda2 because that is doing a mount by device name which is not unique. If you have only one drive installed, then that will typically always show up as /dev/sda so no problem. But install a second disk or any other thing in addition that shows up as /dev/sd? then there is no guarantee of the order of anything and oftentimes what was sda is moved down to sdb... can become messy quick and fail.



Best to mount via by device-id or by-uuid which will be unique.



Under /dev/disk/ you will see folders like



  • by-id/

  • by-label/

  • by-path/

  • by-uuid/

And for example under by-id/ you will see links such as



here is my /etc/fstab that mounts by device-id to give you an idea, i removed extra lines to keep it on point. And I use EFI not GRUB, but the principle is the same just more elaborate with Grub the grand part in grand unified boot loader:



/dev/disk/by-id/scsi-35000cca070168a20-part2 / ext3 acl,user_xattr 1 1
/dev/disk/by-id/scsi-35000cca070168a20-part1 /boot/efi vfat umask=0002,utf8=true 0 0
/dev/disk/by-id/scsi-36003048018e26e011d81ba1714e4c99f-part1 /data xfs defaults 1 0
/dev/disk/by-id/scsi-36003048018fa44011d57b61bbe1b8533-part1 /scratch xfs defaults 1 0
/dev/disk/by-id/scsi-36003048018e266011d81ba7e1afeadf6-part1 /bkup xfs defaults 1 2


Note: this is what I see in SLES 11.4. And while I use EFI, you need to find the specific items within GRUB or GRUB2 and modify. As an example here is my /boot/efi/efi/SuSE/elilo.conf file, notice the root= part. What corresponds to this in your GRUB you want to modify to be either by device-id or by uuid. and don't forget to modify /etc/fstab to be by a unique method also either by-id or by-uuid.



# This file has been transformed by /sbin/elilo.
# Please do NOT edit here -- edit /etc/elilo.conf instead!
# Otherwise your changes will be lost e.g. during kernel-update.
#
# Modified by YaST2. Last modification on Mon Oct 15 11:04:42 EDT 2018
timeout = 80
##YaST - boot_efilabel = "SUSE Linux Enterprise Server 11 SP4"
default = SLES11_SP4_16
prompt

image = vmlinuz-3.0.101-108.77-default
###Don't change this comment - YaST2 identifier: Original name: linux###
label = SLES11_SP4_16
append = "splash=verbose showopts "
initrd = initrd-3.0.101-108.77-default
root = /dev/disk/by-id/scsi-35000cca070168a20-part2

image = vmlinuz-3.0.101-108.77-default
###Don't change this comment - YaST2 identifier: Original name: failsafe###
label = Failsafe_15
append = "showopts ide=nodma apm=off noresume edd=off powersaved=off nohz=off highres=off processor.max_cstate=1 nomodeset x11failsafe "
description = "Failsafe (3.0.101-108.77-default)"
initrd = initrd-3.0.101-108.77-default
root = /dev/disk/by-id/scsi-35000cca070168a20-part2


You do NOT want boot=/dev/sd? or root=/dev/sd? anywhere, where ? is whatever letter. Reference the disk out of /dev/disk/by-id or /dev/disk/by-uuid; you could even use by-label provided you set partition labels and trust them to be unique.






share|improve this answer




















  • I love using Labels personally!
    – FreeSoftwareServers
    Nov 28 at 16:47

















up vote
1
down vote



+50










This should answer your questions:



  • Generally, the GRUB that is used is the one that is on the disk that is seen first by the BIOS or selected to be run first in BIOS. Because the MBR of the drive pionts to the GRUB that loads.


  • The /etc/fstab is only responsible for automating the process of mounting, partitions.
    In curtain cases you can bypass the fstab completely.






share|improve this answer




















    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "106"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f483888%2fusing-grub-to-properly-boot-from-an-external-backup-drive%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    3
    down vote



    accepted










    your problem is root=/dev/sda2 because that is doing a mount by device name which is not unique. If you have only one drive installed, then that will typically always show up as /dev/sda so no problem. But install a second disk or any other thing in addition that shows up as /dev/sd? then there is no guarantee of the order of anything and oftentimes what was sda is moved down to sdb... can become messy quick and fail.



    Best to mount via by device-id or by-uuid which will be unique.



    Under /dev/disk/ you will see folders like



    • by-id/

    • by-label/

    • by-path/

    • by-uuid/

    And for example under by-id/ you will see links such as



    here is my /etc/fstab that mounts by device-id to give you an idea, i removed extra lines to keep it on point. And I use EFI not GRUB, but the principle is the same just more elaborate with Grub the grand part in grand unified boot loader:



    /dev/disk/by-id/scsi-35000cca070168a20-part2 / ext3 acl,user_xattr 1 1
    /dev/disk/by-id/scsi-35000cca070168a20-part1 /boot/efi vfat umask=0002,utf8=true 0 0
    /dev/disk/by-id/scsi-36003048018e26e011d81ba1714e4c99f-part1 /data xfs defaults 1 0
    /dev/disk/by-id/scsi-36003048018fa44011d57b61bbe1b8533-part1 /scratch xfs defaults 1 0
    /dev/disk/by-id/scsi-36003048018e266011d81ba7e1afeadf6-part1 /bkup xfs defaults 1 2


    Note: this is what I see in SLES 11.4. And while I use EFI, you need to find the specific items within GRUB or GRUB2 and modify. As an example here is my /boot/efi/efi/SuSE/elilo.conf file, notice the root= part. What corresponds to this in your GRUB you want to modify to be either by device-id or by uuid. and don't forget to modify /etc/fstab to be by a unique method also either by-id or by-uuid.



    # This file has been transformed by /sbin/elilo.
    # Please do NOT edit here -- edit /etc/elilo.conf instead!
    # Otherwise your changes will be lost e.g. during kernel-update.
    #
    # Modified by YaST2. Last modification on Mon Oct 15 11:04:42 EDT 2018
    timeout = 80
    ##YaST - boot_efilabel = "SUSE Linux Enterprise Server 11 SP4"
    default = SLES11_SP4_16
    prompt

    image = vmlinuz-3.0.101-108.77-default
    ###Don't change this comment - YaST2 identifier: Original name: linux###
    label = SLES11_SP4_16
    append = "splash=verbose showopts "
    initrd = initrd-3.0.101-108.77-default
    root = /dev/disk/by-id/scsi-35000cca070168a20-part2

    image = vmlinuz-3.0.101-108.77-default
    ###Don't change this comment - YaST2 identifier: Original name: failsafe###
    label = Failsafe_15
    append = "showopts ide=nodma apm=off noresume edd=off powersaved=off nohz=off highres=off processor.max_cstate=1 nomodeset x11failsafe "
    description = "Failsafe (3.0.101-108.77-default)"
    initrd = initrd-3.0.101-108.77-default
    root = /dev/disk/by-id/scsi-35000cca070168a20-part2


    You do NOT want boot=/dev/sd? or root=/dev/sd? anywhere, where ? is whatever letter. Reference the disk out of /dev/disk/by-id or /dev/disk/by-uuid; you could even use by-label provided you set partition labels and trust them to be unique.






    share|improve this answer




















    • I love using Labels personally!
      – FreeSoftwareServers
      Nov 28 at 16:47














    up vote
    3
    down vote



    accepted










    your problem is root=/dev/sda2 because that is doing a mount by device name which is not unique. If you have only one drive installed, then that will typically always show up as /dev/sda so no problem. But install a second disk or any other thing in addition that shows up as /dev/sd? then there is no guarantee of the order of anything and oftentimes what was sda is moved down to sdb... can become messy quick and fail.



    Best to mount via by device-id or by-uuid which will be unique.



    Under /dev/disk/ you will see folders like



    • by-id/

    • by-label/

    • by-path/

    • by-uuid/

    And for example under by-id/ you will see links such as



    here is my /etc/fstab that mounts by device-id to give you an idea, i removed extra lines to keep it on point. And I use EFI not GRUB, but the principle is the same just more elaborate with Grub the grand part in grand unified boot loader:



    /dev/disk/by-id/scsi-35000cca070168a20-part2 / ext3 acl,user_xattr 1 1
    /dev/disk/by-id/scsi-35000cca070168a20-part1 /boot/efi vfat umask=0002,utf8=true 0 0
    /dev/disk/by-id/scsi-36003048018e26e011d81ba1714e4c99f-part1 /data xfs defaults 1 0
    /dev/disk/by-id/scsi-36003048018fa44011d57b61bbe1b8533-part1 /scratch xfs defaults 1 0
    /dev/disk/by-id/scsi-36003048018e266011d81ba7e1afeadf6-part1 /bkup xfs defaults 1 2


    Note: this is what I see in SLES 11.4. And while I use EFI, you need to find the specific items within GRUB or GRUB2 and modify. As an example here is my /boot/efi/efi/SuSE/elilo.conf file, notice the root= part. What corresponds to this in your GRUB you want to modify to be either by device-id or by uuid. and don't forget to modify /etc/fstab to be by a unique method also either by-id or by-uuid.



    # This file has been transformed by /sbin/elilo.
    # Please do NOT edit here -- edit /etc/elilo.conf instead!
    # Otherwise your changes will be lost e.g. during kernel-update.
    #
    # Modified by YaST2. Last modification on Mon Oct 15 11:04:42 EDT 2018
    timeout = 80
    ##YaST - boot_efilabel = "SUSE Linux Enterprise Server 11 SP4"
    default = SLES11_SP4_16
    prompt

    image = vmlinuz-3.0.101-108.77-default
    ###Don't change this comment - YaST2 identifier: Original name: linux###
    label = SLES11_SP4_16
    append = "splash=verbose showopts "
    initrd = initrd-3.0.101-108.77-default
    root = /dev/disk/by-id/scsi-35000cca070168a20-part2

    image = vmlinuz-3.0.101-108.77-default
    ###Don't change this comment - YaST2 identifier: Original name: failsafe###
    label = Failsafe_15
    append = "showopts ide=nodma apm=off noresume edd=off powersaved=off nohz=off highres=off processor.max_cstate=1 nomodeset x11failsafe "
    description = "Failsafe (3.0.101-108.77-default)"
    initrd = initrd-3.0.101-108.77-default
    root = /dev/disk/by-id/scsi-35000cca070168a20-part2


    You do NOT want boot=/dev/sd? or root=/dev/sd? anywhere, where ? is whatever letter. Reference the disk out of /dev/disk/by-id or /dev/disk/by-uuid; you could even use by-label provided you set partition labels and trust them to be unique.






    share|improve this answer




















    • I love using Labels personally!
      – FreeSoftwareServers
      Nov 28 at 16:47












    up vote
    3
    down vote



    accepted







    up vote
    3
    down vote



    accepted






    your problem is root=/dev/sda2 because that is doing a mount by device name which is not unique. If you have only one drive installed, then that will typically always show up as /dev/sda so no problem. But install a second disk or any other thing in addition that shows up as /dev/sd? then there is no guarantee of the order of anything and oftentimes what was sda is moved down to sdb... can become messy quick and fail.



    Best to mount via by device-id or by-uuid which will be unique.



    Under /dev/disk/ you will see folders like



    • by-id/

    • by-label/

    • by-path/

    • by-uuid/

    And for example under by-id/ you will see links such as



    here is my /etc/fstab that mounts by device-id to give you an idea, i removed extra lines to keep it on point. And I use EFI not GRUB, but the principle is the same just more elaborate with Grub the grand part in grand unified boot loader:



    /dev/disk/by-id/scsi-35000cca070168a20-part2 / ext3 acl,user_xattr 1 1
    /dev/disk/by-id/scsi-35000cca070168a20-part1 /boot/efi vfat umask=0002,utf8=true 0 0
    /dev/disk/by-id/scsi-36003048018e26e011d81ba1714e4c99f-part1 /data xfs defaults 1 0
    /dev/disk/by-id/scsi-36003048018fa44011d57b61bbe1b8533-part1 /scratch xfs defaults 1 0
    /dev/disk/by-id/scsi-36003048018e266011d81ba7e1afeadf6-part1 /bkup xfs defaults 1 2


    Note: this is what I see in SLES 11.4. And while I use EFI, you need to find the specific items within GRUB or GRUB2 and modify. As an example here is my /boot/efi/efi/SuSE/elilo.conf file, notice the root= part. What corresponds to this in your GRUB you want to modify to be either by device-id or by uuid. and don't forget to modify /etc/fstab to be by a unique method also either by-id or by-uuid.



    # This file has been transformed by /sbin/elilo.
    # Please do NOT edit here -- edit /etc/elilo.conf instead!
    # Otherwise your changes will be lost e.g. during kernel-update.
    #
    # Modified by YaST2. Last modification on Mon Oct 15 11:04:42 EDT 2018
    timeout = 80
    ##YaST - boot_efilabel = "SUSE Linux Enterprise Server 11 SP4"
    default = SLES11_SP4_16
    prompt

    image = vmlinuz-3.0.101-108.77-default
    ###Don't change this comment - YaST2 identifier: Original name: linux###
    label = SLES11_SP4_16
    append = "splash=verbose showopts "
    initrd = initrd-3.0.101-108.77-default
    root = /dev/disk/by-id/scsi-35000cca070168a20-part2

    image = vmlinuz-3.0.101-108.77-default
    ###Don't change this comment - YaST2 identifier: Original name: failsafe###
    label = Failsafe_15
    append = "showopts ide=nodma apm=off noresume edd=off powersaved=off nohz=off highres=off processor.max_cstate=1 nomodeset x11failsafe "
    description = "Failsafe (3.0.101-108.77-default)"
    initrd = initrd-3.0.101-108.77-default
    root = /dev/disk/by-id/scsi-35000cca070168a20-part2


    You do NOT want boot=/dev/sd? or root=/dev/sd? anywhere, where ? is whatever letter. Reference the disk out of /dev/disk/by-id or /dev/disk/by-uuid; you could even use by-label provided you set partition labels and trust them to be unique.






    share|improve this answer












    your problem is root=/dev/sda2 because that is doing a mount by device name which is not unique. If you have only one drive installed, then that will typically always show up as /dev/sda so no problem. But install a second disk or any other thing in addition that shows up as /dev/sd? then there is no guarantee of the order of anything and oftentimes what was sda is moved down to sdb... can become messy quick and fail.



    Best to mount via by device-id or by-uuid which will be unique.



    Under /dev/disk/ you will see folders like



    • by-id/

    • by-label/

    • by-path/

    • by-uuid/

    And for example under by-id/ you will see links such as



    here is my /etc/fstab that mounts by device-id to give you an idea, i removed extra lines to keep it on point. And I use EFI not GRUB, but the principle is the same just more elaborate with Grub the grand part in grand unified boot loader:



    /dev/disk/by-id/scsi-35000cca070168a20-part2 / ext3 acl,user_xattr 1 1
    /dev/disk/by-id/scsi-35000cca070168a20-part1 /boot/efi vfat umask=0002,utf8=true 0 0
    /dev/disk/by-id/scsi-36003048018e26e011d81ba1714e4c99f-part1 /data xfs defaults 1 0
    /dev/disk/by-id/scsi-36003048018fa44011d57b61bbe1b8533-part1 /scratch xfs defaults 1 0
    /dev/disk/by-id/scsi-36003048018e266011d81ba7e1afeadf6-part1 /bkup xfs defaults 1 2


    Note: this is what I see in SLES 11.4. And while I use EFI, you need to find the specific items within GRUB or GRUB2 and modify. As an example here is my /boot/efi/efi/SuSE/elilo.conf file, notice the root= part. What corresponds to this in your GRUB you want to modify to be either by device-id or by uuid. and don't forget to modify /etc/fstab to be by a unique method also either by-id or by-uuid.



    # This file has been transformed by /sbin/elilo.
    # Please do NOT edit here -- edit /etc/elilo.conf instead!
    # Otherwise your changes will be lost e.g. during kernel-update.
    #
    # Modified by YaST2. Last modification on Mon Oct 15 11:04:42 EDT 2018
    timeout = 80
    ##YaST - boot_efilabel = "SUSE Linux Enterprise Server 11 SP4"
    default = SLES11_SP4_16
    prompt

    image = vmlinuz-3.0.101-108.77-default
    ###Don't change this comment - YaST2 identifier: Original name: linux###
    label = SLES11_SP4_16
    append = "splash=verbose showopts "
    initrd = initrd-3.0.101-108.77-default
    root = /dev/disk/by-id/scsi-35000cca070168a20-part2

    image = vmlinuz-3.0.101-108.77-default
    ###Don't change this comment - YaST2 identifier: Original name: failsafe###
    label = Failsafe_15
    append = "showopts ide=nodma apm=off noresume edd=off powersaved=off nohz=off highres=off processor.max_cstate=1 nomodeset x11failsafe "
    description = "Failsafe (3.0.101-108.77-default)"
    initrd = initrd-3.0.101-108.77-default
    root = /dev/disk/by-id/scsi-35000cca070168a20-part2


    You do NOT want boot=/dev/sd? or root=/dev/sd? anywhere, where ? is whatever letter. Reference the disk out of /dev/disk/by-id or /dev/disk/by-uuid; you could even use by-label provided you set partition labels and trust them to be unique.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Nov 27 at 18:37









    ron

    8731714




    8731714











    • I love using Labels personally!
      – FreeSoftwareServers
      Nov 28 at 16:47
















    • I love using Labels personally!
      – FreeSoftwareServers
      Nov 28 at 16:47















    I love using Labels personally!
    – FreeSoftwareServers
    Nov 28 at 16:47




    I love using Labels personally!
    – FreeSoftwareServers
    Nov 28 at 16:47












    up vote
    1
    down vote



    +50










    This should answer your questions:



    • Generally, the GRUB that is used is the one that is on the disk that is seen first by the BIOS or selected to be run first in BIOS. Because the MBR of the drive pionts to the GRUB that loads.


    • The /etc/fstab is only responsible for automating the process of mounting, partitions.
      In curtain cases you can bypass the fstab completely.






    share|improve this answer
























      up vote
      1
      down vote



      +50










      This should answer your questions:



      • Generally, the GRUB that is used is the one that is on the disk that is seen first by the BIOS or selected to be run first in BIOS. Because the MBR of the drive pionts to the GRUB that loads.


      • The /etc/fstab is only responsible for automating the process of mounting, partitions.
        In curtain cases you can bypass the fstab completely.






      share|improve this answer






















        up vote
        1
        down vote



        +50







        up vote
        1
        down vote



        +50




        +50




        This should answer your questions:



        • Generally, the GRUB that is used is the one that is on the disk that is seen first by the BIOS or selected to be run first in BIOS. Because the MBR of the drive pionts to the GRUB that loads.


        • The /etc/fstab is only responsible for automating the process of mounting, partitions.
          In curtain cases you can bypass the fstab completely.






        share|improve this answer












        This should answer your questions:



        • Generally, the GRUB that is used is the one that is on the disk that is seen first by the BIOS or selected to be run first in BIOS. Because the MBR of the drive pionts to the GRUB that loads.


        • The /etc/fstab is only responsible for automating the process of mounting, partitions.
          In curtain cases you can bypass the fstab completely.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 27 at 19:05









        Michael Prokopec

        68916




        68916



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f483888%2fusing-grub-to-properly-boot-from-an-external-backup-drive%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown






            Popular posts from this blog

            How to check contact read email or not when send email to Individual?

            Bahrain

            Postfix configuration issue with fips on centos 7; mailgun relay