Dualboot - Sharing directories

I plan to dual-boot different flavor of Opensuse ( 13.2, tumbleweed, leap ) on my laptop with a 125GB SSD.
Is it possible to share some directories ( /tmp, /var, /srv, … ) for all installed flavor.
In case of yes I shall put them on the HDD and not on the SSD.

Any help is welcome

Hi
I normally just create a /data partition (xfs) on an additional drive and then use softlinks for common items in the $HOME directory or elsewhere in the system if required. Then use a common swap (on HDD).

Use tmpfs for /tmp (See https://en.opensuse.org/SDB:SSD_performance)

Are you going to use btrfs for / ? If so then depending on either Legacy or efi booting (some renaming required here in /boot/efi) else if legacy you would need some small boot and an extended partition, but would allocate 40GB for each OS, how much system RAM?

For 13.2 you would need to make some tweaks as Leap and Tumbleweed have some SSD/HDD improvements (See link above for Tuning Kernel).

Here is a dual boot WinX and SLED 12 SP1, efi booting as an example;


lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 119.2G  0 disk 
├─sda1   8:1    0   260M  0 part /boot/efi
├─sda2   8:2    0   128M  0 part 
├─sda3   8:3    0    40G  0 part /
├─sda4   8:4    0  78.4G  0 part 
└─sda5   8:5    0   449M  0 part 
sdb      8:16   0 298.1G  0 disk 
├─sdb1   8:17   0     8G  0 part [SWAP]
└─sdb2   8:18   0 290.1G  0 part /data

At the moment, my system executes Opensuse.13.2 with efi boot and all partition are ext4.
I plan to install :
1°) only opensuse and test which interface suits me best.
2°) Use WIN10 as VM on virtualbox (50 GB) for some softwares.
3°) Use WINXP as VM for old bridge cards games for trainning (need only 10 GB on VM, every things else run from original XP CD).
4°) Use WINXP as VM for current GPS software (hicking) (need only 10 GB on VM, maps are built and stored on separate partition) until I bought the next version when published and run it on windows 10.

Software for Samsung laser printer are installed in /opt.
Some web app are installed in /srv.
DLNA data ( photos, videos, …) are installed in /srv.

So, what can be shared outside the root partition of each opensuse flavor.

Noted; I have read things on internet.
But why using specifically xfs ? ( A link for documentation should be appreciated )

Hi
OK, so efi booting you may have to rename the /boot/efi/opensuse directory per install for multibooting, or perhaps create small esp’s (/boot/efi) for each install?

By default these days, xfs is the default for /home on openSUSE, use which ever meets your needs, there is always pros and cons for any filesystem :wink: A google on openSUSE+XFS will show plenty of links. http://www.linux.org/threads/xfs-file-system.4364/ https://en.wikipedia.org/wiki/XFS

No reason your /opt or /srv can’t exist outside just need to define on install, the only issue will be different builds/libs for any software in /opt and /srv. If not using much space for /opt, probably easier to leave on / so any version differences remain with the booted os. Else just create partitions for each /opt on the hdd for use by each OS.

In this situation, I share swap. And I (sort of) share the home directories.

Sharing swap is no problem, except that if you hibernate, you must reboot the hibernated system before you try to boot the other.

For sharing home, I mount my home partition at “/xhome” on the second system. There, I leave “/home” part of the root file system, but I put symlinks in my home directory to connect to files back in /xhome.

For example, I do:

rmdir bin
ln -s ../../xhome/$USER/bin .

so that my “$HOME/bin” is the same on both.

This allows both systems to have separate settings file (in “.kde4”, “.config” etc) while sharing my own files.

You should not try to share “/var”. However, if “/tmp” is a separate partition, it should be safe to share that.

Hi
What about ESP’s in multiboot since openSUSE creates a /boot/efi/opensuse directory in the EFI partition, multiple ones or rename directories?

They all use the same directory.

I create a subdirectory. On my current desktop, I have “tw” subdirectory, and a “42_1” subdirectory. I copy the UEFI files for Tumebleweed to the “tw” directory, and the 42.1 files to the 42_1 directory. I use “42_1” rather than “42.1” so that “.” won’t match the subdirectories but will match the files that I might need to copy to the subdirectory.

Then I make sure that the boot menu for either system can boot the other. So I can switch which handles the booting by copying that subdirectory back. But it isn’t that important since I can boot either system no matter which is in control.

Actually, if secure-boot is configured (even if disabled), the file “grub.cfg” in that opensuse direction is the only one that matters for selecting which system’s menu to use. The menu isn’t there, but that “grub.cfg” loads the menu from “/boot/grub2/grub.cfg”

Hi
So on efi updates, does it re-create the /boot/efi/EFI/opensuse directory or respects the changed names?

An additional comment.

You can actually change the name of the directory to be used in the EFI partition. It is the first word of the GRUB_DISTRIBUTOR value that is set in “/etc/default/grub”. At one time, you could set that during install, but the latest Tumbleweed installers have removed that ability.

However, after several years of doing this, I prefer using always the same “opensuse” directory, with subdirectories as indicated in my previous comment.

So if I understand you have :
/boot/efi/EFI/opensuse/tw
/boot/efi/EFI/opensuse/42_1

How the boot process find the data ?
You don’t have to specify somewhere that data are in new directory ?
Or it is grub-mkconfig that find data by-itself ?

[QUOTE=jcdole;2749050]So if I understand you have :
/boot/efi/EFI/opensuse/tw
/boot/efi/EFI/opensuse/42_1[QUOTE]
Correct.

However, the files needed for booting are still in “/boot/efi/EFI/opensuse”.

In effect, I am using the subdirectories as backups. If a new install clobbers the files in “/boot/efi/EFI/opensuse”, I can copy back from the backup directory – just as long as the new install doesn’t delete those backup directories (so far it has been good about that).

[QUOTE=nrickert;2749054][QUOTE=jcdole;2749050]So if I understand you have :
/boot/efi/EFI/opensuse/tw
/boot/efi/EFI/opensuse/42_1

Correct.

However, the files needed for booting are still in “/boot/efi/EFI/opensuse”.

In effect, I am using the subdirectories as backups. If a new install clobbers the files in “/boot/efi/EFI/opensuse”, I can copy back from the backup directory – just as long as the new install doesn’t delete those backup directories (so far it has been good about that).

Hi
I have a backup script which should keep a copy for you?
http://paste.opensuse.org/ee36ffb1

As long as one of them is present and then shows the other OS’s in the grub menu, then all should be good…

I guess then it’s a matter if a shim/grub update to check the files and move as required?

Thank you everybody for helping.
Cross your finger I am diving.
I will give news asap

Yes, that’s it.

Running your script, I have a backup made by sgdisk into a binary file (linux-irdp_sda_backup_011716143355.gpt).

How to read back this file to verify, view the contents.

.

Hi
You need to test on another disk by loading the backup file (gpt) to it, then use the -p to print and then -v to verify.


sgdisk --load-backup=linux-irdp_sda_backup_011716143355.gpt /dev/sdX

Hello.

One needs a disk of the same size of the original disk.

We can just keep a copy of

 lsblk -o name,fstype,mountpoint,label,size

and for each device

gdisk -l /dev/sdX

Hi
The only thing is the disk UUID’s change this way, then if you have a system backup, you then need to fix things in fstab etc…

To be honest an install from scratch these days is fairly painless, it’s more setting things back up that can be an issue for some…

Hello.
Ok have installed in that order :
a) tumbleweed
b) 13.2
c) Leap 42.1

1°) tumbleweed install (/dev/sda3).
during install I have set 3 separate partitions ( 50 GiB for each flavor )[INDENT=2]/ set to /dev/sda3
/1 set to /dev/sda4
/2 set to /dev/sda5
[/INDENT]
I have set also 1 separate partition for /boot/efi ( 300 Mb )
I have set also 1 separate swap partition ( 8 Gib )
I have set also 1 separate partition “/data_home” for home user data ( 20 Gib )(next task to be done)

[INDENT=2]For each user I will deleted /home/user_name/Documents, Downloads,Music,…
[/INDENT]
[INDENT=2]Then I will put links for each user to /data_home/user_name/Documents, Downloads,Music,…
[/INDENT]

No remarks concerning the install and booting/rebooting

2°) 13.2 install (/dev/sda4).
Remark 1
During partition options, the installer plan to install in the existing slash partition (/dev/sda3).
Have deselect the current slash partition (/dev/sda3) ( no formatting, no mount )
Have select the existing “/1” (/dev/sda4) partition, rename it “/” and set format and mount option ON.

No more remarks concerning the install.

Remark 2
At first reboot of "13.2"Tumbleweed in the boot screen appear as “opensuse yyyymmdd”

Tumbleweed advance option in the boot screen appear as “opensuse yyyymmdd”

No remarks concerning booting/rebooting “13.2”.
Have not tested rebooting on tumbleweed (this is not clever).

3°) Leap 42.1 install (/dev/sda5).
Remark 3
During partition options, the installer plan to install in the existing slash partition (/dev/sda4).
Have deselect the current slash partition (/dev/sda4) ( no formatting, no mount )
Have select the existing “/2” (/dev/sda5) partition, rename it “/” and set format and mount option ON.

No more remarks concerning the install.
No remarks concerning booting/rebooting Leap.

4°) After all install test of booting on all flavor.

The Boot menu present 6 options :

openSUSE Leap 42.1
Advanced options for openSUSE Leap 42.1
openSUSE 20160116 (x86_64) (on /dev/sda3 )
Advanced options for openSUSE 20160116 (x86_64 (on /dev/sda3 )
openSUSE 13.2 (x86_64) (on /dev/sda4)
Advanced options for openSUSE 13.2 (x86_64) (on /dev/sda4)

Note : Option 3 and 4 concern tumbleweed

Choosing option 1 “Leap” ( the last installed )
Boot normally
“/” is mount on /dev/sda5
/dev/sda3 /dev/sda4 are unmounted

Choosing option 3 “openSUSE 20160116 (x86_64) (on /dev/sda3 )”
Failed to finish starting.
Ask for root password to enter maintenance session.
Entering maintenance session
a) starting yast2, Partitioner show “/” mount on /dev/sda3 (normal)/dev/sda4 /dev/sda5 are unmounted (normal)

b) /etc/fstab/dev/sda4 is configured to be mounted as /1 (initial partitioning)
/dev/sda5 is configuring to be mounted as /2 (initial partitioning)

c) Editing /etc/fstabcommented out /dev/sda4
commented out /dev/sda5

d) shutdown and reboot
Boot normally

Choosing option 5 “openSUSE 13.2 (x86_64) (on /dev/sda4)”
Failed to finish starting
Ask for root password to enter maintenance session.
Entering maintenance session
a) starting yast2, Partitioner show “/” is mount on /dev/sda4 (normal)/dev/sda3 /dev/sda5 are unmounted

b) /etc/fstab/dev/sda3 does not exists
/dev/sda5 should be mounted as /2 (initial partitioning)

c) Editing /etc/fstabcommented out /dev/sda5 /2 (initial partitioning)

d) shutdown and reboot
Boot normally

Now every thongs boot normally.

It seems a bad idea to pre-create partition for future OS install.
Is it the reason why I have to modify /etc/fstab on subsequent os installed ?

Any comments are welcome.

Hi
On multiboot installs I always rescan the drive(s) before selecting the partitions for install, this should overcome the issues you observed.

Then add the data and shared swap as required to each install so no further work required.