---- Changes since 1.510 ----
Mounted ext3+, reiser, xfs and jfs logical volumes can now have their filesystem size increased, without needing an un-mount. Thanks to Caspar Smit for the suggestions and patches to implement this.
When editing a logical volume that is already in /etc/fstab, don't allow the filesystem to format it as to be changed, to prevent a mismatch.
+When editing a physical volume, its size can be increased to match the underlying device, such as a partition that has been grown.
print &ui_table_end();
if ($in{'pv'}) {
print &ui_form_end([ [ undef, $text{'save'} ],
+ [ 'resize', $text{'pv_resize'} ],
@pvs > 1 ? ( [ 'delete', $text{'pv_delete2'} ] )
: ( ) ]);
}
pv_warn=Warning! All data on the selected device will be erased.
pv_create2=Add to volume group
pv_delete2=Remove from volume group
+pv_resize=Resize To Match Device
pv_err=Failed to save physical volume
pv_err2=Failed to remove physical volume
+pv_err3=Failed to resize physical volume
pv_delete=Remove Physical Volume
pv_rusure=Are you sure you want to remove physical volume device $1 from its volume group? This will result in any data being shifted to other physical volumes within the group.
pv_deleteok=Remove Volume
log_create_pv=Added physical volume $1 to VG $1
log_modify_pv=Modified physical volume $1 in VG $2
log_delete_pv=Removed physical volume $1 from VG $2
+log_resize_pv=Resized physical volume $1 in VG $2
blocks=blocks
}
# create_physical_volume(&pv, [force])
+# Add a new physical volume to a volume group
sub create_physical_volume
{
local $cmd = "pvcreate -y ".($_[1] ? "-ff " : "-f ");
}
# change_physical_volume(&pv)
+# Change the allocation flag for a physical volume
sub change_physical_volume
{
local $cmd = "pvchange -x ".quotemeta($_[0]->{'alloc'}).
}
# delete_physical_volume(&pv)
+# Remove a physical volume from a volume group
sub delete_physical_volume
{
if ($_[0]->{'pe_alloc'}) {
return $? ? $out : undef;
}
+# resize_physical_volume(&pv)
+# Set the size of a physical volume to match the underlying device
+sub resize_physical_volume
+{
+local $cmd = "pvresize ".quotemeta($_[0]->{'device'});
+local $out = &backquote_logged("$cmd 2>&1");
+return $? ? $out : undef;
+}
# list_volume_groups()
# Returns a list of all volume groups
if ($in{'pv'});
if ($in{'confirm'}) {
- # Delete the logical volume
+ # Delete the physical volume
&error_setup($text{'pv_err2'});
$err = &delete_physical_volume($pv);
&error("<pre>$err</pre>") if ($err);
print "</center>\n";
&ui_print_footer("index.cgi?mode=pvs", $text{'index_return'});
}
+elsif ($in{'resize'}) {
+ # Scale up to match device
+ &error_setup($text{'pv_err3'});
+ $err = &resize_physical_volume($pv);
+ &error("<pre>$err</pre>") if ($err);
+ &webmin_log("resize", "pv", $in{'pv'}, $pv);
+ &redirect("index.cgi?mode=pvs");
+ }
else {
&error_setup($text{'pv_err'});
if (!$in{'pv'}) {