Choice home at boot

hello, can someone please help create a script that will give you the choice of where to mount the home on system boot.
Something like “press 1 to mount home, from sda press 2 to mount sdb”

script that changes one line in the fstab i think

someone will likely be willing to help
if he/she saw what you came up with so far :sunglasses:

As I take it
you want to conditionally edit /etc/fstab
based upon your choice
before the system starts to boot …
(before scripts can run …)
to put one of two versions of
one and the same
$HOME/user
each of which are residing on two distinct hard drives

There is probably not a lot of people who have a use case for this scenario
so it is unlikely that a ready made solution already exists.
… but I might be wrong …

Wouldn’t creating a second, third etc., user not get you extra home directories?

If that would do what you need done then you could follow this guide.

What’s the use case?

I never thought about it, but I think that the simplest solution would be systemd service that ask you for preferred disk and mount it :thinking:

I suggest you read up on using systemd-homed.

Doing so will make it possible to have one or more portable homes mounted using different credentials.

Please remember this: The forum is not a resource to be used as a place to ask for copy-paste help.

You can go ahead and when you get stuck and need a gentle push to get going - you can do that.

5 Likes

I use one system disk for several computers, each of them has a different home

I think I need a full choice of mounts at home, not just users. this would confuse things, since I use the system on several PCs

I don’t know how to make it possible to output the program at startup.

… so:
you (want to) swap the system disk
between different machines?
and each of those
has it’s own /home/user already
… by another (already existing, resident) disk?

and it’s an encrypted /home as well … ?
a different one each time …

as @maycne.sonahoz said:
what’s the use case?

/dev/mapper/luks-*********************************** /home ext4 rw,relatime 0 2

this line for first pc, and the second must use the home directly from the disk

I have one portable disk with a ready-to-use system on it.

There are two computers, one has an encrypted disk to be used as a home.

The second computer has no disks, I plug the only portable one into it.

That is, I have two homes, in the portable drive and on a separate drive in the computer. and I need to switch between them

… that makes it more clear - but not easier :sunglasses:

all I could do is ask for clarification

can’t assist in achieving your goal

Cheers!

1 Like

Wouldn’t it be simpler to always boot on the portable drive as a standalone system, and keep the “inner” drives as extra storage? Basically, inverting what usually are internal main system and external extra storage.

Also, don’t have issues on any or other computer sometimes? I mean, besides the main drive, you have to support (supposedly) multiple hardware configurations on a single system…

no problems, but I still need my described variant)