0

I have a FreeBSD 10.2 based x86_64 machine with read-only root. For security reason I cannot mount '/' as r/w or remount it as r/w post bootup.

Sometimes I have to change file system of one of partition from UFS to ext2. To boot cleanly after FS change fstab need to be modified which due to above constraints I am not able to do now.

To get around RO root constraints I'm thinking of replacing '/etc/fstab' with a symbolic link from '/etc/fstab' to actual fstab in '/efi/fstab where '/efi' is a non-root partition with r/w access. Problem is how to make OS to run /'efi/fstab' on bootup time as 'efi' is mounted by fstab itself.

This may be little ugly fix but with given constraints this is what have in mind as of now. Open for better ideas/suggestions.

Mount command give an option to specify an alternative fstab file. Not sure if alternative path mention in description here can be on non-root partition and if yes, how to do that. Anyone have tried this option?

-T, --fstab path Specifies an alternative fstab file. If path is a directory then the files in the directory are sorted by strverscmp(3); files that start with "." or without an .fstab extension are ignored. The option can be specified more than once. This option is mostly designed for initramfs or chroot scripts where additional configuration is specified beyond standard system configuration.

  • 2
    You only have to modify /etc/fstab once though, when you set up the system, not every time you boot ... How is this different to setting up any other config file on your root system (e.g. init scripts)? – Time4Tea Nov 14 '17 at 16:22
  • 2
    You cannot link /etc/fstab to an unmounted filesystem. – Richard Smith Nov 14 '17 at 16:36
  • @Time4Tea Box Sorry I didn't get your point. – Satpal Parmar Nov 14 '17 at 16:44
  • 1
    My point is that, at some point, the root filesystem had to be mounted with write access, in order for the system to be installed and set up in the first place. Why didn't you configure /etc/fstab at that stage and why couldn't it be done again? – Time4Tea Nov 14 '17 at 16:48
  • @RichardSmith Is it possible to mount partition that have 'fstab' to explicitly during boot-up so that os can access it and run fstab present there? In that case I will need require symbolic link. For example a partition 'efi' will be msdos always . I can put fstab there. But how to make OS pick this fstab. – Satpal Parmar Nov 14 '17 at 16:49

Your Answer

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

Browse other questions tagged or ask your own question.