8

I recently revived this old computer with Ubuntu to use it as a local network fileserver and all has worked out well. I've been able to connect all my hard drives laying around and get samba working.

Unfortunately I only have 3 sata ports available on my motherboard and all those three are connected to my hard drives, which leaves my dvd-drive just sitting in the case.

I tried just plugging the sata cable out of one of the drives (not the boot drive) and connect it to the dvd-drive. Ubuntu wouldn't boot and would display the following message:

ACPI PCC probe failed
starting version 219
sd 4:0:0:0: [sde] No Caching mode page found
sd 4:0:0:0: [sde] Assuming drive cache: write trough
Welcome to emergency mode! After logging in, type 'journalctl -xb' to view 
system logs, "systemctl reboot" to reboot, "systemctl default" or ^D to try 
again to boot into default mode.

When I reconnect the drive instead of the dvd-drive I can boot into the desktop again. [sde] is ofcourse the drive disconnected
All the drives were setup with fstab and this is my fstab:

UUID=deviceuuidhere /home/thibaultmaekelbergh/mounts/folder1 ext4 defaults 0 0
UUID=deviceuuidhere /home/thibaultmaekelbergh/mounts/folder2 ext4 defaults 0 0
UUID=deviceuuidhere /home/thibaultmaekelbergh/mounts/folder3 ext4 defaults 0 0
UUID=deviceuuidhere /home/thibaultmaekelbergh/mounts/folder4 ext4 defaults 0 0
UUID=deviceuuidhere /home/thibaultmaekelbergh/mounts/folder5 ext4 defaults 0 0

Before I used /dev/sda1, /dev/sdb1 etc instead of UUID but I thought UUID might solve the problem and changing fscheck option to 0. They both didn't unfortunately.

I'm really stuck on how to be able to switch the cable to the dvd drive when I want, but still being able to boot. Hope someone here can help.

Thanks in advance

Ron
  • 20,518
  • 6
  • 57
  • 72
thibmaek
  • 183
  • 1
  • 6
  • Did you plug in dvd drive in place of a harddisk mounted in `fstab`? If yes comment out that particular harddisk entry from `fstab` and try again. – Ron Sep 06 '15 at 11:27
  • @Ron I know that would fix it but that way I'd have to edit the fstab each time I need the dvd drive. I need an option where if the disk is not available Ubuntu just doesn't check or mount it and boots with the dvd instead. – thibmaek Sep 06 '15 at 11:35
  • AFAIK if a device is listed in fstab and not present at boot time, you're in trouble. So, think in reverse. Comment out the device you usually replace and let the boot process sort it out. The side effect is that you will probably have to manually mount said device after boot. – hmayag Sep 06 '15 at 12:19

1 Answers1

11

You can use nofail option in /etc/fstab.

The system will not throw an error if some drive is not connected.

You can add it like defaults, nofail instead of just defaults or use some relevant set of options instead of defaults.

Pilot6
  • 88,764
  • 91
  • 205
  • 313
  • I saw that too but wasn't sure if it was safe to use it. Can I format it like this: defaults, nofail? Or do I need to leave defaults out? – thibmaek Sep 06 '15 at 12:53
  • Consider adding `nobootwait` along with `nofail` to the line concerning the drive you will be disconnecting. Explanation here: http://unix.stackexchange.com/questions/53456/what-is-the-difference-between-nobootwait-and-nofail-in-fstab – Organic Marble Sep 06 '15 at 12:53
  • @Thibmaekelbergh Why could it be not safe? That option is exactly what you need, if you detach some drive. Yes, just like `defaults, nofail`. – Pilot6 Sep 06 '15 at 12:54
  • You can leave `defaults` in. Mine goes `....defaults, nobootwait, nofail 0 0` – Organic Marble Sep 06 '15 at 12:57
  • 1
    @OrganicMarble I see no reason for `nobootwait` in this case, but it won't spoil anything. – Pilot6 Sep 06 '15 at 12:57
  • OK. When I worked to solve this on my pc, man pages were not clear to me on which option was needed. I put both and it worked for me. – Organic Marble Sep 06 '15 at 13:00
  • Adding `nobootwait` and `nobootfail` to the file didn't solve the issue. As a temp fix I just commented out the drive with the least capacity. Thanks for the reply anyway. – thibmaek Sep 13 '15 at 16:38
  • @Thibmaekelbergh It is not `nobootfail`, it is `nofail`. – Pilot6 Sep 13 '15 at 17:44
  • @Pilot6 yeah that was a typo. I actually put nofail in the fstab – thibmaek Sep 13 '15 at 21:15