Announcement

Collapse
No announcement yet.

Migrating a btrfs system to new hardware - my way.

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Migrating a btrfs system to new hardware - my way.

    I got a lot of help from this forum on btrfs and now that I have my new hardware working with btrfs, I thought I'd document what I did so myself and others can repeat it if needed.

    Task: Take a working Kubuntu 21.10 system using BTRFS on root and migrate it to new hardware.

    Old system hardware: Boot SATA SSD with efi, swap, and root(btrfs). 2 4TB harddrives in a BTRFS mirror.

    New system hardware: New motherboard with nvme SSD for efi, swap, and root(btrfs). Same 2 drive mirror.

    On the old hardware system, create snapshots and send them to the external snapshots directory on the mirror.

    Code:
    sudo -i
    mkdir -p /subvol
    mkdir -p /data
    mount /dev/sdc3 /subvol # mount root (/) on /subvol
    mkdir -p /subvol/snapshots
    mount /dev/sda /data # mount mirror on /data
    mkdir -p /data/snapshots
    
    btrfs su snapshot -r /subvol/@ /subvol/snapshots/YYYYMMDD@
    btrfs su snapshot -r /subvol/@home /subvol/snapshots/YYYYMMDD@home
    
    btrfs send /subvol/snapshots/YYYYMMDD@ | btrfs receive /data/snapshots
    btrfs send /subvol/snapshots/YYYYMMDD@home | btrfs receive /data/snapshots
    At his point I'm done with the old system. I shut it down, removed the mirror drives, and installed them into the new system.

    I booted the Kubuntu 21.10 ISO on the new system and selected "Try Kubuntu". I followed the instructions at:

    https://theduckchannel.github.io/pos...-+-grub-btrfs/

    I used this article just for the editing of the partman mount and fstab files. Once that was done and saved I just double-clicked "Install Kubuntu"

    I used the manual partitioning option to create the efi, swap, and root(/) btrfs partitions on the nvme0n1 drive and then installed Kubuntu.

    After the new system was running a fresh install of Kubuntu, I printed out a copy of the /etc/fstab for later use.

    Then setup to restore the saved snapshot:

    Code:
    sudo -i
    mkdir /subvol
    mkdir /data
    mount /dev/nvme0n1p3 /subvol # mount root (/) on /subvol
    mkdir -p /subvol/snapshots
    mount /dev/sda /data # mount mirror on /data
    
    #restore the snapshots to root filesystem
    btrfs send /data/snapshots/YYYYMMDD@ | btrfs receive /subvol/snapshots/
    btrfs send /data/snapshots/YYYYMMDD@home | btrfs receive /subvol/snapshots/
    
    mv /subvol/@ /subvol/@old
    mv /subvol/@home /subvol/@homeold
    Now reboot to the Kubuntu ISO and select "Try Kubuntu" again. From a terminal run the following:

    Code:
    mount /dev/nvme0n1p3 /subvol # mount root (/) on /subvol
    
    # create the read/write images needed from the save snapshots.
    
    btrfs su sn /subvol/snapshots/YYYYMMDD@ /subvol/@
    btrfs su sn /subvol/snapshots/YYYYMMDD@home /subvol/@home
    edit /subvol/@/etc/fstab using UUID values from /subvol/@old/etc/fstab except for the /data mirror.

    Reboot, removing Kubuntu IOS and booting as normal, except at Grub prompt enter 'e' and edit the 3 UUID's so you are using the new UUIDs from the fstab that was printed out earlier.

    Once the system is booted, run from a terminal: sudo update-grub

    I did update my AP/router so the reserved IP address for the old system now pointed to the MAC address of the new system so the new system would appear on the network at the same IP address as the old one.

    Done!
    Last edited by jfabernathy; Feb 09, 2022, 04:53 PM.
Working...
X