0

I'm trying to build a system with a duplicate partition that only one of the partition that is duplicated is mounted to the system.

The scenario is like this: Suppose i have the following partition sda1,sda2,sda3,sda4. sda2 and sda4 are identical (let's say sda4 is my backup partition for sda2). during the init process the userspace will ask the kernel which of the partition to mount sda2/sda4? and he will mount accordingly.

Before I'll start to build it by myself, i wonder if there is a system that doing that or similarly to that. when I'm searching swap partition i get only the classic Linux swap partition result. also i get irrelevant result from my searching keyword and i cant find something similarly system or knowledge.

I'll appreciate any knowledge about the scenario before i start build it

Thanks

2
  • What bootloader you're using? And how generic should it be ? (e.g. the label are persistent or are they changing regularly) – Maze Mar 8 '20 at 10:06
  • i'm using raspberrypi, label is one way to solve that, how ever i'm trying to avoid that in case that i'll be more generic, since the mount is for partition that can change by name and since ' and the kernel will know which from the toe duplicate need to be mount in the init process – yntnm Mar 8 '20 at 11:01
0

Sounds like you just want a new boot menu entry where you set different partitions as root filesystem. With that you can decide which partition you want to use on each boot (and only the partition you booted from is mounted). You can set a default option. The bootloader will boot from that if you don't do anything during the boot process (pressing nothing for a specific amount of time).

You even can change this via scripts (if you want to set the next boot option).

3
  • hi, actually is not the rootfs is other partition. the rootfs will stay the same, but the external partition will change and mount by given parameter from kernel. hance the parameter for the mount can change – yntnm Mar 8 '20 at 10:59
  • When should the disk be ready? If you really need it during boot time, you must create a custom kernel hook. Otherwise you could add scripts after a successful login - depending when you need the disk. – Maze Mar 8 '20 at 12:17
  • after boot time, yeah script is the solution , thing is that I'll need to mange what mount and not ' and do the replica. if there is no solution for that I'll do it by myself. i just had hared time with looking for something that already work.. guess there is no option , thanks :) – yntnm Mar 8 '20 at 13:46

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.