Tuesday, 21 May 2019

linux - Why does Ubuntu mount the wrong partition as root?


I am messing around with a problem of Ubuntu mounting a backup of my root partition residing on a different disk as / instead of the real one. I think the problem has been triggered by a clash of UUIDs caused by cloning the root partition to a backup by dd (see How do I permanently reset the UUID of an LVM partition?). I seem to have solved the UUID issue now, but Ubuntu keeps booting with the wrong partition as /.


The relevant lines in df output (the OS is configured for Danish):


Filsystem                      1K-blocks     Brugt   Tilbage Brug% Monteret på
/dev/mapper/raidgroup-osbackup 51369596 31800880 16936168 66% /

The problem is that /dev/sda1 should be mounted at /. Now, blkid says (only relevant lines shown):


/dev/sda1: UUID="32579810-0388-416d-bb49-7031ac2c2975" TYPE="ext4" 
/dev/mapper/raidgroup-osbackup: UUID="7f36c980-8936-451c-b307-11d2678bb455" TYPE="ext4"

And fstab says (only relevant lines):


# / was on /dev/sda1 during installation
UUID=32579810-0388-416d-bb49-7031ac2c2975 / ext4 errors=remount-ro 0 1

So as far as I can see, the current /dev/sda1 really should be mounted at / but it is not, as mtab also confirms:


/dev/mapper/raidgroup-osbackup / ext4 rw,errors=remount-ro 0 0

This is too advanced for me... What is it that causes the wrong partition to be mounted when fstab seems to be configured right?



Answer



If the wrong filesystem is being mounted at boot, then you need to edit the grub configuration. You could try the following first:


update-grub

Depending on what version of grub you have the generated config will be in /boot/grub/menu.lst or /boot/grub/grub.cfg; I'm assuming you have the latter (the newer variation for grub2). Check the config for lines like --set=root uuid..., see if those are correct. If not, edit the file (ignoring the comment not to edit it) and reboot. After that, the right root filesystem should be correct and do the update-grub again, now the config should be correct.


No comments:

Post a Comment

How can I VLOOKUP in multiple Excel documents?

I am trying to VLOOKUP reference data with around 400 seperate Excel files. Is it possible to do this in a quick way rather than doing it m...