rootdev vs. rootdev -s

Rootdev isn’t super complicated, it does two things:

1) Look at the device ‘/’ resides on.

2) If ‘-s’ is supplied, iterate through the underlying devices till

you reach a storage device that’s not loop/dm.

For the cases you mentioned:
1) USB boot: if the image has rootfs verification disabled, then the
root filesystem is directly mounted from the USB disk without a
dm-verity layer. Therefore, `rootdev` and `rootdev -s` will both give
you /dev/sda3 (Another way to validate this is to look at the output
of `mount` to see what is mounted at ‘/’)
2) Internal Storage Boot: From the looks of it, rootfs verification
isn’t disabled on the NVMe device you are booting from (try out
‘/usr/share/vboot/bin/make_dev_ssd.sh –remove_rootfs_verification to
see something similar to above). In this case, rootdev reports that
dm-0 is mounted at ‘/’ and `rootdev -s` iterates to the underlying
partition and reports that (/dev/sda3).

Best
Sarthak

Ref: source.chromium.org/chromiumos/chromiumos/codesearch/+/main:src/third_party/rootdev/rootdev.c
for the gory details.

On Wed, Jun 7, 2023 at 2:20 PM ‘Luigi Semenzato’ via ChromiumOS

Read more here: Source link