Implement LVM2 PV remove() method (#670171)
Implement remove() method so that the LVM2 metadata is updated to reflect the removal of the LVM2 Physical Volume as well as removing the signature from the PV before the partition is deleted or overwritten. lvm pvremove /dev/DEVICE Also specifically force the removal of the PV when it is a member of a Volume Group so that it will succeed. RATIONAL: If the PV was not removed before the partition was deleted or overwritten, LVM2 would be left in a broken state with metadata describing missing PVs for any partially deleted VGs. This leaves the user needing to perform recovery of a lost PV, which required in depth understanding of LVM2 and is beyond the scope of what GParted can currently provide. The alternative is to use the pvremove command to instruct LVM2 to remove the PV and update LVM2 metadata to reflect the removal of the PV. For PVs which are a member of a VG this includes forcing the removal. This has the impact of making recovery from accidental deletion of a partition containing a PV irrecoverable. GParted is not able to recover this situation anyway because Device -> Attempt Data Rescue, using the gpart command, is not able to detect the signature of an LVM2 PV. Choose to remove the PV, forcibly if required, rather than potentially leave LVM2 with missing PVs. Bug #670171 - Add LVM PV read-write support
This commit is contained in:
parent
795a92f5b2
commit
1a62354995
|
@ -53,6 +53,7 @@ FS lvm2_pv::get_filesystem_support()
|
|||
fs .shrink = FS::EXTERNAL ;
|
||||
fs .move = FS::GPARTED ;
|
||||
fs .check = FS::EXTERNAL ;
|
||||
fs .remove = FS::EXTERNAL ;
|
||||
}
|
||||
|
||||
return fs ;
|
||||
|
@ -147,7 +148,15 @@ bool lvm2_pv::check_repair( const Partition & partition, OperationDetail & opera
|
|||
|
||||
bool lvm2_pv::remove( const Partition & partition, OperationDetail & operationdetail )
|
||||
{
|
||||
return true ;
|
||||
LVM2_PV_Info lvm2_pv_info ;
|
||||
Glib::ustring vgname = lvm2_pv_info .get_vg_name( partition .get_path() ) ;
|
||||
Glib::ustring cmd ;
|
||||
if ( vgname .empty() )
|
||||
cmd = "lvm pvremove " + partition .get_path() ;
|
||||
else
|
||||
//Must force the removal of a PV which is a member of a VG
|
||||
cmd = "echo y | lvm pvremove --force --force " + partition .get_path() ;
|
||||
return ! execute_command( cmd, operationdetail ) ;
|
||||
}
|
||||
|
||||
} //GParted
|
||||
|
|
Loading…
Reference in New Issue