summaryrefslogtreecommitdiffstats
path: root/tools/virt-make-fs
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2012-05-03 14:31:37 +0100
committerRichard W.M. Jones <rjones@redhat.com>2012-05-03 14:32:24 +0100
commit0cc35251421bc5c4d5a682566e2d71b942bbcc4a (patch)
tree6c5000375aa1051e1dcab5230137ab3741c820a8 /tools/virt-make-fs
parent93734c78d8f802fbd80418e6ddb333b21f060fa9 (diff)
downloadlibguestfs-0cc35251421bc5c4d5a682566e2d71b942bbcc4a.tar.gz
libguestfs-0cc35251421bc5c4d5a682566e2d71b942bbcc4a.tar.xz
libguestfs-0cc35251421bc5c4d5a682566e2d71b942bbcc4a.zip
virt-make-fs: Fix estimation when making btrfs (RHBZ#816098).
This also disables data and metadata duplication, which is not very useful on a constructed filesystem on a virtual disk.
Diffstat (limited to 'tools/virt-make-fs')
-rwxr-xr-xtools/virt-make-fs13
1 files changed, 12 insertions, 1 deletions
diff --git a/tools/virt-make-fs b/tools/virt-make-fs
index 3938e277..6efa3cd0 100755
--- a/tools/virt-make-fs
+++ b/tools/virt-make-fs
@@ -380,6 +380,13 @@ if ($type eq "ntfs") {
$estimate += 4 * 1024 * 1024; # NTFS journal.
}
+if ($type eq "btrfs") {
+ # For BTRFS, the minimum metadata allocation is 256MB, with data
+ # additional to that. Note that we disable data and metadata
+ # duplication below.
+ $estimate += 256 * 1024 * 1024;
+}
+
$estimate *= 1.10; # Add 10%, see above.
# Calculate the output size.
@@ -448,7 +455,11 @@ eval {
print STDERR "creating $type filesystem on $dev ...\n" if $debug;
# Create the filesystem.
- $g->mkfs ($type, $dev);
+ if ($type ne "btrfs") {
+ $g->mkfs ($type, $dev);
+ } else {
+ $g->mkfs_btrfs ([$dev], datatype => "single", metadata => "single");
+ }
$g->mount ($dev, "/");
# Copy the data in.