Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm running my laptop using Ubuntu 12.04 on a USB HDD as the laptop's HDD has failed. Whenever I boot or do a grub update etc, it takes forever because it scans for the failed drive about 20 times and takes ages for each scan.

Is there a way to disable the automatic scanning but still be able to manually mount one of the working partitions on the drive?

Thanks Chris

share|improve this question
    
Try to hide broken partitions using this answer. –  Riateche Nov 18 '12 at 8:36
add comment

1 Answer

I do believe that it's the OS prober that is scanning the other drives. The OS prober gets run whenever update-grub is run, which is usually only after a kernel update or when a module is installed that needs to be compiled into the kernel.

I haven't actually done this, (Correction, I just did it. What a fun hack!) but I do think if you delete /etc/grub.d/30_os-prober and replace it with a bash script that does nothing, then it should disable the OS prober without having any other bad effect on the system. It's a bit like squashing an ant with a steam hammer, but hey...

OK, I did this and it seemed to work fine. First, make backup copy of the file in question:

sudo mkdir /etc/grub.d/backup
sudo cp /etc/grub.d/30_os-prober /etc/grub.d/backup/

Next edit the file /etc/grub.d/30_os-prober and delete all the lines except for the first crunch-bang. (the first text line you will find in the file)

sudo nano /etc/grub.d/30_os-prober

Arrow down to the line below the crunch-bang and hold down Ctrlk to cut all other lines, then press Ctrlo to save the file and Ctrlx to quit.

You are done except if you want to make sure that the partitions on the hard drive are not mounted inadvertently, add a line for each of them to the /etc/fstab file. eg

sudo nano /etc/fstab

and and the lines at the bottom:

/dev/sda1  /home/username/part1  ntfs-3g  noauto,ro  0 0
/dev/sda2  /home/username/part2  ext4     noauto,ro  0 0

and so on where username is your username, and ntfs-3g/ext4 etc is the correct filesystem type for the partition. This will stop the partitions showing up in Nautilus, and will require you to mount the drives manually with sudo, and the directory part1, part2 must exist already otherwise the partition can NOT be mounted. Oh, and the partitions will also only be mounted read only (,ro) which is a great idea for devices which are failing since any write operations you do on them could make things much worse.

when you want to mount the partitions, do so with

sudo mount /dev/sda1

etc

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.