Migrating FreeBSD Installation into Bigger Drives

 Since I'm installed FreeBSD 13.2 on my old PC, the old Sandisk 128GB drive seems doesn't hold any more storage due to limited by today's standard so I have to upgrade into a bigger drive. However, I'm was having difficulty on doing this due to no exact guide on how to make this thing simpler so I have to search it for a easier and simpler method on migrating FreeBSD installations into a newer ones. 

Before you do, make sure that:

i) Have your system configured to auto-detect and enable user-mount features including USB storages.

ii). Have a bigger drive, either old and new.

iii). Blank clean drive, fully clean and no quick format method if you're using existing older used drive but bigger ones.

iv). The PC is configured to boot EFI system only as I'm only covering the guide on boot with EFI system. 

v). Prepare any system-wide changes before migrating procedure. 


1. Preparing the storage drive. 

For this case, I'm using UFS formatted drive to prepare the migration since current drive already uses UFS drive. Insert the drive into USB drive or SATA port (where SATA hotplug feature enabled). 

Then, run the FreeBSD partition manager, sade to manage the partitions, must be run on root mode:

          $ sade

Then, you will see the GUI partition manager like this:

 
 Navigate to "Auto" and select "ada1" (or da0/da1 for USB drive) to prepare the drive which you want to migrate into. Be careful not to mis-select the drive!

 Then, select "Entire Disk"

Select GPT partition table:

After that, you will see the list in "ada1" like this and go to "Finish":

Confirm the changes of the partition that made and go to "Commit"

Wait until finishes


2. Migrating the FreeBSD installation into the newer drive.

Run the command to verify the partition that had been made:

       $ gpart show

Run the command to install the bootloader into the ada1 drive:

        $ gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 ada1

Mount the "ada1" partition into /mnt/ directory

          $  mkdir /mnt/newpart

      $  mount /dev/ada1p2 /mnt/newpart

You will need to install the clone tool first before using it:

           $ pkg install clone

Perform file tree cloning from source directory into destination storage that you want to migrate

           $ clone -c rwoff -x .sujournal / /mnt/newpart

Edit the fstab inside the migrated drive:

          $ nano /mnt/newpart/etc/fstab

Make sure that you have to edit it back into "ada0" drive as you want to remove the old drive before booting it back with new drive:


Remove the old drive and install the new migrated drive and boot it back.



Comments

Popular posts from this blog

Installing nvidia-drm-kmod on FreeBSD

Setting Up GPU Cards on FreeBSD 13

How To Setup Optical Drives on FreeBSD