Summary: | growfs : operation not permitted | ||
---|---|---|---|
Product: | Base System | Reporter: | Gonéri Le Bouder <goneri> |
Component: | bin | Assignee: | freebsd-bugs (Nobody) <bugs> |
Status: | New --- | ||
Severity: | Affects Only Me | CC: | kiboto6933, tofig |
Priority: | --- | ||
Version: | 12.0-STABLE | ||
Hardware: | amd64 | ||
OS: | Any |
Description
Gonéri Le Bouder
2019-04-19 17:27:31 UTC
It's ok if I use the gtp/rootfs naming: # growfs /dev/gpt/rootfs Device is mounted read-write; resizing will result in temporary write suspension for /. It's strongly recommended to make a backup before growing the file system. OK to grow filesystem on /dev/gpt/rootfs, mounted on /, from 5.0GB to 31GB? [yes/no] yes super-block backups (for fsck_ffs -b #) at: 10758208, 12551232, 14344256, 16137280, 17930304, 19723328, 21516352, 23309376, 25102400, 26895424, 28688448, 30481472, 32274496, 34067520, 35860544, 37653568, 39446592, 41239616, 43032640, 44825664, 46618688, 48411712, 50204736, 51997760, 53790784, 55583808, 57376832, 59169856, 60962880, 62755904, 64548928 This issue is still present on RELEASE-13.1 with the following uname -a output: FreeBSD parent 13.1-RELEASE FreeBSD 13.1-RELEASE releng/13.1-n250148-fc952ac2212 GENERIC arm64 I've done some bug triaging and hopefully it helps to fix it. Growfs calls dev_to_statfs() to find out the mountpoint on which the device is currently mounted. This is the listing for dev_to_statfs: https://github.com/freebsd/freebsd-src/blob/main/sbin/growfs/growfs.c#L1437 Inside dev_to_statfs(), getmntinfo() returns the list of all active mounts along with the information for each of them. /dev/vtbd0p4 is likely not in the list of mounted devices; instead /dev/gpt/rootfs is. Therefore dev_to_statfs() is not able to find the mountpoint under which /dev/vtbd0p4 is mounted, and hence returns NULL. Later on, there is a check for the return value from dev_to_statfs(): https://github.com/freebsd/freebsd-src/blob/main/sbin/growfs/growfs.c#L1576 This check is to differentiate for 2 separate cases: 1) device is mounted and 2) device is not mounted. In your case, though the device is mounted (but under a different name) the second case is taken and we attempt to open the device directly: fso = open(device, O_WRONLY); This operation fails with the error that you were seeing in your test. If getmntinfo() was able to detect that your device /dev/vtbd0p4 was mounted under a different name (likely / ?), then the ufs-suspend mechanism would be used and that would possibly work just fine. I am not quite sure how dev_to_statfs() is supposed to derive the information about /dev/vtbd0p4 being mounted using a different device name like /dev/gpt/rootfs. |