How can I stop the btrfs check during startup?


I am falling in love with Manjaro. I have just one little issue, slow startup. I am pretty sure its the btrfs check during startup. I found that out while trying to remove it, and totally messed up an install. Lucky for me I had backed up the partition so it was relatively easy to restore my OS.
In Mint btrfs-tools is a package that can easily be removed. Not so much on Manjaro as it wants to remove Caja and a host of other applications and thats just not happening. I dont have any btrfs partitions, all of them are ext4 and I wont create one.
Is there a way to remove the btrfs check during startup? I have googled it but cant seem to find the answer.


(Non-impolite question) - Why are you so sure? Let us know what indicates that.
Could it not just be ‘plain’ fsck (or other things like journaling or db) doing its thing?

Provide at terminal

pacman -Q systemd-fsck-silent
cat /etc/mkinitcpio.conf | grep keymap


You could edit /etc/fstab and change the last number to a zero, disabling fsck for that partition.


But why disable fsck for a non-btrfs partition? (Unless he wants to).


Ah thanks. I missed the part about “all of them are ext4”.
If there are no btrfs partitions, there should also be no btrfs-check.


Sorry if I was unclear on exactly what I wanted. I will try to be more specific here and give more details.

In my experience the system checks for btrfs file systems on startup. This is a slow process and one of the main reasons I dont like using it. Another is in the past it has been near impossible for older OS installs to access the partition. This makes booting into an older OS install if there is a problem, mounting the btrfs one, and fixing problems impossible. I have multiple OS partitions and I have saved a few installs over the years doing just that. I have no problem with ext4 and made a decision to just keep using it.
Its not a file system check I am talking about, sorry if I was unclear. Its the system looking for btrfs partitions. In my first post I mentioned I learned it was a problem because while trying to remove btrfs from the system I messed up the install. I let btrfs-tools uninstall, and with it all the other things it wanted to uninstall. When I rebooted the system it was very fast, but when I logged in the system was unstable. So I know checking for btrfs file systems is slowing down the boot.
The question is how can I stop the system from looking for btrfs file systems on boot.

After writing this I remembered a hook in the file list for the btrfs-tools package. Its found in /lib/initcpio/hooks/btrfs. Inside the file is


run_hook() {
    btrfs device scan

# vim: set ft=sh ts=4 sw=4 et:

Thsis looks to be the scan I am talking about.


I hacked a solution. While I have a lot of Linux experience in general its mainly on Debian based systems and a few failed attempts at Arch. I dont know a super lot about how everything under the hood runs, but I am not afraid of the terminal or hacking things to see if they will work.
I deleted “btrfs device scan” from /lib/initcpio/hooks/btrfs and installed a new kernel. I had been wanting to try 4.20 and it was a safe way to test this by leaving the working kernel in place.
The system boot is super fast, likely under a minute now. I would still like to know if there is a easier/better/normal way of accomplishing the same thing to learn from this experience.


@torvic, do you want to say anything on this?


Under normal circumstances, you shouldn’t need to edit that file.

/etc/mkinitcpio.conf defines what HOOKS get used with your initrd. You can remove btrfs from there if you don’t want that hook. I could be wrong, but I don’t think it is enabled by default.

After editing that file regenerate your initrds using

sudo mkinitcpio -P


I did read something about mkinitcpio.conf on the Arch wiki. But when I looked at the /etc/mkinitcpio file in the hooks section it didnt have btrfs listed. It reads HOOKS=“base udev autodetect modconf block keyboard keymap resume filesystems”.


It could also be in the MODULES section.

I am not an expert but I think filesystems autodetects installed filesystems and adds the appropriate modules.

All that being said, are you sure there is a “btrfs detection” being run at boot?


Its not in modules and I did a search of the mkinitcpio.conf file and did not find btrfs anywhere in it.
I am not sure how I can see if there is no btrfs scan now. I have to go out for a bit, but when I get back I am going to boot into the 4.19 kernel and run

sudo mkinitcpio -P

To see if that speeds startup as well.


It should run for all your installed kernels so you should run mkinitcpio -P and then reboot using the other kernel.


I ran the command and now the 4.19 kernel startup is just as fast as the 4.20.


Now add back “btrfs device scan” ; do “mkinitcpio -P” and see if it any slower, any kernel.


Instead of editing that system file, try running mkinitcpio -P -S btrfs which will (or should) skip the btrfs hook.
Then verify the resulting initram with lsinitcpio -a /boot/initramfs-xxx.img and see whether the btrfs module is still in there.


When compiling initramfs (mkinitcpio) --> if the OS is btrfs, the ‘btrfs’ module will be in it.
When compiling initramfs (mkinitcpio) --> if the OS is not btrfs, the ‘btrfs’ module will not be in it.

There’s no further need to run mkinitcpio -P -S btrfs just because the OS is not btrfs.
Nor is it necessary to do anything to /lib/initcpio/hooks/~ or in /lib/initcpio/hooks/btrfs.

Boot times will be the same (unless we mess up mkinitcpio).


But isn’t that exactly the problem? His OS is NOT btrfs, but the btrfs hook still seems to have been loaded? Or am I completely misunderstanding the issue?


I did not read anywhere that his hooks has btrfs nor anywhere where modules have btrfs.
Just that he has “btrfs device scan” in /lib/initcpio/hooks/btrfs (don’t we all have this regardless whether it is ext4 or btrfs?) and that his boot times are very slow.

Since I have both btrfs and ext4 OS’s I can print out the modules and maybe do the delete “btrfs device scan” and post it here. But give me some time.
ps: the btrfs OS is in external; drive which I don’t use normally (for testing this new grub only). But I can do the comparative grub (delete btrfs scan) in a bios-legacy system.

Give me about 5 minutes.


Hmm well I thought that by removing “btrfs device scan” OP claimed that bootup is faster, and that’s where my suggestion of skipping the btrfs hook came from.

Yep, and that file shouldn’t be modified, hence my proposition to skip that hook entirely when building the initram.

Okay waiting for your return :wink: