Clone and configure old /home directory to a new home partition from btrfs to ext4

Why?

I decided to install and overwrite the windows 10 installation with Zorin OS on my main SSD. This time, I want to seperate the home directory into a partition. Then, transfer my old home files there.
|
The new installation is currently formatted as ext4.

Current setup (and fdisk later)

I have two SSD drives and one unmounted backup HDD drive. The first SSD drive is 1TB as /dev/sda, I use this drive for a fresh Zorin OS 17 install with / and /home directory on /dev/sda3 as filesystem ext4.
|
The second SSD is 256GB as /dev/sdb, it's unbootable because of an btrfs error, it contains my previous Zorin OS install including my /home on /dev/sdb3 as filesystem btrfs.

Previous attempt

I've spent my sleep trying to get btrfs to cooperate with systemd mount in the emergency terminal.
|
Even after rm -rf'ing the /home directory and @home subvolume on the /dev/sda3, then updating fstab to the cloned home partition /dev/sda4/home in live environment.
|
Felt defeated, so I reinstalled Zorin OS as ext4 this time.

Goal

I want to create a new /home partition on the first SSD as /dev/sda4, then transfer my old /home files from /dev/sdb3.
|
This time I want to configure fstab correctly to use my old /home directory without failing systemd mounts on boot.

Offnote

I'll keep the second SSD as a backup of my filesystem. The HDD is in NTFS with win10 backups, I dunno if I can clone /dev/sdb3 to it yet.
|
I'm familiar with Gparted, blkid, and fstab from my last attempt. I'm still not familiar with btrfs-tools with its subvol logic yet.
|
I'll continue replying with updates on mobile. Open for any suggestions.

Backed up /dev/sda3 and created /dev/sda4 for home partition.

fdisk before clone:

mint@mint:~$ sudo fdisk -l
Disk /dev/loop0: 2.66 GiB, 2852716544 bytes, 5571712 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/sda: 931.51 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: Samsung SSD 870 
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 41CD311D-CC48-4E95-9A2A-1FF321CDB453

Device         Start        End    Sectors   Size Type
/dev/sda1       2048     999423     997376   487M EFI System
/dev/sda2     999424   17000447   16001024   7.6G Linux swap
/dev/sda3   17000448  767000575  750000128 357.6G Linux filesystem
/dev/sda4  767000576 1953523711 1186523136 565.8G Linux filesystem


Disk /dev/sdb: 223.57 GiB, 240057409536 bytes, 468862128 sectors
Disk model: KINGSTON SA400S3
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 9290195E-5134-4737-8042-0A4E9CB2DE77

Device        Start       End   Sectors   Size Type
/dev/sdb1      2048   1050623   1048576   512M EFI System
/dev/sdb2   1050624  16674815  15624192   7.5G Linux swap
/dev/sdb3  16674816 468860927 452186112 215.6G Linux filesystem

It works -v-

I made some few errors, but I was able to fix them afterwards. The steps below should work.
|
Here's what I did to get it working on ext4 partition:

Live ISO

Booted to linux mint cinnamon iso since it starts faster for me.
|
Summon the terminal once the desktop loads.

Mounting

sudo mkdir /mnt/old-home
sudo mount /dev/sdb3 /mnt/old-home
sudo mkdir /mnt/new-home
sudo mount /dev/sda4 /mnt/new-home
sudo mkdir /mnt/sda-root
sudo mount /dev/sda3 /mnt/sda-root

Cloning (from btrfs)

sudo rsync -aXS --progress /mnt/old_home/@home /mnt/new_home/.

|
Upon completion, check /mnt/new-home in your file explorer to verify the stuff's there.

Find /dev/sda4 UUID

sudo blkid

|
My UUID output for /dev/sda4:

/dev/sda4: LABEL="home" UUID="5b497191-f3c3-4116-be43-61d25464f622" ...

Fstab config

cd /mnt/sda-root
sudo nano /etc/fstab

|
Added new lines to fstab:

UUID=5b497191-f3c3-4116-be43-61d25464f622 /home ext4 defaults 0 2

|
Save and exit.

Unmount

cd ~
sudo umount /mnt/old-home
sudo umount /mnt/new-home
sudo umount /mnt/sda-root

|
If a mount is busy, don't forget to close the file manager and cd ~, then umount again.

Reboot

My main drive is the first in my uefi boot list. ^^

Done \o/

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