return $err if ($err);
# Resize the filesystem .. which must be mounted!
+ local @stat = &device_status($_[0]->{'device'});
local ($m, $mount);
- foreach $m (&mount::list_mounts()) {
- if ($m->[1] eq $_[0]->{'device'}) {
- $mount = $m;
+ if (!$stat[2]) {
+ foreach $m (&mount::list_mounts()) {
+ if ($m->[1] eq $_[0]->{'device'}) {
+ $mount = $m;
+ }
}
+ $mount || return "Mount not found";
+ &mount::mount_dir(@$mount);
}
- $mount || return "Mount not found";
- &mount::mount_dir(@$mount);
local $cmd = "xfs_growfs ".quotemeta($mount->[0]);
local $out = &backquote_logged("$cmd 2>&1");
local $q = $?;
- &mount::unmount_dir(@$mount);
+ if (!$stat[2]) {
+ &mount::unmount_dir(@$mount);
+ }
return $q ? $out : undef;
}
elsif ($_[1] eq "reiserfs") {