I finally have the budget to build my first NAS and upgrade my desktop PC. I have used Linux for quite some time, but am far from an expert.

One of the steps is to move my M.2 NVME system drive (1TB) from my desktop to my NAS. I want to replace it with a bigger NVME drive (2TB). My current motherboard only has a single M.2 slot, that’s why I bought a M.2 enclosure.

My goal is to put my new drive into the enclosure, clone my whole system disk onto it and then replace the old drive. At first I found several posts about using clonezilla to clone the whole drive, but some posts mentioned it not working well with btrfs (/ and /home subvolume), which is the bulk of my drive.

I have some ideas how I might to pull it off. My preliminary idea is:

  1. clone my boot partition with clonezilla
  2. use btrfs-clone or moving my butter to transfer the btrfs partition
  3. resize the partitions with gparted (and add swap?)

The two aspects I’m uncertain about are:

  1. UUIDs
  2. fstab

I plan to replace the old drive, so the system will not have two drives with the same UUID. If the method results in a new UUID I need to edit fstab.

As you can see I’m not sure how to proceed. Maybe I can just use clonezilla or dd to clone my whole drive? If someone has experience with such a switch or is just a lot for familiar with the procedures, I would love some tips and insight.

Thanks for reading.

////////////////////////////////////////////////////////////////////////////////////////////////////////////

EDIT: Thinking about how to do it, might have actually taken longer than the procedure itself. For anyone in a similar situation, I was able to replace the drive with these steps:

  1. clone the whole drive (new drive has a bigger capacity) with clonezilla
  2. physically switch the drives
  3. boot into a live medium and resized the btrfs partition on the new drive with gparted
  4. boot into the main system and adjust the filesystem size with sudo btrfs filesystem resize max /

With two NVME drives (even though one was in a USB M.2 enclosure) everything took about 30 minutes. About 300 gigs of data were transferred. I haven’t found any problems with the btrfs partition thus far. Using dd like others recommended might work as well, but I didn’t try that option.

  • tychosmoose@lemm.ee
    link
    fedilink
    arrow-up
    2
    ·
    edit-2
    3 months ago

    I did this recently and just used dd, parted and ‘btrfs filesystem resize’. UUIDs and fstab don’t need to be changed if you do this. It’s got to be done offline, so you’ll need to boot to a Live USB. I installed the new SSD in the m.2 slot and put the old one in an enclosure. You don’t need to mount the old SSD filesystem, which is good. Just do something like:

    dd if=/dev/sdb of=/dev/nvme0n1 bs=65536 status=progress

    Where sdb is the old drive in the USB enclosure and nvme0n1 is the new SSD. Replace those with the actuals you see in lsblk. Next resize the root partition with parted or gparted, leaving space at the end if you want a separate /home or have a swap partition there or something.

    Once the partition is larger, mount the partition and use the btrfs command to resize the filesystem. Something like:

    btrfs filesystem resize max /mnt