LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 01-25-2020, 09:10 AM   #1
starfiend
LQ Newbie
 
Registered: Mar 2006
Location: South Wales
Distribution: Mint, Fedora
Posts: 12

Rep: Reputation: 2
Booting issues when I remove a dead hard drive


Hi Folks,

The PC I have has six hard drives, 3 x 2TB and 3x 320GB. A few weeks ago I noticed that one of the drives was 'broken'. It made strange noises on boot up and the scratch directory it was configured for has basically disappeared. That in it self wasn't an issue as it was empty, so I didn't lose any data. Over last weekend I decided to remove it, and two of the other drives as I wasn't using them and thought I might be able to use them in another PC.

Anyway, using LSHW, I identified the serial numbers of the hard drives and from that removed the three drives I wanted out.

This is where my problems started. When I rebooted, the machine refused to boot, saying it couldn't find /dev/sde1. I took a closer look at my LSHW output and realised I'd been a bit careless when I'd initially built and installed the OS. My drives were:

/dev/sda1 (2TB) was /home and was on one of the mobo's own sata ports.
/dev/sdb1 (2TB) was /scratch and on the other mobo sata port.

The remaining disks are attached to a 4-port internal SATA card plugged into the mobo.

/dev/sdc (2TB) was completely broken, gparted refused to access anything, getting hung up trying to access this disk.
/dev/sdd (320GB) seems to have 4 partitions on it, a 1GB partition, which just shows up a 1 1gb partition on the desk top, an extended partition and 2 linux filesystem partitions, both of which show as 'unclaimed'.
/dev/sde (320GB) has three partitions: sde1 is / sde2 is /boot and /sde3 is the swap partition
/dev/sef (320GB) was showing as 'inaccessible', though I've no real idea what that actually means.

I put all the disks back in again and rebooted, and everything worked. It still worked when I removed the /dev/sdf drive, but I've now got to the point where I daren't remove anything else, particularly the broken drive, as I don't know whether I would be able to rescue the machine.

I checked my /etc/fstab file:
UUID=eecc5495-52ba-4d49-904b-e672979dbf71 / ext4 defaults 1 1
UUID=9651f7cf-e532-496c-a36f-c93067694524 /boot ext4 defaults 1 2
UUID=881472db-aacd-48f0-bac9-e73df98070fa /home ext4 defaults 1 2
UUID=797da8b6-107e-4747-b613-290934a5ead9 /scratch ext4 defaults 1 2
UUID=edf44b99-6e03-48be-95d6-0e70566422d7 swap swap defaults 0 0

Physically rebuilding the machine so that I have the boot disk as /dev/sda and the /home as /dev/sdb is not difficult, but the machine is trying to boot from /dev/sde every time, whether or not there is a /dev/sde or not. I'me guessing that when I removed the sdc and sdd drives, wha was originally the sde drive was internally reconfigured to be sdc.

Is there any way that I can reconfigure this so that I can move the drives around and remove the drives I want removed? I've looked at what grub files I can find, but I'm completely confused, and in any case I cannot find any references to /dev/sde etc.

I'm using fedora 31
All drives except the completely broken one are Western Digital. The broken one is a Seagate.

Many thanks,

Dave
 
Old 01-25-2020, 11:24 AM   #2
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,862

Rep: Reputation: 1684Reputation: 1684Reputation: 1684Reputation: 1684Reputation: 1684Reputation: 1684Reputation: 1684Reputation: 1684Reputation: 1684Reputation: 1684Reputation: 1684
post the ouput of
Code:
lsblk -f

Last edited by colorpurple21859; 01-25-2020 at 12:44 PM.
 
Old 01-25-2020, 11:37 AM   #3
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 8,362
Blog Entries: 21

Rep: Reputation: 4849Reputation: 4849Reputation: 4849Reputation: 4849Reputation: 4849Reputation: 4849Reputation: 4849Reputation: 4849Reputation: 4849Reputation: 4849Reputation: 4849
You show /dev/sdb as the "scratch" drive. My guess is that when you removed it, all the other drives got renumbered. In the old ide system, drives were numbered according to where they were plugged in, but scsi drives are numbered by udev rules. You may need to change those.
 
Old 01-25-2020, 12:44 PM   #4
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,862

Rep: Reputation: 1684Reputation: 1684Reputation: 1684Reputation: 1684Reputation: 1684Reputation: 1684Reputation: 1684Reputation: 1684Reputation: 1684Reputation: 1684Reputation: 1684
Post your /boot/grub2/grub.cfg
 
Old 01-25-2020, 02:57 PM   #5
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,827

Rep: Reputation: 2243Reputation: 2243Reputation: 2243Reputation: 2243Reputation: 2243Reputation: 2243Reputation: 2243Reputation: 2243Reputation: 2243Reputation: 2243Reputation: 2243
Refer to your drives by LABEL or UUID, not by the /dev/sd{x}{n} name, which can be affected by system configuration changes. You'll need to make sure that both the grub2.cfg and /etc/fstab files do this.
 
Old 01-25-2020, 06:22 PM   #6
starfiend
LQ Newbie
 
Registered: Mar 2006
Location: South Wales
Distribution: Mint, Fedora
Posts: 12

Original Poster
Rep: Reputation: 2
Output from lsblk -f is:
NAME FSTYPE LABEL UUID FSAVAIL FSUSE% MOUNTPOINT
loop0 squashfs 0 100% /var/lib/snapd/snap/get-iplayer/213
loop1 squashfs 0 100% /var/lib/snapd/snap/dav1d/235
loop2 squashfs 0 100% /var/lib/snapd/snap/core18/1288
loop3 squashfs 0 100% /var/lib/snapd/snap/snapd/5754
sda
└─sda1 ext4 881472db-aacd-48f0-bac9-e73df98070fa 1.6T 4% /home
sdb
└─sdb1 ext4 797da8b6-107e-4747-b613-290934a5ead9 1.2T 27% /scratch
sdc
sdd
├─sdd1 877.5M 0% /run/media/dave/b946cee1-a1a6-4659-bdc9-63325b3f4638
├─sdd2
├─sdd3
└─sdd4
sde
├─sde1 ext4 9651f7cf-e532-496c-a36f-c93067694524 666M 25% /boot
├─sde2 ext4 eecc5495-52ba-4d49-904b-e672979dbf71 247.4G 8% /
└─sde3 swap edf44b99-6e03-48be-95d6-0e70566422d7 [SWAP]
sr0



And my /boot/grub2/grub.cfg is not small:

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

### BEGIN /etc/grub.d/00_header ###
set pager=1

if [ -f ${config_directory}/grubenv ]; then
load_env -f ${config_directory}/grubenv
elif [ -s $prefix/grubenv ]; then
load_env
fi
if [ "${next_entry}" ] ; then
set default="${next_entry}"
set next_entry=
save_env next_entry
set boot_once=true
else
set default="${saved_entry}"
fi

if [ x"${feature_menuentry_id}" = xy ]; then
menuentry_id_option="--id"
else
menuentry_id_option=""
fi

export menuentry_id_option

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 {
if [ x$feature_all_video_module = xy ]; then
insmod all_video
else
insmod efi_gop
insmod efi_uga
insmod ieee1275_fb
insmod vbe
insmod vga
insmod video_bochs
insmod video_cirrus
fi
}

terminal_output console
if [ x$feature_timeout_style = xy ] ; then
set timeout_style=menu
set timeout=5
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
set timeout=5
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/01_users ###
if [ -f ${prefix}/user.cfg ]; then
source ${prefix}/user.cfg
if [ -n "${GRUB2_PASSWORD}" ]; then
set superusers="root"
export superusers
password_pbkdf2 root ${GRUB2_PASSWORD}
fi
fi
### END /etc/grub.d/01_users ###

### BEGIN /etc/grub.d/08_fallback_counting ###
insmod increment
# Check if boot_counter exists and boot_success=0 to activate this behaviour.
if [ -n "${boot_counter}" -a "${boot_success}" = "0" ]; then
# if countdown has ended, choose to boot rollback deployment,
# i.e. default=1 on OSTree-based systems.
if [ "${boot_counter}" = "0" -o "${boot_counter}" = "-1" ]; then
set default=1
set boot_counter=-1
# otherwise decrement boot_counter
else
decrement boot_counter
fi
save_env boot_counter
fi
### END /etc/grub.d/08_fallback_counting ###

### BEGIN /etc/grub.d/10_linux ###
insmod part_msdos
insmod ext2
set root='hd3,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd4,msdos1 --hint-efi=hd4,msdos1 --hint-baremetal=ahci4,msdos1 --hint='hd3,msdos1' 9651f7cf-e532-496c-a36f-c93067694524
else
search --no-floppy --fs-uuid --set=root 9651f7cf-e532-496c-a36f-c93067694524
fi
insmod part_msdos
insmod ext2
set boot='hd3,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=boot --hint-bios=hd4,msdos1 --hint-efi=hd4,msdos1 --hint-baremetal=ahci4,msdos1 --hint='hd3,msdos1' 9651f7cf-e532-496c-a36f-c93067694524
else
search --no-floppy --fs-uuid --set=boot 9651f7cf-e532-496c-a36f-c93067694524
fi

# This section was generated by a script. Do not modify the generated file - all changes
# will be lost the next time file is regenerated. Instead edit the BootLoaderSpec files.
#
# The blscfg command parses the BootLoaderSpec files stored in /boot/loader/entries and
# populates the boot menu. Please refer to the Boot Loader Specification documentation
# for the files format: https://www.freedesktop.org/wiki/Spe...ootLoaderSpec/.

set default_kernelopts="root=/dev/sde2 ro resume=UUID=edf44b99-6e03-48be-95d6-0e70566422d7 rhgb quiet "

insmod blscfg
blscfg
if [ -s $prefix/grubenv ]; then
load_env
fi
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/10_reset_boot_success ###
insmod increment
# Hiding the menu is ok if last boot was ok or if this is a first boot attempt to boot the entry
if [ "${boot_success}" = "1" -o "${boot_indeterminate}" = "1" ]; then
set menu_hide_ok=1
else
set menu_hide_ok=0
fi
# Reset boot_indeterminate after a successful boot, increment otherwise
if [ "${boot_success}" = "1" ] ; then
set boot_indeterminate=0
else
increment boot_indeterminate
fi
# Reset boot_success for current boot
set boot_success=0
save_env boot_success boot_indeterminate
### END /etc/grub.d/10_reset_boot_success ###

### BEGIN /etc/grub.d/12_menu_auto_hide ###
if [ x$feature_timeout_style = xy ] ; then
if [ "${menu_show_once}" ]; then
unset menu_show_once
save_env menu_show_once
set timeout_style=menu
set timeout=60
elif [ "${menu_auto_hide}" -a "${menu_hide_ok}" = "1" ]; then
set orig_timeout_style=${timeout_style}
set orig_timeout=${timeout}
if [ "${fastboot}" = "1" ]; then
# timeout_style=menu + timeout=0 avoids the countdown code keypress check
set timeout_style=menu
set timeout=0
else
set timeout_style=hidden
set timeout=1
fi
fi
fi
### END /etc/grub.d/12_menu_auto_hide ###

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

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

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

### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/30_uefi-firmware ###
### END /etc/grub.d/30_uefi-firmware ###

### 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 ${config_directory}/custom.cfg ]; then
source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then
source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###


Many thanks,

Dave
 
Old 01-25-2020, 08:33 PM   #7
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,415

Rep: Reputation: 4197Reputation: 4197Reputation: 4197Reputation: 4197Reputation: 4197Reputation: 4197Reputation: 4197Reputation: 4197Reputation: 4197Reputation: 4197Reputation: 4197
Looking at that I'd expect it to be complaining about /dev/sde2, not /dev/sde1 - are you sure about that ?.

Unfortunately there is no way that I know of for predicting how the firmware will enumerate the devices when they are moved like that. I've even had different Linux distros present different device nodes for the same hardware.
You need to get rid of device node references as stated. Might need to look at initrd as well.
 
Old 01-25-2020, 09:20 PM   #8
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,827

Rep: Reputation: 2243Reputation: 2243Reputation: 2243Reputation: 2243Reputation: 2243Reputation: 2243Reputation: 2243Reputation: 2243Reputation: 2243Reputation: 2243Reputation: 2243
It looks like everything is already probing for the filesystem UUID. At what point does the boot fail?
 
Old 01-25-2020, 10:41 PM   #9
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,415

Rep: Reputation: 4197Reputation: 4197Reputation: 4197Reputation: 4197Reputation: 4197Reputation: 4197Reputation: 4197Reputation: 4197Reputation: 4197Reputation: 4197Reputation: 4197
Have a look at that default_kernelopts
 
Old 01-26-2020, 12:44 AM   #10
voleg
Member
 
Registered: Oct 2013
Distribution: RedHat CentOS Fedora SuSE
Posts: 354

Rep: Reputation: 51
The initrd do mount root filesystem during the boot.
An /etc/fstab used later.
Probably your kernel boot line use /dev/sde notation.
You can change this directly in grub menu when booting.
Once succeeded, check grub configuration and rebuild initrd.
 
Old 01-26-2020, 12:03 PM   #11
starfiend
LQ Newbie
 
Registered: Mar 2006
Location: South Wales
Distribution: Mint, Fedora
Posts: 12

Original Poster
Rep: Reputation: 2
Quote:
Originally Posted by voleg View Post
The initrd do mount root filesystem during the boot.
An /etc/fstab used later.
Probably your kernel boot line use /dev/sde notation.
You can change this directly in grub menu when booting.
Once succeeded, check grub configuration and rebuild initrd.
How do I do this please?

Dave
 
Old 01-26-2020, 12:20 PM   #12
starfiend
LQ Newbie
 
Registered: Mar 2006
Location: South Wales
Distribution: Mint, Fedora
Posts: 12

Original Poster
Rep: Reputation: 2
Quote:
Originally Posted by syg00 View Post
Looking at that I'd expect it to be complaining about /dev/sde2, not /dev/sde1 - are you sure about that ?.
Off the top of my head, it was last weekend, I cannot actually remember for certain, but yes it could well have been.

Dave
 
Old 01-26-2020, 12:22 PM   #13
starfiend
LQ Newbie
 
Registered: Mar 2006
Location: South Wales
Distribution: Mint, Fedora
Posts: 12

Original Poster
Rep: Reputation: 2
Quote:
Originally Posted by syg00 View Post
Have a look at that default_kernelopts
That's interesting, I hadn't actually spotted that, and I did go looking.

Can I safely edit that?

Dave
 
Old 01-26-2020, 02:38 PM   #14
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,862

Rep: Reputation: 1684Reputation: 1684Reputation: 1684Reputation: 1684Reputation: 1684Reputation: 1684Reputation: 1684Reputation: 1684Reputation: 1684Reputation: 1684Reputation: 1684
post your /etc/default/grub
Quote:
Can I safely edit that?
To test first, remove the drives you want removed, at the grub menu, press e edit the line that begins with linux change
Code:
root=/dev/sde2
to
Code:
 root=UUID=eecc5495-52ba-4d49-904b-e672979dbf71
ctrl-x or f10 to boot.
If it boots, run
Code:
sudo grub2-mkconfig -o /boot/grub2/grub.cfg
check your /boot/grub2/grub.cfg and see if anything changes.

Last edited by colorpurple21859; 01-26-2020 at 03:53 PM.
 
Old 02-07-2020, 07:56 PM   #15
starfiend
LQ Newbie
 
Registered: Mar 2006
Location: South Wales
Distribution: Mint, Fedora
Posts: 12

Original Poster
Rep: Reputation: 2
Quote:
Originally Posted by colorpurple21859 View Post
post your /etc/default/grub

To test first, remove the drives you want removed, at the grub menu, press e edit the line that begins with linux change
Code:
root=/dev/sde2
to
Code:
 root=UUID=eecc5495-52ba-4d49-904b-e672979dbf71
ctrl-x or f10 to boot.
If it boots, run
Code:
sudo grub2-mkconfig -o /boot/grub2/grub.cfg
check your /boot/grub2/grub.cfg and see if anything changes.
Thank you very much, this worked a treat.

After I had done this, I found I could remove the two drives that were, logically, /dev/sdc and /dev/sdd, without affecting the booting. I had to edit my fstab file to allow it to boot properly though. Quite logical once I'd actually thought about it for more than half a second.

Once that was done, by shifting cables around, (and labelling them!!!!!) the drive containing my /boot / and swap partitions is now /dev/sdb/. sda is the /home partition and sdc is my /virtual partition which contains various boots for VirtualBox.

I decided to try something, but it didn't work. With the boot drive as the only drive in the system, it wouldn't boot at all. Black screen and flashing cursor. Not even as far as the Grub menu.

When I set it back, however, I nearly had a heart attack as it still wouldn't boot. It took me a bit of panicking and some investigation within the BIOS (and some guessing) but it turns out that the device that is logically /dev/sda, containing my /home partition, is the boot drive as far as the PC is concerned. I'm guessing this is something to do with the MBR or something like that. Even if there's now nothing I can do to make the linux boot drive also the PC's boot drive it would be nice to know what is actually going on here.

Thanks to everyone who has helped and offered suggestions.

Dave
 
  


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
New Hard Drive Setup Issues (Is there no hope? Should I take the hard drive back?) complete General 2 07-27-2010 01:08 PM
Booting Linux on an external USB hard drive (not a memory stick, a hard drive) comcastuser Linux - Hardware 4 01-13-2010 06:59 PM
I want to copy my hard drive to a larger hard drive and boot from the new drive. lpmorgan1 Ubuntu 8 09-07-2009 11:26 PM
Clone a dual booting IDE hard drive to a SATA hard drive namida12 Linux - Distributions 1 07-14-2008 10:01 AM
Squid:2nd Browser access Internet SPEED dead becomes dead slow mwj Linux - Software 1 10-04-2003 01:40 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 08:47 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
Open Source Consulting | Domain Registration