Make copy into existing whole disk device file systems work (#743181)
First, copying into a whole disk device fails on the set partition type step. Fails with either libparted error "The flag 'lvm' is not available for loop disk labels" or "unrecognised disk label" depending whether libparted recognised the content and created a virtual partition or not. (This is with libparted 2.4). Fix by just skipping setting the partition type on whole disk devices. Second, if any file system specific tools are used during the copy, they will fail because they are passed the device name as "copy of /dev/SRC" instead of "/dev/DST". Occurs when either the destination whole disk device is not an identical size to the source so the file system check and grow steps are added, or when file system specific tools are used to copy the file system as with XFS or recent EXT2/3/4 tools. Fix by re-adding the real partition path from libparted for whole disk devices, as is already done for partitioned device names in GParted_Core::calibrate_partition(). Bug 743181 - Add unpartitioned drive read-write support
This commit is contained in:
parent
fb9653fd8e
commit
85a6c88eee
|
@ -2821,7 +2821,13 @@ bool GParted_Core::copy( const Partition & partition_src,
|
||||||
succes = create_partition( partition_dst, operationdetail, ( (min_size + (partition_dst .sector_size - 1)) / partition_dst .sector_size ) ) ;
|
succes = create_partition( partition_dst, operationdetail, ( (min_size + (partition_dst .sector_size - 1)) / partition_dst .sector_size ) ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( succes && set_partition_type( partition_dst, operationdetail ) )
|
if ( succes && ! partition_dst.whole_device )
|
||||||
|
{
|
||||||
|
// Only set type of partition on a partitioned device.
|
||||||
|
succes = set_partition_type( partition_dst, operationdetail );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( succes )
|
||||||
{
|
{
|
||||||
operationdetail .add_child( OperationDetail(
|
operationdetail .add_child( OperationDetail(
|
||||||
String::ucompose( _("copy file system of %1 to %2"),
|
String::ucompose( _("copy file system of %1 to %2"),
|
||||||
|
@ -3170,6 +3176,11 @@ bool GParted_Core::calibrate_partition( Partition & partition, OperationDetail &
|
||||||
if ( partition.whole_device )
|
if ( partition.whole_device )
|
||||||
{
|
{
|
||||||
// Virtual partition spanning whole disk device
|
// Virtual partition spanning whole disk device
|
||||||
|
|
||||||
|
// Re-add the real partition path from libparted.
|
||||||
|
// (See just below for why this is needed).
|
||||||
|
partition.add_path( lp_device->path );
|
||||||
|
|
||||||
success = true;
|
success = true;
|
||||||
}
|
}
|
||||||
else if ( get_disk( lp_device, lp_disk ) )
|
else if ( get_disk( lp_device, lp_disk ) )
|
||||||
|
|
Loading…
Reference in New Issue