2

Google is mounting two different disks on / in Ubuntu 18.04 LTS Minimal image. This uglifies VM monitoring since the disk labels are inconsistent from machine to machine depending on what type of Ubuntu image is used.

Normal Ubuntu 18.04 LTS image does NOT have this problem. /dev/sda1 shows up correctly as the ONLY disk mounted on /

BUT, on minimal image Ubuntu 18.04 LTS, Google is doing something wrong with the disks. It is mounting two different disks on the same mount path. /dev/root and /dev/sda1 are both mounted on /

df shows /dev/root mounted on /

Filesystem     1K-blocks   Used Available Use% Mounted on  
/dev/root        9983232 829708   9137140   9% /  
devtmpfs         1888736      0   1888736   0% /dev  
tmpfs            1890960      0   1890960   0% /dev/shm  
tmpfs            1890960    856   1890104   1% /run  
tmpfs               5120      0      5120   0% /run/lock  
tmpfs            1890960      0   1890960   0% /sys/fs/cgroup  
/dev/sda15        106858   3682    103177   4% /boot/efi  
/dev/loop0         90880  90880         0 100% /snap/core/7396  
/dev/loop1         67200  67200         0 100% /snap/google-cloud-sdk/99  
tmpfs             378192      0    378192   0% /run/user/1001  

lsblk shows sda1 is ALSO mounted on /

NAME    MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT  
loop0     7:0    0 88.7M  1 loop /snap/core/7396  
loop1     7:1    0 65.6M  1 loop /snap/google-cloud-sdk/99  
sda       8:0    0   10G  0 disk   
├─sda1    8:1    0  9.9G  0 part  /  
├─sda14   8:14   0    4M  0 part   
└─sda15   8:15   0  106M  0 part /boot/efi    

more info: df /dev/sda1 gives the wrong result:

Filesystem     1K-blocks  Used Available Use% Mounted on  
devtmpfs         1888736     0   1888736   0% /dev  

I'd like to use /dev/sda1 as the disk because that's what all other Ubuntu images do on GCP. The minimal Ubuntu images are REALLY fast to boot up so it would s** to have to go back to full Ubuntu image.

user450409
  • 125
  • 4
  • 16

2 Answers2

1

/dev/root is not a device. It is a symbolic link to the device mounted as root.

Your system does not have a problem with mounting two disks as /.

readlink -f /dev/root will display the real device mounted as /, which will usually be /dev/sda1.

John Hanley
  • 4,754
  • 1
  • 11
  • 21
  • Not the answer. That would be true with very old kernels. /dev/root is not a symbolic link on this modern kernel. readlink -f /dev/root result is /dev/root. – user450409 Sep 21 '19 at 12:34
  • dev/sda is only the block device and /dev/sda1 is a partition mounted on /, but /dev/root is definitely not a sym link. For consistent monitoring /dev/root is an anti pattern and Google needs to fix it. It's only a problem on the minimal 18.04 LTS image. Other Ubuntu images on GCP do not have this problem. – user450409 Sep 21 '19 at 12:42
  • Other Ubuntu images have /dev/sda1 as the root filesystem for the single disk at /dev/sda. This is what I need for consistent monitoring of the minimal Ubuntu image. Google please fix it. – user450409 Sep 21 '19 at 12:49
0

BUT, on minimal image Ubuntu 18.04 LTS, Google is doing something wrong with the disks. It is mounting two different disks on the same mount path. /dev/root and /dev/sda1 are both mounted on /

It is perfectly valid to mount the real file system on top of rootfs. Although, I'm not clear on what specific initramfs implementations use /dev/root and which do not.

This image does not mount by partitions, it mounts by label. Which is a good idea anyway as it is independent of any block device scheme.

root@sf985060:~# cat /etc/fstab
LABEL=cloudimg-rootfs   /        ext4   defaults        0 0
LABEL=UEFI      /boot/efi       vfat    defaults        0 0

Unfortunately, /dev/sda1 and symlinks to it fool df. However, the actual mount point / and /dev/root are correct. Presumably, you would want to monitor the mount point / anyway, as that is a constant.

root@sf985060:~# df / /dev/root /dev/disk/by-label/cloudimg-rootfs /dev/sda1
Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/root        9983232 1026876   8939972  11% /
/dev/root        9983232 1026876   8939972  11% /
devtmpfs          295604       0    295604   0% /dev
devtmpfs          295604       0    295604   0% /dev
John Mahowald
  • 32,050
  • 2
  • 19
  • 34
  • Yes, true. It looks like it is mounting by label, and yes, df is bering fooled. I will try to relabel via grub and fstab. If I get it to work so df reports /dev/sda1, I'll leave the instructions here. Also good point about / being consistent. But I'll need to deal with the inconsistency within Prometheus because /dev/root and /dev/sda1 show up depending on image type. I like solutions that don't create work. I may even go back to the non-minimal image, unfortunately. – user450409 Sep 22 '19 at 21:58
  • After more research I think this problem is related to: https://bugzilla.redhat.com/show_bug.cgi?id=1052369 even though this is RedHat and I'm using Ubuntu. /proc/mounts is showing /dev/root – user450409 Sep 22 '19 at 23:34
  • See how this command presents correct output: findmnt --df SOURCE FSTYPE SIZE USED AVAIL USE% TARGET /dev/sda1 ext4 14.4G 2.5G 11.9G 17% / devtmpfs devtmpfs 1.8G 0 1.8G 0% /dev tmpfs tmpfs 1.8G 0 1.8G 0% /dev/shm tmpfs tmpfs 1.8G 856K 1.8G 0% /run – user450409 Sep 23 '19 at 17:00