You are not logged in.

#1 2015-06-06 22:35:12

banana_pancakes
Member
Registered: 2015-06-06
Posts: 19

Why mount root fs in initramfs in rw?

I have the exact opposite question than the one found here. Basically, why should we not have in ro? Why ever have it in rw?

Is there a good reason other than fsck, which doesn't apply for btrfs if I understand it correctly?

The examples for gummiboot in the arch wiki are mixed, three with rw and one with ro.

edit: changed wiki link to perma-url

Last edited by banana_pancakes (2015-06-08 08:35:51)

Offline

#2 2015-06-07 12:33:21

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: Why mount root fs in initramfs in rw?

Why do you think it should be? The only reason for the read-only mount is for fsck (or intentional read-only root). If you can fsck before mounting or avoid the fsck entirely, there's no reason to first mount as read-only.

Offline

#3 2015-06-08 08:09:35

banana_pancakes
Member
Registered: 2015-06-06
Posts: 19

Re: Why mount root fs in initramfs in rw?

I'm thinking if one mounts it as read-only, there are less things that can go wrong - since the initial image shouldn't be doing any writes anyway. Is that not the case?

I actually originally thought it would need to be rw for fsck to work (not the opposite), because fsck might want to attempt some repairs.

Offline

#4 2015-06-08 08:23:24

frostschutz
Member
Registered: 2013-11-15
Posts: 1,419

Re: Why mount root fs in initramfs in rw?

banana_pancakes wrote:

I actually originally thought it would need to be rw for fsck to work (not the opposite), because fsck might want to attempt some repairs.

Most filesystems prefer to be not mounted at all (not even read-only). The way it's done for the root partition is a bit of a hack (traditionally it had to be mounted to get at the fsck binary in the first place).

With initramfs in theory the problem can be avoided altogether, if you don't mind the complexity of pulling the fsck utils of your filesystem(s) into the initramfs.

Personally I have very mixed feelings about fsck. It changes the filesystem and there is no way to undo those changes. Sometimes it makes the wrong decisions and thus causes more damage... (particularly the case when it starts asking questions)

If you have a serious filesystem issue you should go into a recovery system and put a copy-on-write layer over your disk and run your experiments with that before applying it to the real thing.

Offline

#5 2015-06-08 08:33:17

banana_pancakes
Member
Registered: 2015-06-06
Posts: 19

Re: Why mount root fs in initramfs in rw?

Thanks, frostschutz. I think I will stick to have fsck be in initramfs as long as it's mounted in ro, otherwise maybe I'll get rid of that hook in mkinitcpio. That way it won't touch the fs (not even sure fsck works on btrfs by default anyway).

If I do get filesystem issues, I'll take your advice and go to a recovery system, make a new snapshot and run repairs there first. Although I'm not very sure that would work properly if there are problems in the btrfs metadata that go across subvolumes.

Anyway, my original question remains: Is there any compelling reason to mount initramfs in rw?

Offline

#6 2015-06-09 14:20:08

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: Why mount root fs in initramfs in rw?

banana_pancakes wrote:

Thanks, frostschutz. I think I will stick to have fsck be in initramfs as long as it's mounted in ro, otherwise maybe I'll get rid of that hook in mkinitcpio. That way it won't touch the fs (not even sure fsck works on btrfs by default anyway).

If I do get filesystem issues, I'll take your advice and go to a recovery system, make a new snapshot and run repairs there first. Although I'm not very sure that would work properly if there are problems in the btrfs metadata that go across subvolumes.

Anyway, my original question remains: Is there any compelling reason to mount initramfs in rw?

fsck in the initramfs occurs before mounting (that's the value of doing it in the initramfs). If you've already fsck'd the filesystem, there's no value in mounting it readonly -- it's just going to be remounted readwrite a few seconds later.

Last edited by falconindy (2015-06-09 15:33:43)

Offline

Board footer

Powered by FluxBB