[rear-users] Disk partition resizing?

Les Mikesell lesmikesell at gmail.com
Tue Jan 13 17:38:57 CET 2015


On Sun, Jan 11, 2015 at 2:35 AM, Jeroen Hoekx <jeroen.hoekx at hamok.be> wrote:
> Hi Les,
>
> On 9 January 2015 at 21:59, Les Mikesell <lesmikesell at gmail.com> wrote:
>> I'm trying to use rear to convert a Centos5 system to a VM.  The
>> source has 3 primary partitions on /dev/sda:
>>
>> Disk /dev/sda: 146684248063B
>> Sector size (logical/physical): 512B/512B
>> Partition Table: msdos
>>
>> Number  Start          End            Size           Type     File system  Flags
>>  1      32256B         106928639B     106896384B     primary  ext3         boot
>>  2      106928640B     142387822079B  142280893440B  primary  ext3
>>  3      142387822080B  146681418239B  4293596160B    primary  linux-swap
>>
>> I've tried both smaller and larger target disks and the restore script
>> claims that it is resizing the partitions to fit, but parted always
>> claims that the value for the last partition is 'outside of the
>> device'.   Actually, it only mentions resizing 2 partitions:
>> Partition primary on /dev/sda: size reduced to fit on disk.
>> Partition primary on /dev/sda: size reduced to fit on disk.
>> (when in fact this target disk is actually bigger) - after failing I have:
>
> Rear will not resize 'boot' partitions.
>
>> Model: VMware Virtual disk (scsi)
>> Disk /dev/sda: 157840048127B
>> Sector size (logical/physical): 512B/512B
>> Partition Table: msdos
>>
>> Number  Start       End            Size           Type     File system  Flags
>>  1      32768B      106929151B     106896384B     primary               boot
>>  2      106930176B  157840048127B  157733117952B  primary
>>
>> And the failing command is:
>> parted -s /dev/sda mkpart '"primary"' 157840084992B 157840048127B >&2
>
> This is very strange. It tries to create a partition with the start
> after the end. The previous partition was already ending at the disk
> end...
>
>> What computes the adjusted sizes in the diskrestore.sh and are there
>> known problems in the version packaged as rear-1.16.1-1.el5 in EPEL?
>
> All the code is in
> usr/share/rear/layout/prepare/GNU/Linux/10_include_partition_code.sh
>
> Do you have a ticket with a more complete log for this?
>

No, when it failed with a smaller target drive I resized the VM to be
slightly larger than the source and when that also failed I got the
values from the source partitions for the end of the 2nd partition and
the start of the 3rd and pasted them into the diskrestore.sh instead
of the incorrectly computed numbers.

Is there a way to run
 /usr/share/rear/layout/prepare/GNU/Linux/10_include_partition_code.sh
out of context with 'sh -x' to see what it is doing?   It seems to
need functions defined elsewhere.

-- 
    Les Mikesell
     lesmikesell at gmail.com


More information about the rear-users mailing list