summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Terjan <pterjan@mandriva.org>2010-04-12 12:58:37 +0000
committerPascal Terjan <pterjan@mandriva.org>2010-04-12 12:58:37 +0000
commit94db17d4158751170ca336e6337b3a4dc39e9671 (patch)
treea132bea2c0a7047b98b9a01aba2c2a6ddb083215
parentb0f1bfa7e23ce289faacd38356b62600d34d2e5a (diff)
downloaddrakx-94db17d4158751170ca336e6337b3a4dc39e9671.tar
drakx-94db17d4158751170ca336e6337b3a4dc39e9671.tar.gz
drakx-94db17d4158751170ca336e6337b3a4dc39e9671.tar.bz2
drakx-94db17d4158751170ca336e6337b3a4dc39e9671.tar.xz
drakx-94db17d4158751170ca336e6337b3a4dc39e9671.zip
- Allow resizing btrfs
-rw-r--r--perl-install/NEWS1
-rw-r--r--perl-install/diskdrake/interactive.pm22
-rw-r--r--perl-install/fs/mount.pm2
3 files changed, 24 insertions, 1 deletions
diff --git a/perl-install/NEWS b/perl-install/NEWS
index 6ae50a0c1..f15be4f00 100644
--- a/perl-install/NEWS
+++ b/perl-install/NEWS
@@ -5,6 +5,7 @@
- detect "Rack Mount" Chassis as server
- diskdrake:
o use device label even if it was not changed (#47456)
+ o allow resizing btrfs
Version 13.15 - 17 March 2010
diff --git a/perl-install/diskdrake/interactive.pm b/perl-install/diskdrake/interactive.pm
index 3f242f3ba..5a6fec2fc 100644
--- a/perl-install/diskdrake/interactive.pm
+++ b/perl-install/diskdrake/interactive.pm
@@ -748,6 +748,12 @@ sub Resize {
} elsif ($part->{fs_type} eq 'xfs' && isLVM($hd) && $::isStandalone && $part->{isMounted}) {
$min = $part->{size}; #- ensure the user can only increase
$nice_resize{xfs} = 1;
+ } elsif ($part->{fs_type} eq 'btrfs') {
+ write_partitions($in, $hd) or return;
+ if (defined(my $free = fs::df($part))) {
+ $nice_resize{btrfs} = 1;
+ $min = max($min, $part->{size} - $free);
+ }
}
#- make sure that even after normalizing the size to cylinder boundaries, the minimun will be saved,
#- this save at least a cylinder (less than 8Mb).
@@ -818,6 +824,21 @@ filesystem checks will be run on your next boot into Microsoft Windows®"));
} elsif ($nice_resize{xfs}) {
#- happens only with mounted LVM, see above
run_program::run_or_die("xfs_growfs", $part->{mntpoint});
+ } elsif ($nice_resize{btrfs}) {
+ my $dir = "/tmp/tmp_resize_btrfs.$$";
+ if ($part->{isMounted}) {
+ $dir = ($::prefix || '') . $part->{mntpoint};
+ } else {
+ mkdir_p($dir);
+ fs::mount::mount(devices::make($part->{device}), $dir, $part->{fs_type});
+ }
+ if (!run_program::run("btrfsctl", "-r", $part->{size}*512, $dir)) {
+ $nice_resize{btrfs} = undef;
+ if (!$part->{isMounted}) {
+ fs::mount::umount($dir);
+ unlink($dir);
+ }
+ }
}
if (%nice_resize) {
@@ -830,6 +851,7 @@ filesystem checks will be run on your next boot into Microsoft Windows®"));
$adjust->(0) if $size < $oldsize;
}
+
sub Format {
my ($in, $hd, $part, $all_hds) = @_;
format_($in, $hd, $part, $all_hds);
diff --git a/perl-install/fs/mount.pm b/perl-install/fs/mount.pm
index 59e3e8bbb..2a7701e53 100644
--- a/perl-install/fs/mount.pm
+++ b/perl-install/fs/mount.pm
@@ -35,7 +35,7 @@ sub mount {
$fs or log::l("not mounting $dev partition"), return;
{
- my @fs_modules = qw(ext3 ext4 hfs jfs nfs ntfs romfs reiserfs ufs xfs vfat);
+ my @fs_modules = qw(btrfs ext3 ext4 hfs jfs nfs ntfs romfs reiserfs ufs xfs vfat);
my @types = (qw(ext2 proc sysfs usbfs usbdevfs iso9660 devfs devpts auto ntfs-3g), @fs_modules);
push @types, 'smb', 'cifs', 'davfs2' if !$::isInstall;