Maxim Perevedentsev
2016-Jan-18 15:09 UTC
[Libguestfs] [PATCH] Add -f option to resize2fs -P in vfs_minimum_size.
Sometimes the user wants to know minimum size for dirty (e.g. mounted) filesystems. In this case, resize2fs -P will require calling e2fsck -f, while "in general, it is not safe to run e2fsck on mounted filesystems". Since resize2fs -P does not modify filesystem, we force it to display (probably approximate) minimum size. --- daemon/ext2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daemon/ext2.c b/daemon/ext2.c index 898d066..9ba4f09 100644 --- a/daemon/ext2.c +++ b/daemon/ext2.c @@ -317,7 +317,7 @@ ext_minimum_size (const char *device) long block_size; const char *pattern = "Estimated minimum size of the filesystem: "; - r = command (&out, &err, str_resize2fs, "-P", device, NULL); + r = command (&out, &err, str_resize2fs, "-P", "-f", device, NULL); if (r == -1) { reply_with_error ("%s", err); return -1; -- 1.8.3.1
Richard W.M. Jones
2016-Jan-18 16:40 UTC
Re: [Libguestfs] [PATCH] Add -f option to resize2fs -P in vfs_minimum_size.
On Mon, Jan 18, 2016 at 06:09:05PM +0300, Maxim Perevedentsev wrote:> Sometimes the user wants to know minimum size > for dirty (e.g. mounted) filesystems. In this case, > resize2fs -P will require calling e2fsck -f, while > "in general, it is not safe to run e2fsck on mounted filesystems". > > Since resize2fs -P does not modify filesystem, we force it > to display (probably approximate) minimum size. > --- > daemon/ext2.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/daemon/ext2.c b/daemon/ext2.c > index 898d066..9ba4f09 100644 > --- a/daemon/ext2.c > +++ b/daemon/ext2.c > @@ -317,7 +317,7 @@ ext_minimum_size (const char *device) > long block_size; > const char *pattern = "Estimated minimum size of the filesystem: "; > > - r = command (&out, &err, str_resize2fs, "-P", device, NULL); > + r = command (&out, &err, str_resize2fs, "-P", "-f", device, NULL); > if (r == -1) { > reply_with_error ("%s", err); > return -1; > -- > 1.8.3.1ACK. I'll push this one shortly, thanks. Rich. -- Richard Jones, Virtualization Group, Red Hat people.redhat.com/~rjones Read my programming and virtualization blog: rwmj.wordpress.com virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. people.redhat.com/~rjones/virt-top
Possibly Parallel Threads
- [PATCHv4 0/2] Introduce vfs_minimum_size API to get minimum filesystem size.
- [PATCHv3 2/2] Include resize2fs_P into vfs_min_size.
- [PATCHv3 0/2] Introduce vfs_min_size API to get minimum filesystem size.
- [PATCHv2] Added xfs support to vfs_minimum_size.
- [PATCH] New API: resize2fs_P