embiggen-disk icon indicating copy to clipboard operation
embiggen-disk copied to clipboard

fs: further try to find the device associated with the mountpoint

Open ymorin-orange opened this issue 1 year ago • 2 comments

The heuristic to find the path to the device node where the filesystem is mounted, sometime fails to find the device node, especially for cases where /dev/root is mounted on /. We have code to handle that case, but it may still fail (for reasons that we could not fathom... sigh...)

Add a last-ditch tentative by calling to an external tool, findmnt, which very purpose is exactly to provide information about mountpoints.

In our case, we just need the path to the device node (-o SOURCE), and we do not need the header line (-n). We also assume that, if findmnt did find something of interest to us, it will return something that is at least 2 bytes long (counting the trailing \n).

ymorin-orange avatar Jul 11 '22 08:07 ymorin-orange

On a buildroot build this patch solved the error error preparing to enlarge /: failed to map /dev/root to real device: /dev/root not found in /dev.

Thanks! Should be upstreamed.

ruilvo avatar Jul 13 '22 08:07 ruilvo

I have a series of changes to embiggen-disk to solve the same problem:

https://github.com/skiffos/embiggen-disk/commits/v20220519

  • Use findmnt to locate the mountpoint information.
  • If findmnt fails, fallback to the older approach.
  • Add no-resize-partition and ignore-resize-partition flags.

Submitted as #16

paralin avatar Jul 25 '22 00:07 paralin