[SOLVED] hdd recovery: How to boot a live usb iso withOUT hang/errors from bad hard disk drive
Linux - HardwareThis forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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.
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
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.
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...
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.
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
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.