Skip to main content
  1. Posts/

Running MNT Reform OS on an NVMe Disk

·1107 words·6 mins·
Hardware
Table of Contents

Running the MNT Reform 2 from an SD card is not a bad solution. It’s similar to the way a Raspberry Pi is run. However, I wanted to free the SD card slot. In this post I describe the whole process from picking and buying an NVMe SSD, to installing and configuring it.

But before I continue, I cannot take credit for this work, as it’s summarized in the Operating System on NVMe Without SD Card Post. I just wanted to give a little more detail into the steps I took, some of the mistakes I made, and add some information related to using an encrypted device.

Parts and Tools Needed
#

  • 1 NVMe disk
  • 1 Phillips screw driver
  • 1 M2x4mm pan head screw (included in the DIY kit)

Picking and Buying an NVMe Disk
#

I bought the one that MNT puts on the assembled version of the Reform 2, a 1Tb Transcend MTE220S because I didn’t want to risk it. I bought it from amazon.de (I tried to look for it in local businesses in Belgium but I couldn’t find it in the ones I was suggested to check). The price was around 125 Euro with shipping included.

There’s a community page on Confirmed Working NVMe Drives that will hopefully hold more options in the future but so far, the Transcend disk seems like a very good one.

Installing the Disk
#

  1. Disconnect the laptop from the power
  2. Discharge yourself by touching a metal surface or using a discharge bracelet
  3. Remove the acrylic bottom
  4. Remove the batteries
  5. Place the NVMe device in the M2 socket
  6. Secure it

Do not close the laptop just yet. Turn it around, plug the power, turn it on and log in with your user. If the installation was successful, you should be able to see the device on the Disks application

Partitioning, Formatting and Encrypting
#

The next step is to create one or more partitions on the disk. I used Gnome Disks but it’s limited because you cannot do logical volumes, so you might want to install gparted or follow some tutorial for the CLI on how to achieve your specific partitioning setup.

If you are planning to use the whole disk without partitioning and only format the disk, using the Drive Options menu (3 dots at the top right corner). The script mounting your partition /sbin/reform-init might have issues because of the name of the device. At least that’s what I experienced the first time I did this process.

My current setup is one encrypted partition with ext4 file system for root and one encrypted partition with ext4 file system for home (I will write about this in a next post). This means that I have to enter two passwords when booting. I’m planning to use a key in the future but if you don’t want to have to enter two passwords, read about logical volumes, or if you don’t want encryption at all then you don’t have to worry about this.

  1. Select the NVMe Disk
  2. Click on the + sign to create a new partition
  3. Select the size (needs to be at least the size of the SD card) and continue
  4. Give it a name e.g. “root”
  5. Select ext4 as your file system
  6. Select encryption with LUKS
  7. Press “Next”
  8. Add a pass phrase
  9. Press “Done”

Migrate Your Data
#

To copy all your data in the SD card to the NVMe disk, we first need to unlock the disk. The first argument is the path to the device, so it needs to map whatever partition number you did in the previous step. The second argument is the name you want to give, so choose whatever you prefer.

cryptsetup luksOpen /dev/nvme0n1p1 crypt

The unencrypted partition will be accessible on /dev/mapper/crypt

We can use that path to run the reform-migrate script

reform-migrate /dev/mapper/crypt

You can of course use Disks to unlock (open lock button) and mount (play button) the device instead. You will need to use the following command to move all your data.

rsync -axHAWXS --numeric-ids --info=progress2 / /media/USER/NAME

Make sure to update the last argument to be the path to where you mounted the device.

Configure Booting from NVMe
#

Booting from the NVMe disk is a two step process. We first need to configure the laptop to boot from the eMMC drive, and configure it to decrypt and mount the NVMe drive and init from it.

Read more about this topic on Section 10.2 and 10.3 from the Operators Handbook.

To switch the booting mechanism from the SD card to the inner eMMC module where the MNT Rescue disk resides, we need to flip a dip switch that resides underneath the heat sink.

  1. Shutdown and disconnect from power
  2. Remove the heat sink (be careful not to put the heat sink bottom flat on top of a surface since there’s some paste in it)
  3. Flip the dip switch on the bottom right (or top left depending on your perspective)
  4. Place the heat sink back in place

We can now plug the power again and start the machine. When prompted for a logging you need to use “root” without a password since this is a completely different system from the one configured on the SD card.

Now we need to download a newer version of U-boot in the rescue disk.

wget http://mntre.com/reform_md/flash-rescue-reform-init.bin

U-boot is a mini OS used to boot Linux. For what I understand, this “newer” version is just the same version than is in the SD drive, so trying that instead of downloading a new one would also be an option.

To flash the new U-boot we need to unlock the boot partition

echo 0 > /sys/class/block/mmcblk0boot0/force_ro

And flash the binary

dd if=flash-rescue-reform-init.bin of=/dev/mmcblk0boot0 bs=1024 seek=33

Now that we have this U-boot version in place, we can configure it to boot from the NVMe drive

reform-boot-config nvme

This creates the file /reform-boot-medium with the word “nvme” in it. This is important because it’s used by reform-init.

One important thing to mention is that reform-init will only try to unlock and mount the encrypted partition under /dev/nvme0n1p1. With a different setup, one needs to go and modify this script to the right path. I stumbled across this problem on my first attempt but it was quite simple to debug and to help me understand better what’s going on under the hood.

If everything went well you should be able to reboot the device and it will boot from the NVMe drive successfully. To finalize this process

  1. Shutdown the system and unplug it
  2. Put the batteries back in place (be careful with the polarity)
  3. Place the acrylic bottom
Reply by Email

Related

MNT Reform 2 DIY Kit Review
·1803 words·9 mins
Hardware

The MNT Reform 2 laptop was made available on Crowd Supply in June 2020. This review is for the DIY kit version, and I’ll focus on the experience of supporting this project and its vendor through crowdsourcing, the process of putting the machine together, and my first impressions. I plan to share a second post with my thoughts on the experience of using the device as my computer for personal use.

Vortex Core Mechanical Keyboard Review
·770 words·4 mins
Hardware

I got myself a new keyboard for my birthday, the Vortex Core. I wanted a mechanical keyboard that I could take everywhere with me. Being a 40% keyboard, I expected it to over deliver on the portable side, what I didn’t expect, is that I’d enjoy using this tiny keyboard so much, even for extended periods of time.

JSON Data Type
·450 words·3 mins
Application Development

Whenever we save data from one of our Rails models, each attribute is mapped one to one to a field in the database. These fields are generally of a simple type, like a string or an integer. However, it’s also possible to save an entire data object in JSON format in a field. Let’s see an example of how to do this from a Ruby on Rails application.