Migrate drives

HDD to SDD

  • List drives name

    sudo fdisk -l /dev/sata[1-9]
  • Identify source and destination (e.g. /dev/sata1, /dev/sata2)

  • Clone bit by bit using the block information got from command above (e.g. 512 byte):

    dd if=/dev/sata1 of=/dev/sata2 bs=512 conv=noerror,sync status=progress

Remove from an SHR/RAID1 array

Note: SHR is just an extra layer (LVM) on top of standard Linux-RAID (MD); so the commands below are simply based on this last one.

  • Let's say you have 2 drives in SHR/RAID1

  • List all the RAID arrays and volumes

    mdadm --detail /dev/md*
  • Storage Manager -> Deactivate one of them (e.g. /dev/sata2); otherwise you can also do the following:

    • For each RAID array (e.g. /dev/md0, /dev/md1, /dev/md2)

      • Fail and remove the drive from that array, e.g.:

        mdadm /dev/md0 --fail /dev/sata2p1
        mdadm /dev/md0 --remove /dev/sata2p1
        wipefs -a /dev/sata2p1
  • For each RAID array (e.g. /dev/md0, /dev/md1, /dev/md2)

    • Resize that array to just 1 drive, e.g:

      mdadm --grow --force --raid-devices=1 /dev/md0

Convert ext4 to btrfs

The only supported way to convert an ext4 volume to btrfs is to backup the data, delete the volume, create a new btrfs volume, and restore the data. See the KB article in the references below.

Backup & Restore

  • Stop Container Manager

  • Backup Folder and Packages to C2 (12 hours for 500 GB, 20 MB/s)

    • Important: if you back up the entire system instead, the volume will be recreated as ext4

    • You need a C2 account and a subscription, the trial is fine

  • Delete the current ext4 volume

    • You may need to completely uninstall Container Manager

  • Re-create the volume with btrfs

  • Restore Folder and Packages (3 hours for 500 GB, 100 MB/s)

    • No need to restore system configurations

    • Important: MariaDB had disabled TCP port and reset to default for me, after restore

In-place conversion

Ideally this should be the best & fastest option.

  • Plug the ext4 drive into a Linux system with mdadm package

  • Get the ext4 partition name, i.e. using partitionmanager (e.g. /dev/vg1000/lv)

  • sudo e2fsck -fvy /dev/vg1000/lv

  • sudo btrfs-convert /dev/vg1000/lv

  • (Optional) remove the ext2 backup image & balance, see documentation

Unfortunately at the time being, you get the following error, most probably because of a bug on large size partitions..

[...]
Create btrfs metadata
ERROR: failed to copy ext2 inode 12: -95
ERROR: error during copy_inodes -95
WARNING: error during conversion, the original filesystem is not modified

See also: btrfs-convert

References

Last updated