[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: replacing boot and only disk drive



Hendrik Boom a écrit :
> On Sun, 23 Nov 2014 00:45:38 +0100, Pascal Hambourg wrote:
> 
>> Gary Dale a écrit :
>>> Have you considered getting a USB case for your new drive and doing dd
>>> from your current drive to the new one? Afterward you can install the
>>> new drive then boot from gparted/rescue disk and resize your
>>> partitions.
>>
>> If the original disk already uses LVM, no need to resize partitions.
>> Just create another PV in the extra space.
> 
> dd-ing the whole drive would lead to the extra space being after all four 
> partitions.  Unfortunately, it's the second partition that contains the 
> LVM stuff.

So what ? LVM does not care about the locations of the PVs.

>  I'd end up having to move partitions 3 and 4 to the end of 
> the disk to get the space int partition 2 where it's needed.

Huh ? Why the hell would you need to move partitions ?
There are two situations :

a) You need the extra space only to extend LVs. Then you create a new
partition in the extra space, define it as a PV (pvcreate), use it to
extend the existing VG (vgextend) and extend your LVs as needed
(lvextend or lvresize). All this can be done online while the system is
running. If the LVs contain ext2/3/4 filesystems, the filesystems can be
extended online to the new LV size with resize2fs.

b) You need to extend non-LVM partitions. Only then you have to resize
and possibly move partitions.

> I have no 
> idea whether Windows cares about whether the hidden and the EFI 
> partitions re actually partitions 3 and 4.

Anyway, you do not need to change the partition numbers. Moving a
partition does not mean changing its number.

> But dding the start of the disk, enough to copy the entire windows 
> partition and the stuff before the first one might be a good idea.
> Unless the MBR or something related to it contains information about the 
> size of the entire disk, which will now be wrong.  And it;s the space 
> before the first partition which is likely to contain the crucial boot 
> information that Windows might want.  That ans the EFI partition, of 
> course.

So your system boots from UEFI. This make things a bit different.

1) UEFI booting does not require the MBR and blocklist kludge used for
BIOS booting. The UEFI booloaders are just regular files in the EFI
system partition. So you could just create partitions on the new disk
and copy the files (you may have to update some UUIDs where needed), or
the raw partitions using dd.

2) If Windows boots from UEFI, I suppose that the original disk
partition table is in the GPT format. This format stores two copies of
the GPT header, one at the beginning (primary header) and one at the end
of the disk (secondary header). Each header has a pointer to the other,
so in a way the primary header has a reference to the end of the disk
where the secondary header is located. So, if you use dd to copy the
whole disk, the secondary header will not be at the end of the new disk.
Maybe tools such as gdisk can fix this.


Reply to: