26

rootwait and rootdelay are used in situations when the filesystem is not immediately available, for example if it's detected asynchroneously or mounted via usb. The thing is, it should be obvious based on the root bootarg if that's the case or not, so why can't the kernel realize automatically that it needs to wait for the filesystem to appear? Are there some technical constraints preventing this automatization from being implemented?

3
  • 1
    I think the kernel does wait for the filesystem to appear. The issue is that it cannot be mounted as soon as it appears, because the driver needs some time to initialize even after reading the partition table. – vikraman Mar 7 '13 at 14:09
  • 1
    Why is it obvious on the root bootarg? How do you know that /dev/sda1 is a usb device and you have wait for a while or that /dev/sda1 is on a scsi system which has to scan? – Ulrich Dangel Mar 7 '13 at 14:22
  • 1
    On a Raspberry Pi, if you don't wait, you may not be able to mount root; this is because the device may not be fast enough to initialize the slow card in time. – Tamara Wijsman Apr 7 '13 at 9:05
26

Sometimes the OS can't distinguish a peripheral that's slow to respond from a peripheral that's not there or completely hosed. The most obvious example is a root filesystem coming from the network (TFTP, NFS) where a slow network link or an overloaded server are difficult to distinguish from a severed network link or a crashed server. A timeout tells the kernel when to give up.

This can also happen with disks that are slow to spin up, RAID arrays that need to be verified and so on. rootdelay instructs the kernel not to give up immediately if the device isn't available. The kernel can't know whether a SCSI drive is a local disk or some kind of RAID bay.

rootwait is provided to wait indefinitely. It's not always desirable, for example a system may want to fall back to a different root filesystem if the normal one takes too long to respond.

0

Sorry for reopening such an old question, but I was recently researching this myself and I came across this post.

From what I could find, what rootdelay truly does is to delay the start of the kernel for the specified time in order to let the kernel find the rootfs in slower devices. Therefore, if you for example set rootdelay=10, your system will wait 10 seconds before trying to start the kernel regardless of whether the rootfs has been found or not.

On the other hand, rootwait (as @Gilles pointed out) simply waits indefinitely for your rootfs to be available and then starts the kernel.

All in all, if you had a system that takes 5 seconds to find the rootfs and you have it set up like rootdelay=10 rootwait, it will wait 10 seconds and then start it immediately. If the system were to take 15 seconds to find the rootfs, then rootdelay=10 will force the first 10 seconds of wait, and then rootwait will take care of the last 5 seconds needed. Finally, in this last case, if you hadn't set rootwait, the system will fail to boot after 10 seconds since it wouldn't be able to find the rootfs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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