You are not logged in.

#1 2016-09-18 15:32:27

i716
Member
From: Yokohama, Japan
Registered: 2016-04-18
Posts: 70

Migrating system to new HDD (WIN, LUKS, LVM, etc.)

Hello everybody,

I need some advice on the above mentioned project. Currently my partitions looks like this:

NAME                MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda                   8:0    0 931,5G  0 disk  
├─sda1                8:1    0   100M  0 part  /boot
├─sda2                8:2    0   128M  0 part  
├─sda3                8:3    0 492,3G  0 part  /run/media/user1/C878AF9778AF8334
└─sda4                8:4    0   439G  0 part  
  └─main            254:0    0   439G  0 crypt 
    ├─main-swap     254:1    0     8G  0 lvm   [SWAP]
    └─main-root     254:2    0   431G  0 lvm   /

sda1 is the EFI partition, sda2 is the MSR (Microsoft Reserved Partition), sda3 is the one in which Windows7 resides and sda4 is partition that holds the LVM (Arch Linux)
I set this up about half a year ago and it is working as it should, despite parted telling me something about sda4 not being allocated correctly everytime it reads the drives.

I am now planning to swap the internal 1TB HDD for a 3TB disk and would like to make some changes to the partition:

1) sda1 (EFI) should be increased in size (is 512MB reasonable?)
2) sda2 stays at 128MB
3) sda3 The Windows partition will shrink to 200GB or less - I only use this for some very specialized CAD Software and for a Tepra device (a label printer) once in a while.
4) sda4 will take up the remaining space of the new hard drive

I would approach it this way:

1) Shrink the Windows partition to a smaller size.
2) Boot from a live media and

 dd if=/dev/sda1 of=/mnt/externalhdd/efi.img && dd if=/dev/sda2 of=/mnt/externalhdd/msr.img && dd if=/dev/sda3 of=/mnt/externalhdd/win.img && dd if=/dev/sda4 of=/mnt/externalhdd/arch.img 

3) Then I would create the partitions on the new disk as outlined above. After this I would copy the images back to each corresponding partition and finally, I would increase the size of the LVM group (In this order: pv - vg - lv)

Would this be a viable solution? Any input is appreciated. Thanks

Offline

#2 2016-09-29 20:42:41

pillowHugger95
Member
Registered: 2016-09-29
Posts: 10

Re: Migrating system to new HDD (WIN, LUKS, LVM, etc.)

That will probably work.
Seems a bit complicated though...

For a start I would not perform any resizing and such on the old drive so you have a nice backup incase something goes wrong.

Then just use dd to copy the whole of one drive to the other something like:

dd if=/dev/sda of=/dev/sdb

https://wiki.archlinux.org/index.php/Disk_cloning

where sda is the old drive and sdb is the new drive.

Now you can start messing with partition sizes on your new drive.
You will also need to resize the file systems.

Offline

#3 2016-09-29 23:09:51

loqs
Member
Registered: 2014-03-06
Posts: 17,372

Re: Migrating system to new HDD (WIN, LUKS, LVM, etc.)

Why not just create the new partitioning scheme you want on the new disk.
From live media mount all the old partitions and new partitions then copy across.  This saves adjusting partition / filesystem sizes after cloning as well as avoiding the copying of unused disk space.
Edit:
Forgot the issue of ntfs filesystems being none posix would avoid copying those from the linux side would suggest your original idea of dd'ing them or ntfsclone or copy the files across from Windows.

Last edited by loqs (2016-09-29 23:23:15)

Offline

Board footer

Powered by FluxBB