Need help with Dual booting (OpenSuse + CentOS)

To all you fine gentlemen and ladies,

I have made a pretty noob mistake and before I break my system, I seek your recommendations.

Problem : OpenSuse Leap 42.1 installed with following mount points. Here is my /etc/fstab…


/dev/sda1            /                    ext4       acl,user_xattr        1 1
/dev/sda2            swap                 swap       defaults              0 0
/dev/sda4            /boot                ext4       acl,user_xattr        1 2
/dev/sda3            /home                ext4       acl,user_xattr        1 2

As you can see it is pretty old fashioned and normal. But problem is, all of them are primary partitions. (I should have known better when I uninstalled tumbleweed and got myself Leap 42.1:( )

Now, I would like to install CentOS alongside Leap (as a dual boot). When I use Gparted, it says that my system has ran out of all available primary partitions, and it advises me to get an extended partition first.

Now from the partition table I have posted above, /home is expendable (took backup in my external HDD)

So what I have planned is :

  1. Remove the /home mount point.
  2. clear the allocated space to that mount point
  3. make it an extended partition
  4. create separate partitions for CentOS

Before I get a live media and start doing things, my questions are

  1. What the hell am I doing ? is there anything easier ?
  2. Is it possible to use the swap partition of opensuse as swap for CentOS (that way I can have two more movies on my computer)
  3. Is it possible to have a single /home directory (maybe I could just create a sym link and direct it there?)

I don’t want to start from scratch :frowning:

To begin with, your fstab does not look like created by default by an openSUSE installation. The default installation does not use the /dev/sdXn device files directly, but the /dev/disk/by-id/ symlinks.

Then, very minor, but maybe usefull in future posts, such a listing of /etc/fstab in no HTML code, but just CODE. So please do not use the HTML tags, but the CODE tags (it is the button with the # on it). And please, when applicable as here, post complete, that is including promt, command, output and next prompt. That is the best way to show who you were, where you were, what you did and what you got without need for story telling.

And yes, when you have MBR partitioning (I assume you have), you can only have 4 primary partitions. You do not show your partition table, but the numbering 1 - 4 of the existing mounts must also lead to that conclusion. Nevertheless, showing your partitioning might help us in helping you:

su - -c '/usr/sbin/fdisk -l'

It is best (but not a must) to have the extended partition as last partition, taking up the rest of the disk. In your case that seems to be now sda4 (not sure until we see the table), but that is used as /boot (you decided to have a separate /boot for some reason). Again advice about what to do to get an extended partition depends on the existing partition table.

It is very much possible to use the same Swap partition for both systems.

It is possible to use the same /home file system for both systems (if both systems support the file system type). No symlink needed, just mount it. But it could be that configuration files for e.g. your desktop might be confusing to the different desktops on the different systems when they are not exactly of the same version. Using e.g. the next version of KDE on the existing configuration files will possibly update the config files. When you then use those files again in the other system with the older KDE, that might bring problems.
Also think of a program that was running on shutdown in system A. On login in system B the desktop might try to start that program (when you have “Restore the session” on), but is is not even sure that that program is installed in system B.

Thus using the same /home should be done carefully (maybe other have experience with that).

What you could do though is creating a small /home on system B, mount the /home of system A on another place (e.g. .mnt/home-A) and then use symlinks from your ~/movies on systemB to /mnt/home-A/<user>/movies, etc. Thus having your movies on only one place.

You really do not need a /boot partition. If you do have one it needs to be at least 400 meg since openSUSE by default can have up to 3 kernels installed at any point.

A common home partition is OK but either use different desktops or use different user names to keep config files separate since each distro may have a different version of a given desktop.

And it is unclear what if you use GPT or DOS/MBR partitioning.

You can use common swap but then see that you don’t suspend one OS and start another.

I think so that he can overcome this problem if he uses different username for different OS. Then, home partition will be same for both the OSes but /home folder will be different, hence the config files of different OSes will not interfere with each other.

On 2015-12-17, anirban b <anirban_b@no-mx.forums.microfocus.com> wrote:
> I have made a pretty noob mistake and before I break my system, I seek
> your recommendations.

As a rule on an MBR-style hard drive, try to make every last partition an extended partition so you have more options if
you’ve made a mistake.

> 1. What the hell am I doing ? is there anything easier ?

Difficult to comment without knowing partitions sizes. Please output the results of:


sh-4.2$ su -
sh-4.2# for devsd in $(find /dev/sd* ! -name "*[0-9]"); do parted $devsd unit GiB print; done
sh-4.2# cat /etc/fstab | grep /dev/sd
sh-4.2# df -h | grep /dev/sd
sh-4.2# exit

> 2. Is it possible to use the swap partition of opensuse as swap for
> CentOS (that way I can have two more movies on my computer)

Yes. As long as you don’t switch your GNU/Linux distribution between suspend to disk operations.

> 3. Is it possible to have a single /home directory (maybe I could just
> create a sym link and direct it there?)

Yes. But don’t. Your symlink idea to a common data partition is a better option. That way you explicitly control what is
shared and what isn’t shared between the two different GNU/Linux installs.

@hccv, thanks for the insight…

To begin with, your fstab does not look like created by default by an openSUSE installation. The default installation does not use the /dev/sdXn device files directly, but the /dev/disk/by-id/ symlinks.

Yeah, as a guy who has dabbled in Solaris 9 and 10 (although very little) in past, I find /dev/sdXn better than (and a bit similar to cXtXdXsX) IDs… That’s just me :slight_smile:


anirban@opensuse:~> su - -c '/usr/sbin/fdisk -l'
Password: 

Disk /dev/sda: 298.1 GiB, 320072933376 bytes, 625142448 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x0b06f137

Device     Boot     Start       End   Sectors  Size Id Type
/dev/sda1            2048 100855807 100853760 48.1G 83 Linux
/dev/sda2       100855808 107153407   6297600    3G 82 Linux swap / Solaris
/dev/sda3       107153408 318939135 211785728  101G 83 Linux
/dev/sda4  *    318939136 319983615   1044480  510M 83 Linux

Disk /dev/sdd: 7.2 GiB, 7743995904 bytes, 15124992 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x70e2d78a

Device     Boot Start     End Sectors  Size Id Type
/dev/sdd1  *        0 8419327 8419328    4G  0 Empty
/dev/sdd2        2148   14951   12804  6.3M ef EFI (FAT-12/16/32)


sdd is a usb thumb drive and can be ignored totally…

It is best (but not a must) to have the extended partition as last partition, taking up the rest of the disk. In your case that seems to be now sda4 (not sure until we see the table), but that is used as /boot (you decided to have a separate /boot for some reason). Again advice about what to do to get an extended partition depends on the existing partition table.

/boot is a bad habit from my Red Hat 4.8 days… :frowning: if there’s a way to move it outta primary partition, please tell me how to… I used linux very sparingly post 2009 and it’s a totally different ball game now. Thank God the command line is the same old…Only a few weeks ago I screwed up while trying to move from tumbleweed to Leap…

@gogalthorp,

And it is unclear what if you use GPT or DOS/MBR partitioning.

Plz tell me how to determine that…

@Vishy,

You can use common swap but then see that you don’t suspend one OS and start another.

Well, that’d be a silly mistake then… but seriously, I’m not doing that on purpose.

@flymail,


opensuse:~ # for devsd in $(find /dev/sd* ! -name "*[0-9]"); do parted $devsd unit GiB print; done
Model: ATA Hitachi HTS54503 (scsi)
Disk /dev/sda: 298GiB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start    End      Size     Type     File system     Flags
 1      0.00GiB  48.1GiB  48.1GiB  primary  ext4            type=83
 2      48.1GiB  51.1GiB  3.00GiB  primary  linux-swap(v1)  type=82
 3      51.1GiB  152GiB   101GiB   primary  ext4            type=83
 4      152GiB   153GiB   0.50GiB  primary  ext4   

opensuse:~ # grep /dev/sd /etc/fstab
/dev/sda1            /                    ext4       acl,user_xattr        1 1
/dev/sda2            swap                 swap       defaults              0 0
/dev/sda4            /boot                ext4       acl,user_xattr        1 2
/dev/sda3            /home                ext4       acl,user_xattr        1 2
opensuse:~ # 
opensuse:~ # df -h | grep /dev/sd
/dev/sda1        48G  7.1G   40G  16% /
/dev/sda4       486M   54M  403M  12% /boot
/dev/sda3       100G  897M   98G   1% /home
/dev/sdc        1.9G  1.2G  788M  60% /tmp/syslinux.mnt.8389.0

Yes. But don’t. Your symlink idea to a common data partition is a better option. That way you explicitly control what is
shared and what isn’t shared between the two different GNU/Linux installs.

Thanks. This is something I gotta figure out if Symlinks are better than different usernames on different OS (thanks Vishy)…

Ok you use DOS/MBR partitioning/BOOT.

So as you have done it with 4 primary partition which is the max that can be used in this partitioning scheme. One primary could have been set as extended allowing more logical partitions to be defined. There is no sign of 2 OS’s looks like one is installed taking all the possible primary partitions of the drive. You really don’t need a boot drive unless you use encrypted partition or maybe odd file system. You can not add more partition even if you have free space. So you are painted into a corner. Only way to fix it is to redo thing right.

If this is a newer machine it may have an EFI BIOS which would allow EFI rather then MBR boot and GPT partitioning which does not have the limits of DOS

BTW /dev/sdX# syntax is not stable since it depends on the way the BIOS enumerates the drives at boot which can change if perhaps you have a USB drive plugged in. This will break the code in fstab. It is far far better to use any of the BY- syntaxes since they are stable also you can use labels if you name label the partitions but all labels on the machine or ever attached must be unique.

Thanks for posting those outputs.

On 2015-12-17, anirban b <anirban_b@no-mx.forums.microfocus.com> wrote:
> @flymail,
>
>
> Code:
> --------------------
>
> opensuse:~ # for devsd in $(find /dev/sd* ! -name “*[0-9]”); do parted $devsd unit GiB print; done
> Model: ATA Hitachi HTS54503 (scsi)
> Disk /dev/sda: 298GiB
> Sector size (logical/physical): 512B/512B
> Partition Table: msdos
> Disk Flags:
>
> Number Start End Size Type File system Flags
> 1 0.00GiB 48.1GiB 48.1GiB primary ext4 type=83
> 2 48.1GiB 51.1GiB 3.00GiB primary linux-swap(v1) type=82
> 3 51.1GiB 152GiB 101GiB primary ext4 type=83
> 4 152GiB 153GiB 0.50GiB primary ext4

Correct me if I’m mistaken, but it seems we have an MBR-style 300GiB hard drive, in which you’ve made 4 primary
partitons and they take up only 50% of the hard drive capacity. What did you to do that? You can’t have more than 4
primary partitions on MBR-style hard drives and so you’ve made 150 GiB unusable - you could have just bought a
(slightly) cheaper hard drive.

> opensuse:~ # grep /dev/sd /etc/fstab
> /dev/sda1 / ext4 acl,user_xattr 1 1
> /dev/sda2 swap swap defaults 0 0
> /dev/sda4 /boot ext4 acl,user_xattr 1 2
> /dev/sda3 /home ext4 acl,user_xattr 1 2

Despite common evidence to the contrary, there’s nothing wrong with having a separate /boot/. I actually find helpful to
do so when I have multiple GNU/Linux distibutions on the save hard drive.

> opensuse:~ #
> opensuse:~ # df -h | grep /dev/sd
> /dev/sda1 48G 7.1G 40G 16% /
> /dev/sda4 486M 54M 403M 12% /boot
> /dev/sda3 100G 897M 98G 1% /home
> /dev/sdc 1.9G 1.2G 788M 60% /tmp/syslinux.mnt.8389.0
>
> --------------------

So it seems you’re using only 1% of your home partition for data, and not even an entire GiB. Seriously why are you
concerned about having to do a reinstall? Backup your data and start again. Since the time of you posted your first
message to this thread you have fixed your partition scheme, formatted, installed multiple GNU/Linux distributions, and
have spare time for a few drinks in the bar.

> Thanks. This is something I gotta figure out if Symlinks are better than different usernames on different OS (thanks
> Vishy)…

Symlinks are better than usernames because it gives more safety and flexibility:

a) You’re not forced to use different usernames, including for multiple users.
b) You’re not forced to common file systems and permissions.
c) If you delete /home/ you don’t, it’s no big deal because you can all data is a physically different partition.
d) If you ever want to make your data available to Win64 systems, you’re symlinked data partition can be ntfs format.

This is my opinion, but I can see why some might prefer the different username strategy.

But before you start again, please tell us the age of your motherboard (my guess is over 3 years) to confirm GPT is not
an optimal selection over MBR in your case.

To be honest: this is lousy partitioning. You even have space left on the disk (~140GB) you can not use anymore because you already used the four primaries.

The following is just my advice based on some assumptions (it is not quite clear what your goal is in installing a second OS and being able to use at least part of the data of your openSUSE installation, movies?)

Make an extra backup of all in your /home file system.
Do a fresh installation of openSUSE and create a partitioning of e.g.:
sda1: primary partition of 3 or 4 GB for Swap of both systems.
sda2: primary partition of 20GB for an ext4 file system for / of openSUSE.
sda3: primary partition of the default size for a CentOS file system for /.
sda4: extended partition covering the rest of the disk.
sda5: logical partition for /home of openSUSE, should be large enough for the standard contents but not for the movies.
sda6: logical partition for /home of CentOS, should be large enough for the standard contents but not for the movies.
sda7: logical partition to be mounted on /home/<user>/Movies on both systems, size either all that remains or less.
You can of course change this, but I hope you get the idea.
After installation restore /home from the backup (but of course any movies already in the backup should go to the new place).

Also my advice is to use the default way of using /dev/disk/by-id. There may be good reasons to use other ways (like by-uuid) for some people, but sentiments of SunOS disk slices are NOT a good reason in my opinion.
About the same for not using a separate file system for /boot.

@gogalthorp

/dev/sdX# syntax is not stable since it depends on the way the BIOS enumerates the drives at boot which can change if perhaps you have a USB drive plugged in.

That thought never occurred to me. Thanks for pointing that out. :slight_smile:

Correct me if I’m mistaken, but it seems we have an MBR-style 300GiB hard drive, in which you’ve made 4 primary
partitons and they take up only 50% of the hard drive capacity. What did you to do that? You can’t have more than 4
primary partitions on MBR-style hard drives and so you’ve made 150 GiB unusable - you could have just bought a
(slightly) cheaper hard drive.

I thought gparted or its kde cousin would be able to sort it out… Silly I know!!!..My previous build of tumbleweed had the whole HDD to reign, but then I switched to Leap… Another messy process on which I sought help on these forums.

So it seems you’re using only 1% of your home partition for data, and not even an entire GiB. Seriously why are you
concerned about having to do a reinstall? Backup your data and start again. Since the time of you posted your first
message to this thread you have fixed your partition scheme, formatted, installed multiple GNU/Linux distributions, and
have spare time for a few drinks in the bar.

Yes, I have the backups taken to my external hard drives. Yes, I did finally reinstall (explaining that later), but I wanted to know IF there was a chance of saving my Leap installation. Sigh, I’ll never know now…

@hcvv, You ROCK! That was immensely helpful.

#lousy spelling

Thanks Guys for your inputs… Here’s what I finally did.

  1. Reinstalled leap, added few repos, updated 3 primary partitions (/, swap and /home) and a big chunk of logical)… Here’s the Fstab from Leap

UUID=fb80e62f-b986-47fd-8831-f478151cbd14 /                    ext4       acl,user_xattr        1 1
UUID=5e87bd5d-1704-4f38-8474-981aef412768 swap                 swap       defaults              0 0
UUID=1b310762-3a77-42a8-b58a-3b520b026138 /home                ext4       acl,user_xattr        1 2

  1. Installed CentOS 7… Couldn’t make it take up the already present swap, so installed without any swap. Here’s the original fstab from CentOS

UUID=62fb84ba-c414-4d2d-965e-c15bd15357ad /                       ext4    defaults        1 1
UUID=9db6e217-7dc3-4da2-9d71-5f35052248c6 /boot                   ext4    defaults        1 2
UUID=d6b28f2c-7f7b-484f-afc1-5584a43b112b /misc                   ext4    defaults        1 2

/misc is something I created as another handy FS to share between two OSs…

  1. CentOS had a dedicated /boot partition, I thought I’d select legacy grub on CentOS and just point it to the opensuse’s / partition. Turns out, you can’t have Grub legacy on CentOS without doing some serious research, so grub2 was installed automatically.

  2. CentOS thankfully detected the Leap installation correctly and showed me in its grub2 menu.

  3. Logged on to CentOS, tweaked its fstab to mount and use the swap and /home (from opensuse, now dubbed /common_home).

  4. Something went haywire and and post reboot CentOS won’t show Leap’s entry in menu. grub2 files looked fine too, it still had opensuse’s entry. But Leap was kaput.

  5. uninstalled and reinstalled grub2 on CentOS, did osprobe, no change.

  6. Reinstalled CentOS.

  7. Leap showed up again on boot menu. Booted from Leap.

  8. Did OSprobe from Leap, a reboot confirmed that centOS was on grub2 menu of Leap. Yay!!

  9. Logged into CentOS, tweaked its fstab as follows :


UUID=62fb84ba-c414-4d2d-965e-c15bd15357ad /                       ext4    defaults        1 1
UUID=9db6e217-7dc3-4da2-9d71-5f35052248c6 /boot                   ext4    defaults        1 2
UUID=d6b28f2c-7f7b-484f-afc1-5584a43b112b /misc                   ext4    defaults        1 2
UUID=5e87bd5d-1704-4f38-8474-981aef412768 swap                    swap    defaults        0 0
UUID=1b310762-3a77-42a8-b58a-3b520b026138 /common_home            ext4    defaults        1 2

  1. Reboot confirmed that CentOS can use swap and has mounted the /common_home FS as expected. Whew!
  2. created a directory data in CentOS’ home directory (/home/ani/data; ani → username). Attempted to link it to directory on /common_home/data , but somehow that’s not happening yet. (Need your help here…)
  3. added ‘users’ as a secondary group for username ani. So, in theory, it should access files from /common_home/anirban and /common_home/guest (both users on Leap). Yet to test that though. (may have to give 775 on those directories, will try and inform)…

Final question : How do I create a Symlink from /home/ani/data (CentOS) to point to /common_home/data (shared FS)? Whatever I am doing is pointing to the reverse. And what should be the permission on both the link and the directory ?

Read

man ln

in short it is

ln -s <existing-file-you-want-to-link-to> <new-file-that-should-link-to-it>

or, in your example

ln -s /common_home/data /home/ani/data

or, when /home/ani is your working directory (e.g. by having loged in as user ani were /home /ani is your home directory):

ln -s /common_home/data data

The latter is what is called the “symlink”. The permissions on the symlink do not matter. They are there and you will see them when you ask for them (e.g. with ls -l), but only the permissions of the real file count. Of course, security would be severly compromised if you could overwrite the premissions of a file by simply creating a symlink to it with different permissions!

@hcw, here’s what I already have tried.


[ani@localhost ~]$ ls -al ~/data
lrwxrwxrwx. 1 root root 17 Dec 26 03:48 /home/ani/data -> /common_home/data
[ani@localhost ~]$ cd data
[ani@localhost data]$ pwd
/home/ani/data

and in /common_home


[ani@localhost data]$ cd /common_home/
[ani@localhost common_home]$ ls -al
total 36
drwxrwxrwx.  6 root root   4096 Dec 26 03:52 .
dr-xr-xr-x. 20 root root   4096 Dec 26 03:16 ..
drwxr-xr-x. 19 ani  users  4096 Dec 26 02:44 anirban
drwxrwxr-x.  2 ani  ani    4096 Dec 26 16:13 data
drwxr-xr-x.  3 1001 users  4096 Dec 25 20:41 guest
drwx------.  2 root root  16384 Dec 25 18:15 lost+found

but here’s the thing I’m confused about.


[ani@localhost ~]$ cd data
[ani@localhost data]$ ls -al
total 8
drwxrwxr-x. 2 ani  ani  4096 Dec 26 16:13 .
drwxrwxrwx. 6 root root 4096 Dec 26 03:52 ..
lrwxrwxrwx. 1 ani  ani    17 Dec 26 03:53 data -> /common_home/data
-rw-rw-r--. 1 ani  ani     0 Dec 26 16:13 test
-rw-rw-r--. 1 ani  ani     0 Dec 26 16:13 test1
[ani@localhost data]$ pwd
/home/ani/data
[ani@localhost ~]$ cd data
[ani@localhost data]$ ls -al
total 8
drwxrwxr-x. 2 ani  ani  4096 Dec 26 16:13 .
drwxrwxrwx. 6 root root 4096 Dec 26 03:52 ..
lrwxrwxrwx. 1 ani  ani    17 Dec 26 03:53 data -> /common_home/data
-rw-rw-r--. 1 ani  ani     0 Dec 26 16:13 test
-rw-rw-r--. 1 ani  ani     0 Dec 26 16:13 test1
[ani@localhost data]$ pwd
/home/ani/data

so there is a data symlink inside my ~/data ? and there’s another data inside… this is like inception… rotfl!

Here’s the inception at its limbo state :


[ani@localhost data]$ pwd
/home/ani/data/data/data/data/data/data/data/data
[ani@localhost data]$ ls -al
total 8
drwxrwxr-x. 2 ani  ani  4096 Dec 26 16:13 .
drwxrwxrwx. 6 root root 4096 Dec 26 03:52 ..
lrwxrwxrwx. 1 ani  ani    17 Dec 26 03:53 data -> /common_home/data
-rw-rw-r--. 1 ani  ani     0 Dec 26 16:13 test
-rw-rw-r--. 1 ani  ani     0 Dec 26 16:13 test1

@hcvv,
Now it’s working like its supposed to :). Thanks a lot!


[ani@localhost data]$ pwd
/home/ani/data
[ani@localhost data]$ ls -al
total 8
drwxrwxr-x. 2 ani  ani  4096 Dec 26 16:23 .
drwxrwxrwx. 6 root root 4096 Dec 26 16:23 ..
[ani@localhost data]$ touch test1
[ani@localhost data]$ ls -al;pwd
total 8
drwxrwxr-x. 2 ani  ani  4096 Dec 26 16:24 .
drwxrwxrwx. 6 root root 4096 Dec 26 16:23 ..
-rw-rw-r--. 1 ani  ani     0 Dec 26 16:24 test1
/home/ani/data
[ani@localhost data]$ cd /common_home/data
[ani@localhost data]$ ls -al
total 8
drwxrwxr-x. 2 ani  ani  4096 Dec 26 16:24 .
drwxrwxrwx. 6 root root 4096 Dec 26 16:23 ..
-rw-rw-r--. 1 ani  ani     0 Dec 26 16:24 test1
[ani@localhost data]$ pwd
/common_home/data

We can close this discussion thread as resolved.
@all, Thanks a lot! I made loads of mistakes but learned a lot more.

Congratul;ations.

I assume that you made a symlink to much inside data, but you seem to have recovered from that.

Enjoy.