LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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 05-24-2017, 01:41 PM   #1
mishima
LQ Newbie
 
Registered: Apr 2013
Posts: 22

Rep: Reputation: Disabled
hdd recovery: How to boot a live usb iso withOUT hang/errors from bad hard disk drive


I have ubuntu 16.04 on a usb stick. I also have a failed hard drive.

If I remove the hard drive, the usb boots just fine to ubuntu desktop.

If I leave the hard drive plugged in however, the usb boot gets stuck forever checking the disk.

I was wondering if there was a boot parameter or something I could apply to the usb boot that would disable the hard disk check.

Last edited by mishima; 05-24-2017 at 10:46 PM. Reason: clarity
 
Old 05-24-2017, 02:24 PM   #2
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
maybe your internal hard drive is listed in /etc/fstab?
commenting it out might be enough.
 
Old 05-24-2017, 03:08 PM   #3
mishima
LQ Newbie
 
Registered: Apr 2013
Posts: 22

Original Poster
Rep: Reputation: Disabled
Is there a way to do that from grub?
 
Old 05-24-2017, 04:18 PM   #4
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,501

Rep: Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489
Is the Ubuntu on usb a full install or just a Live system?
Can you boot whichever you have?
If your hard drive has failed, why are you still leaving it plugged in? Do you need to get data off it? You can obviously do that if you have an Ubuntu Live or installed on a usb. If you do and it is functioning (which you imply in your post) it's pretty simple to make that change. More details on the total problem and goal would be useful.

Quote:
Is there a way to do that from grub?
You can't access the fstab from Grub because it is a bootloader not an OS. The commands available are listed in their manual at the link below.

https://www.gnu.org/software/grub/manual/grub.html
 
Old 05-24-2017, 04:44 PM   #5
mishima
LQ Newbie
 
Registered: Apr 2013
Posts: 22

Original Poster
Rep: Reputation: Disabled
The ubuntu usb is a live system, not an usb installation. It can boot, but ONLY if I remove the hard drive (ie. unplug its sata connection and set on desk next to me). Indeed, I am trying to recover whatever I can from the failed hard drive using the usb live system.

However, the live system will not boot completely if the hard drive is left connected. It gets stuck during what seems to be a kernel disk check of some sort. Error messages like "device reported invalid CHS sector 0" and "failed command: read fpdma queued" continue to loop on screen (because it is a failed hard drive). As mentioned, I don't get those errors and the usb live system boots just fine if I disconnect the hard drive. But of course then I can't access the drive at all (since its unplugged).

I don't really understand why the usb live system checks the disk at all. I was hoping I could disable is whatever is causing it with a kernel parameter or something passed in grub.
 
Old 05-24-2017, 05:25 PM   #6
mishima
LQ Newbie
 
Registered: Apr 2013
Posts: 22

Original Poster
Rep: Reputation: Disabled
Ok, the kernel parameter I was looking for was:

libata.force=1:disable

Put on the linux line in grub with quiet splash. Now I can boot from the live usb with the hard drive plugged in. However, I guess this also prevents a /dev/sdx entry from being made, so I can't interact with it.
 
1 members found this post helpful.
Old 05-24-2017, 05:26 PM   #7
!!!
Member
 
Registered: Jan 2017
Location: Fremont, CA, USA
Distribution: Trying any&ALL on old/minimal
Posts: 997

Rep: Reputation: 382Reputation: 382Reputation: 382Reputation: 382
Maybe: ahci.blacklist=yes (or not IF this module is builtin to this iso kernel)
Then modprobe it back in after booting.

Last edited by !!!; 05-24-2017 at 05:34 PM.
 
Old 05-24-2017, 05:42 PM   #8
mishima
LQ Newbie
 
Registered: Apr 2013
Posts: 22

Original Poster
Rep: Reputation: Disabled
triplebang, that one didn't work, gave the same error messages in infinite loop.
 
Old 05-24-2017, 05:48 PM   #9
!!!
Member
 
Registered: Jan 2017
Location: Fremont, CA, USA
Distribution: Trying any&ALL on old/minimal
Posts: 997

Rep: Reputation: 382Reputation: 382Reputation: 382Reputation: 382
Maybe, to re-enable your successful disable, something like this (kudos for finding that, at the same time I was wild-guessing)
$ echo 1 > /sys/block/sdX/device/<something>

Edit: what if you plug the drive back in -after- the live iso is done booting?
(udev may cause same mess, as it discovers it tho.)
Another wild-guess: boot usb iso to/with: init=/bin/sh
(if it's udev, and not the kernel, causing all the mess)

I believe this (no-touch disk forensics) is definitely something done before, but I can't come up with the right search keywords Maybe there's a unique distro for this. Have patience and I'm sure the right Guru will eventually chime in here!!!

Maybe change the thread title (Edit #1, Go advanced) to clarify&attract attention, to like:
hdd recovery: How to boot a live usb iso withOUT hang/errors from bad hard disk drive

Last edited by !!!; 05-24-2017 at 06:41 PM.
 
Old 05-24-2017, 10:50 PM   #10
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,125

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
That might work if the OP only disables the device rather than the entire port.
Looks pretty terminal though. Nothing will talk to it if it can't respond to ioctls properly.

FWIW I keep an external caddy I can plug recalcitrant disks in so I can work on them easily. As suggested udev might be a problem with that as well.
 
Old 05-24-2017, 11:48 PM   #11
mishima
LQ Newbie
 
Registered: Apr 2013
Posts: 22

Original Poster
Rep: Reputation: Disabled
syg00, you mean like

libata.force=1.00:disable

instead of the previous? That also works, but there is still no entry in /dev. I've been trying !!! suggestion along with

echo "- - -" > /sys/class/scsi_host/host0/scan

without luck. It shows the rescan in dmesg output, but the kernel parameter seems to override it:
[ 650.742196] ata1: hard resetting link
[ 651.056723] ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
[ 651.059611] ata1.00: FORCE: horkage modified (disable)
[ 651.059612] ata1.00: unsupported device, disabling
[ 651.059613] ata1.00: disabled
[ 651.059621] ata1: EH complete

Wish there was something like modprobe libata.force=1.00:enable...
 
Old 05-25-2017, 12:20 AM   #12
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,125

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Quote:
Originally Posted by mishima View Post
syg00, you mean like

libata.force=1.00:disable

instead of the previous? That also works, but there is still no entry in /dev.
Of course - what was I thinking ...
Quote:
Wish there was something like modprobe libata.force=1.00:enable...
Not likely - all the base support will be compiled in.

Sorry, no other ideas here. No point mentioning my sigline I suppose.
 
Old 05-25-2017, 01:52 PM   #13
!!!
Member
 
Registered: Jan 2017
Location: Fremont, CA, USA
Distribution: Trying any&ALL on old/minimal
Posts: 997

Rep: Reputation: 382Reputation: 382Reputation: 382Reputation: 382
Sorry no solution yet.
Do you use "Advanced boot options -> Recovery mode"? Can you hit <tab>, to add: init=/bin/sh
to avoid udev and all from running, leaving only the kernel and a shell?

Maybe if you left it for like hours, udev/whatever would finish trying to access the bad drive.

Do you have a spare USB stick, to try another distro? Extreme 7MB example of just kernel+busybox: http://minimal.linux-bg.org/download...017_64-bit.iso

Can you connect drive -after- boot?

Last edited by !!!; 05-25-2017 at 02:05 PM.
 
Old 05-25-2017, 08:44 PM   #14
mishima
LQ Newbie
 
Registered: Apr 2013
Posts: 22

Original Poster
Rep: Reputation: Disabled
I dont have advanced boot or recovery mode on my ubunutu usb grub screen. Its UEFI version of 16.04, I think those options might only be on BIOS versions. Or maybe I dont understand, you mean adding init=/bin/sh to the kernel parameters line?

I've left it for a few hours before trying something else but yeah, maybe tonight ill let it go overnight.

I tried that minimal install iso and it didn't have a *.efi file that worked for me, I'll keep looking for something like it.

I can connect the drive after booting from usb, but it still doesn't show up in /dev. The sata connection is a little weird maybe, this is on a ASUS ROG G751JL laptop and the sata connection isn't a cable, its a little piece of pcb extending from the board with plugs...so maybe it can't be hotplugged I dont know.

edit:
Here's exactly what gets executed from grub:
set gfxpayload=keep
linux /casper/vmlinuz.efi file=/cdrom/preseed/ubuntu.seed boot=casper libata.force=1:disable ---
initrd /casper/initrd.lz

Did you mean putting init=/bin/sh somewhere here?

Last edited by mishima; 05-25-2017 at 08:50 PM.
 
Old 05-25-2017, 10:08 PM   #15
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,125

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
What happens if you don't disable that port on the liveCD and later plug in the disk (via USB).
 
  


Reply



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
[SOLVED] Check health of USB hard drive martvefun Linux - Hardware 14 01-01-2012 01:59 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
Booting from an USB hard drive GP16 Linux - Newbie 4 04-26-2007 12:44 AM
Booting FC-6 via USB hard drive sfjtraps Fedora 1 02-22-2007 09:57 AM
Booting from a USB hard drive?? justiceisblind Linux - Newbie 4 05-24-2002 04:50 PM

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

All times are GMT -5. The time now is 03:56 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