Move LVM on LUKS Manjaro install from HDD to SSD

Hello! Hope everyone is doing well.

I recently bought a new 480GB SSD and a 4TB HDD (both should arrive tomorrow) and I'm looking for ways to move my LVM on LUKS install to them. Currently I have a 500GB HDD running in the following scheme:

~ >>> lsblk                                                                                                                                            
NAME                MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda                   8:0    0 465,8G  0 disk  
├─sda1                8:1    0     1G  0 part  /boot/efi
└─sda2                8:2    0 464,8G  0 part  
  └─cryptroot       254:0    0 464,8G  0 crypt 
    ├─vg-lvol--root 254:1    0    68G  0 lvm   /
    └─vg-lvol--home 254:2    0 396,8G  0 lvm   /home
sdb                   8:16   0   1,8T  0 disk  
└─sdb1                8:17   0   1,8T  0 part  
sdc                   8:32   1   3,6G  0 disk  
├─sdc1                8:33   1   1,9G  0 part  
└─sdc2                8:34   1     4M  0 part  

sdb is an external 2TB HDD and sdc is a 4GB flashdrive that I used to install Manjaro with Manjaro Architect. The system is running on sda.

I've found some good posts on the subject (this one and this one), but none with specific my case (I'm sorry if there is any and if so please feel free to delete this topic lol), and since I'm still new to Linux (I'll probably feel this way forever) I'm creating this one. Would the linked posts suffice to do it?

I'm looking to put about 100GB of the SSD to the OS (thinking about dual booting with Windows but this is later subject) and the remaining to some run games. The 4TB+500GB HDDs would be some kind of data hoarding units mounted at /home probably. Can I merge the 5TB+500GB somehow with LVM? If it can't be done I'll just mount them at different directories. Since currently I have two partitions in the same HDD (sda1 and sda2) should I just created two partitions in the SDD (one for /boot/efi and the other to the OS and games using LVM) and one in the HDD (to be mounted as /home using LVM) and use rsync or cp -ato clone the contents and adjust the fstab parameters? Am I still missing anything in these steps for my case? Did I say something very stupid?

This is the output of my inxi --full --verbosity=7 --filter --no-host

System:    Kernel: 5.6.11-1-MANJARO x86_64 bits: 64 compiler: gcc v: 9.3.0 Desktop: Xfce 4.14.2 tk: Gtk 3.24.20 
           info: xfce4-panel wm: xfwm4 dm: LightDM 1.30.0 Distro: Manjaro Linux 
Machine:   Type: Desktop Mobo: Gigabyte model: 970A-UD3P v: x.x serial: N/A UEFI: American Megatrends v: FC date: 02/26/2016 
Memory:    RAM: total: 11.69 GiB used: 5.11 GiB (43.7%) 
           Array-1: capacity: 32 GiB note: check slots: 4 EC: None max module size: 4 GiB note: est. 
           Device-1: Node0_Dimm0 size: No Module Installed 
           Device-2: Node0_Dimm1 size: 4 GiB info: single-bank speed: 933 MT/s type: DDR3 
           detail: synchronous unbuffered (unregistered) bus width: 64 bits total: 64 bits manufacturer: Kingston 
           part-no: KHX1866C10D3/ serial: <filter> 
           Device-3: Node0_Dimm2 size: 4 GiB info: single-bank speed: 667 MT/s type: DDR3 
           detail: synchronous unbuffered (unregistered) bus width: 64 bits total: 64 bits manufacturer: N/A part-no: N/A 
           serial: N/A 
           Device-4: Node0_Dimm3 size: 4 GiB info: single-bank speed: 667 MT/s type: DDR3 
           detail: synchronous unbuffered (unregistered) bus width: 64 bits total: 64 bits manufacturer: Kingston 
           part-no: 9905403-447.A serial: <filter> 
CPU:       Topology: 6-Core model: AMD FX-6300 bits: 64 type: MCP arch: Bulldozer L1 cache: 288 KiB L2 cache: 2048 KiB 
           L3 cache: 8192 KiB bogomips: 42212 
           Speed: 3705 MHz min/max: 1400/3500 MHz boost: enabled Core speeds (MHz): 1: 2442 2: 2165 3: 2325 4: 2240 5: 3816 
           6: 3817 
           Flags: 3dnowprefetch abm aes aperfmperf apic arat avx bmi1 clflush cmov cmp_legacy constant_tsc cpb cpuid 
           cr8_legacy cx16 cx8 de decodeassists extapic extd_apicid f16c flushbyasid fma fma4 fpu fxsr fxsr_opt ht hw_pstate 
           ibpb ibs lahf_lm lbrv lm mca mce misalignsse mmx mmxext monitor msr mtrr nodeid_msr nonstop_tsc nopl npt nrip_save 
           nx osvw pae pat pausefilter pclmulqdq pdpe1gb perfctr_core perfctr_nb pfthreshold pge pni popcnt pse pse36 rdtscp 
           rep_good sep skinit ssbd sse sse2 sse4_1 sse4_2 sse4a ssse3 svm svm_lock syscall tbm tce topoext tsc tsc_scale 
           vmcb_clean vme vmmcall wdt xop xsave 
Graphics:  Device-1: Advanced Micro Devices [AMD/ATI] Ellesmere [Radeon RX 470/480/570/570X/580/580X/590] vendor: XFX Pine 
           driver: amdgpu v: kernel bus ID: 01:00.0 chip ID: 1002:67df 
           Display: server: X.Org 1.20.8 driver: amdgpu,ati unloaded: modesetting,radeon alternate: fbdev,vesa 
           resolution: 1920x1080~60Hz 
           OpenGL: renderer: AMD Radeon RX 470 Graphics (POLARIS10 DRM 3.36.0 5.6.11-1-MANJARO LLVM 10.0.0) v: 4.6 Mesa 20.0.6 
           direct render: Yes 
Audio:     Device-1: Advanced Micro Devices [AMD/ATI] SBx00 Azalia vendor: Gigabyte driver: snd_hda_intel v: kernel 
           bus ID: 00:14.2 chip ID: 1002:4383 
           Device-2: AMD Ellesmere HDMI Audio [Radeon RX 470/480 / 570/580/590] vendor: XFX Pine driver: snd_hda_intel 
           v: kernel bus ID: 01:00.1 chip ID: 1002:aaf0 
           Sound Server: ALSA v: k5.6.11-1-MANJARO 
Network:   Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet vendor: Gigabyte driver: r8169 v: kernel 
           port: d000 bus ID: 03:00.0 chip ID: 10ec:8168 
           IF: enp3s0 state: down mac: <filter> 
           Device-2: Realtek RTL8192CU 802.11n WLAN Adapter type: USB driver: rtl8xxxu bus ID: 5-4:4 chip ID: 0bda:8178 
           serial: <filter> 
           IF: wlp0s22f2u4 state: up mac: <filter> 
           IP v4: <filter> type: noprefixroute scope: global broadcast: <filter> 
           IP v6: <filter> type: noprefixroute scope: link 
           WAN IP: <filter> 
Drives:    Local Storage: total: 2.28 TiB used: 378.81 GiB (16.2%) 
           ID-1: /dev/sda vendor: Western Digital model: WD5000AAKX-00U6AA0 size: 465.76 GiB speed: <unknown> 
           rotation: 7200 rpm serial: <filter> rev: 1H15 temp: 34 C scheme: GPT 
           ID-2: /dev/sdb type: USB vendor: Hitachi model: Hitachi HDS72302 size: 1.82 TiB serial: <filter> rev: A800 
           scheme: MBR 
           ID-3: /dev/sdc type: USB vendor: Kingston model: DataTraveler 2.0 size: 3.61 GiB serial: <filter> rev: 1.00 
           scheme: MBR 
           Message: No Optical or Floppy data was found. 
RAID:      Message: No RAID data was found. 
Partition: ID-1: / size: 66.43 GiB used: 37.00 GiB (55.7%) fs: ext4 dev: /dev/dm-1 label: N/A 
           uuid: dc5818ed-1868-46da-aa61-648998b1c540 
           ID-2: /boot/efi size: 1022.0 MiB used: 464 KiB (0.0%) fs: vfat dev: /dev/sda1 label: N/A uuid: 1B80-52BE 
           ID-3: /home size: 389.52 GiB used: 341.81 GiB (87.8%) fs: ext4 dev: /dev/dm-2 label: N/A 
           uuid: f22764fc-deb2-4c6d-b492-ae425662b86c 
Unmounted: ID-1: /dev/dm-0 size: 464.75 GiB fs: N/A label: N/A uuid: N/A 
           ID-2: /dev/sda2 size: 464.76 GiB fs: crypto_luks label: N/A uuid: 24039a74-818b-46eb-88c9-8ec3b302b5e2 
           ID-3: /dev/sdb1 size: 1.82 TiB fs: N/A label: N/A uuid: N/A 
           ID-4: /dev/sdc1 size: 1.85 GiB fs: iso9660 label: MANJARO_XFCEM_200 uuid: 2020-04-26-07-46-59-00 
           ID-5: /dev/sdc2 size: 4.0 MiB fs: vfat label: MISO_EFI uuid: BB33-7409 
USB:       Hub: 1-0:1 info: Full speed (or root) Hub ports: 5 rev: 2.0 speed: 480 Mb/s chip ID: 1d6b:0002 
           Device-1: 1-1:2 info: Kingston Digital DataTraveler SE9 64GB type: Mass Storage driver: usb-storage interfaces: 1 
           rev: 2.0 speed: 480 Mb/s chip ID: 0951:1665 serial: <filter> 
           Hub: 2-0:1 info: Full speed (or root) Hub ports: 1 rev: 2.0 speed: 480 Mb/s chip ID: 1d6b:0002 
           Hub: 2-1:2 info: VIA Labs Hub ports: 4 rev: 2.1 speed: 480 Mb/s chip ID: 2109:3431 
           Hub: 3-0:1 info: Full speed (or root) Hub ports: 4 rev: 3.0 speed: 5 Gb/s chip ID: 1d6b:0003 
           Device-2: 3-1:2 info: SimpleTech Touro Desk Pro type: Mass Storage driver: uas interfaces: 1 rev: 3.0 speed: 5 Gb/s 
           chip ID: 4971:1013 serial: <filter> 
           Hub: 4-0:1 info: Full speed (or root) Hub ports: 5 rev: 2.0 speed: 480 Mb/s chip ID: 1d6b:0002 
           Hub: 5-0:1 info: Full speed (or root) Hub ports: 4 rev: 2.0 speed: 480 Mb/s chip ID: 1d6b:0002 
           Device-3: 5-2:2 info: Cubeternet GL-UPC822 UVC WebCam type: Video driver: uvcvideo interfaces: 2 rev: 2.0 
           speed: 480 Mb/s chip ID: 1e4e:0102 
           Device-4: 5-4:4 info: Realtek RTL8192CU 802.11n WLAN Adapter type: Network driver: rtl8xxxu interfaces: 1 rev: 2.0 
           speed: 480 Mb/s chip ID: 0bda:8178 serial: <filter> 
           Hub: 6-0:1 info: Full speed (or root) Hub ports: 5 rev: 1.1 speed: 12 Mb/s chip ID: 1d6b:0001 
           Device-5: 6-2:2 info: Holtek E-Signal LUOM G10 Mechanical Gaming Mouse type: Mouse,HID driver: hid-generic,usbhid 
           interfaces: 3 rev: 2.0 speed: 12 Mb/s chip ID: 04d9:a09f 
           Hub: 7-0:1 info: Full speed (or root) Hub ports: 5 rev: 1.1 speed: 12 Mb/s chip ID: 1d6b:0001 
           Hub: 8-0:1 info: Full speed (or root) Hub ports: 2 rev: 1.1 speed: 12 Mb/s chip ID: 1d6b:0001 
           Hub: 9-0:1 info: Full speed (or root) Hub ports: 4 rev: 1.1 speed: 12 Mb/s chip ID: 1d6b:0001 
           Device-6: 9-3:2 info: BY Tech Usb Gaming Keyboard type: Keyboard,HID driver: hid-generic,usbhid interfaces: 2 
           rev: 2.0 speed: 12 Mb/s chip ID: 258a:0016 
Sensors:   System Temperatures: cpu: 43.0 C mobo: N/A gpu: amdgpu temp: 33 C 
           Fan Speeds (RPM): N/A gpu: amdgpu fan: 1036 
Info:      Processes: 266 Uptime: 2d 23h 12m Init: systemd v: 245 Compilers: gcc: 9.3.0 Shell: bash (sudo) v: 5.0.16 
           running in: xfce4-terminal inxi: 3.0.37

I'm open to suggestions if there is any better way to do that (maybe clean install?). If I can provide any more info, please tell me.

Best regards

Danger, here be Dragons!!!

1 Like

Yeah, I guess. I'll probably end up just starting from scratch.


Here's where I am at:

I partitioned my new disks as follows:

>>>lsblk -f
NAME                FSTYPE      FSVER          LABEL             UUID                                   FSAVAIL FSUSE% MOUNTPOINT
sda                                                                                                                    
├─sda1              vfat        FAT32                            FA50-7CEC                                             
└─sda2              crypto_LUKS 1                                1ce1e15b-a2ac-4563-b7f3-e3d5ffe2e6f7                  
  └─luks-1ce1e15b-a2ac-4563-b7f3-e3d5ffe2e6f7
                    LVM2_member LVM2 001                         2OgCKG-9nTA-Fjh3-onh3-POFI-XW3S-1yYRzU                
    ├─vgssd-vgssd--lvol--root
    │               ext4        1.0                              54eae670-8b43-48fc-a502-7948f97716d4     35,5G    49% /run/media/asdfg/54eae670-8b43-48
    └─vgssd-vgssd--lvol--ssd
                    ext4        1.0                              536b4dd8-ad75-4b76-9c87-3a944a997781    341,9G     0% /run/media/asdfg/536b4dd8-ad75-4b
sdb                                                                                                                    
└─sdb1              crypto_LUKS 1                                77852b9e-b87f-4d2d-a589-1615f61fe783                  
  └─luks-77852b9e-b87f-4d2d-a589-1615f61fe783
                    LVM2_member LVM2 001                         fbQ9di-dQi9-lrFf-YuPg-iB1N-JwX8-sfqW3t                
    └─vghdd-hdd--lvol--home
                    ext4        1.0                              2b9fa447-c558-4fb5-801a-4fcd44a62a47        3T    10% /run/media/asdfg/2b9fa447-c558-4f
sdc                                                                                                                    
├─sdc1              vfat        FAT32                            1B80-52BE                              1021,5M     0% /boot/efi
└─sdc2              crypto_LUKS 1                                24039a74-818b-46eb-88c9-8ec3b302b5e2                  
  └─cryptroot       LVM2_member LVM2 001                         VykU75-XeJs-Ki1Q-7Jwh-kJGg-0UN0-gTNVv7                
    ├─vg-lvol--root ext4        1.0                              dc5818ed-1868-46da-aa61-648998b1c540     25,8G    56% /
    └─vg-lvol--home ext4        1.0                              f22764fc-deb2-4c6d-b492-ae425662b86c     17,9G    90% /home
sdd                 iso9660     Joliet Extensi MANJARO_XFCEM_200 2020-04-26-07-46-59-00                                
├─sdd1              iso9660     Joliet Extensi MANJARO_XFCEM_200 2020-04-26-07-46-59-00                                
└─sdd2              vfat        FAT12          MISO_EFI          BB33-7409                                             
sde                                                                                                                    
└─sde1                                                                               

Sda is my new SSD drive (sda1 will be /boot/efi, vgssd-vgssd--lvol--root will be / and vgssd-vgssd--lvol--ssd will be /home/ssd). Sdb is my new 4TB HDD (will be /home).

I used rsync to "clone" the respective partitions from currently running OS (sdc drive). For root:

sudo rsync -aAXv / --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found","/home","/boot/efi"} /run/media/asdfg/54eae670-8b43-48fc-a502-7948f97716d4

and it was similar for the other partitions.

I changed the UUIDs in the fstab (using a live boot USB with manjaro with manjaro-chroot), added cryptdevice=UUID=54eae670-8b43-48fc-a502-7948f97716d4:cryptroot root=/dev/mapper/vgssd-vgssd--lvol--root in between the quotes of /etc/default/grub GRUB_CMDLINE_LINUX line.
Then, did grub-mkconfig -o /boot/grub/grub.cfg and mkinitcpio -P while manjaro-chrooted.

Then, I tried to boot. I'm prompted to enter my password, I enter it, and I'm presented with this error:

error

So, I'm stuck here. I can open the encrypted drives and mount the logical volumes just fine from a live boot still. But for now I came back to my old HDD (sdc drive) in which I'm running the OS like before and typing this right now. I tried to search for a solution but nothing seems to work or my newbieness is getting in the way. Should I just start it from scratch? I have backed up most of the files, I just wanted to see if I was able to get the migrated system to work just as before.

Best regards

EDIT: Oh, I'll add my "2" fstabs here:

The one supposed to work on the new ssd

# /dev/mapper/vgssd-vgssd-lvol--root
UUID=54eae670-8b43-48fc-a502-7948f97716d4	/         	ext4      	rw,noatime	0 1

# /dev/mapper/vgssd-vgssd-lvol--ssd		
UUID=536b4dd8-ad75-4b76-9c87-3a944a997781	/home/ssd	ext4		rw,noatime	0 0

# /dev/mapper/vghdd-hdd-lvol--home
UUID=2b9fa447-c558-4fb5-801a-4fcd44a62a47	/home     	ext4      	rw,noatime	0 0

# /dev/sda1
UUID=FA50-7CEC      	/boot/efi 	vfat      	rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro	0 2

/swapfile       	none      	swap      	defaults,pri=-2	0 0

the one currently running as I type this on the oldest hdd drive:

# /dev/mapper/vg-lvol--root
UUID=dc5818ed-1868-46da-aa61-648998b1c540	/         	ext4      	rw,noatime	0 0

# /dev/mapper/vg-lvol--home
UUID=f22764fc-deb2-4c6d-b492-ae425662b86c	/home     	ext4      	rw,noatime	0 0

# /dev/sda1
UUID=1B80-52BE      	/boot/efi 	vfat      	rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro	0 0

/swapfile       	none      	swap      	defaults,pri=-2	0 0

IMO your fstab needs to be modified. I don't believe Windows file system partitions should be scanned for errors in Linux. Therefore the /boot/efi vfat drive should not end in 02, it should end with 00.

I'm not familiar with logical volumes, but normally mounts for /home should be scanned for errors after /root. Therefore, /home folders fstab load lines normally end with 02. Not really sure about logical volumes though.

Turns out my mistake was indeed very newbie-ish. My fstab was fine, the problem was the encrypted HDD disk (the 4TB new one). I ended up installing from scratch but I was stubborn and rsynced again (so the UUIDs changed). The problem was in the /etc/crypttab that I didn't edit correctly.

Here's my current partitions scheme:

~ >>> lsblk -f                                                                                                                                         
NAME                   FSTYPE      FSVER            LABEL             UUID                                   FSAVAIL FSUSE% MOUNTPOINT
sda                                                                                                                         
├─sda1                 vfat        FAT32                              DCD6-1FC4                               744,1M    27% /boot
└─sda2                 crypto_LUKS 1                                  ae1c0eac-381b-4f44-9954-23440d8388da                  
  └─cryptssd           LVM2_member LVM2 001                           uGvYSl-bgmY-3cQ1-Uz7E-0DYU-bEVY-1hnBWj                
    ├─vgssd-lvol--root ext4        1.0                                0c095de9-2acb-46ab-99cc-591db539aef6      8,7G    65% /
    └─vgssd-lvol--ssd  ext4        1.0                                e24258fa-2200-4ccc-87d4-6c3b4c984d76    329,9G    14% /home/ssd
sdb                                                                                                                         
└─sdb1                 crypto_LUKS 1                                  77852b9e-b87f-4d2d-a589-1615f61fe783                  
  └─crypthdd           LVM2_member LVM2 001                           fbQ9di-dQi9-lrFf-YuPg-iB1N-JwX8-sfqW3t                
    ├─vghdd-lvol--home ext4        1.0                                2b9fa447-c558-4fb5-801a-4fcd44a62a47      3,1T     9% /home
    └─vghdd-lvol--var  ext4        1.0                                6ac1fd22-709b-485b-9d0e-b8d7ba8988aa      8,4G    38% /var
sdc                                                                                                                         
├─sdc1                 vfat        FAT32                              1B80-52BE                                             
└─sdc2                 crypto_LUKS 1                                  24039a74-818b-46eb-88c9-8ec3b302b5e2                  
sdd                                                                                                                         
└─sdd1                                                                                                                      
sde                    iso9660     Joliet Extension MANJARO_XFCEM_200 2020-04-26-07-46-59-00                                
├─sde1                 iso9660     Joliet Extension MANJARO_XFCEM_200 2020-04-26-07-46-59-00                                
└─sde2                 vfat        FAT12            MISO_EFI          BB33-7409                                             

Sda is my new ssd, where I'm now running the system. Sdb is my 4TB HDD. Sdc is my old HDD with the original files that were rsynced to sda, I'll leave it as it is for now in case something happens, but I'll see if I can later put it as a Physical Volume in the vghdd volume group and mount it as /home or maybe /home/backup. Sdd is an external hdd drive and sde is my bootable live usb stick.

So, here's what I did to fix it:

I used this article to rsync my files. Leaved out /var, /home and things like /etc/fstab and /etc/crypttab, also /root/. Those were gonna be edited or rsynced to their own partitions later.
So, my mistake lied at this part. My drive wasn't being decrypted at boot time apparently. I used this and this to adjust it. I thought that if leaved it empty I'd be prompted to enter the password at boot, it was maybe a very newbie-ish mistake, but it is all functional now!

Here's what my /etc/fstab and /etc/crypttab look like now:

/etc/fstab

# /dev/mapper/vgssd-lvol--root
UUID=0c095de9-2acb-46ab-99cc-591db539aef6	/         	ext4      	rw,relatime	0 1

# /dev/mapper/vghdd-lvol--home
UUID=2b9fa447-c558-4fb5-801a-4fcd44a62a47	/home     	ext4      	rw,relatime,noauto,x-systemd.automount	0 2

# /dev/mapper/vgssd-lvol--ssd
UUID=e24258fa-2200-4ccc-87d4-6c3b4c984d76	/home/ssd 	ext4      	rw,relatime	0 2

# /dev/mapper/vghdd-lvol--var
UUID=6ac1fd22-709b-485b-9d0e-b8d7ba8988aa	/var      	ext4      	rw,relatime	0 1

# /dev/sda1
UUID=DCD6-1FC4      	/boot     	vfat      	rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro	0 2

/etc/crypttab

# Configuration for encrypted block devices.
# See crypttab(5) for details.

# NOTE: Do not list your root (/) partition here, it must be set up
#       beforehand by the initramfs (/etc/mkinitcpio.conf).

# <name>       <device>                                     <password>              <options>
# home         UUID=b8ad5c18-f445-495d-9095-c9ec4f9d2f37    /etc/mypassword1
# data1        /dev/sda3                                    /etc/mypassword2
# data2        /dev/sda5                                    /etc/cryptfs.key
# swap         /dev/sdx4                                    /dev/urandom            swap,cipher=aes-cbc-essiv:sha256,size=256
# vol          /dev/sdb7                                    none
crypthdd	/dev/disk/by-uuid/77852b9e-b87f-4d2d-a589-1615f61fe783	/root/keyfile_hdd	luks

The last line is the important one.

/root/keyfile_hdd was the key file generated and added to my luks header to mount the encrypted drive at boot, since my root file system is protected, I shouldn't have to worry. All fine now! I booted (very fast now with the ssd) and it's like using my original system that was in the old HDD. The games put in /home/ssd are also loading noticeably faster.

Best regards.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.

Forum kindly sponsored by