If you want to have a good experience in using Raspberry Pi as an desktop, Ubuntu Mate is one of the best options right now.
First of all, we have official support from the Ubuntu community, directly from Canonical. Secondly, Ubuntu Mate is one of the best Linux desktop distributions out there. Third, Raspberry Pi foundation has released the 8GB version for the Pi 4.
We have everything in place to start our journey. But we have one problem. Performance.
SD card cannot provide read/write capacity fast enough for our daily uses. Therefore, SSD card can provide better performance and also high reliability. Unfortunately, Ubuntu Mate for Raspberry Pi does not yet support the boot from USB.
People are looking around for solution.
It has been announced that the new release of Ubuntu Mate 20.10 will support USB boot. We are not far away from the release date which is somewhere by the end of this month.
However, for those who cannot wait, we can have an alternative solution. We can copy the root partition from SD card to put in SSD card. Then we change the PARTUUID in cmdline.txt to match with our SSD card.
In this solution, you will need both: SD card (during the boot), SSD (after the boot). The good thing about this is we still using the official release of the Ubuntu Mate. It is stable than other solutions.
If you want to process, you can follow steps below:
Prepare SSD Card
We assume that you already have a working Ubuntu Mate running on your Raspberry Pi via traditional way which is running from an SD card.
Plug your SSD card to USB 3.1 (blue color). Open the terminal and type this command:
sudo fdisk -l
You should have the output something similar as below:
mike@mike-desktop:~$ sudo fdisk -l
Disk /dev/loop0: 232.33 MiB, 243605504 bytes, 475792 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytesDisk /dev/loop1: 85.83 MiB, 89980928 bytes, 175744 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytesDisk /dev/loop2: 48.8 MiB, 51154944 bytes, 99912 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytesDisk /dev/loop3: 62.9 MiB, 65105920 bytes, 127160 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytesDisk /dev/loop4: 26.26 MiB, 27533312 bytes, 53776 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytesDisk /dev/loop5: 14.89 MiB, 15589376 bytes, 30448 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytesDisk /dev/loop6: 16 KiB, 16384 bytes, 32 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytesDisk /dev/mmcblk0: 59.64 GiB, 64021856256 bytes, 125042688 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xd3408824Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p1 * 2048 524287 522240 255M c W95 FAT32 (LBA)
/dev/mmcblk0p2 524288 125042654 124518367 59.4G 83 LinuxDisk /dev/sda: 223.58 GiB, 240057409536 bytes, 468862128 sectors
Disk model:
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 33553920 bytes
Disklabel type: dos
Disk identifier: 0x62b0e6c1Device Boot Start End Sectors Size Id Type
/dev/sda1 2048 468862094 468860047 223.6G c W95 FAT32 (LBA)Disk /dev/sdb: 59.64 GiB, 64021856256 bytes, 125042688 sectors
Disk model: Storage Device
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xd3408824Device Boot Start End Sectors Size Id Type
/dev/sdb1 * 2048 524287 522240 255M c W95 FAT32 (LBA)
/dev/sdb2 524288 125042654 124518367 59.4G 83 Linux
Look for your SSD Card. You might know the size of your SSD card. Do not confuse with your SD card which is start by /dev/mm…
Your SSD card Disk should start with /dev/sda or /devsdb. It depends. In this example, my SSD card is /dev/sdb.
We need to format our SSD card before process the copy by typing following command:
sudo fdisk /dev/sdb
Then type d to delete all the partition, until you got no more partition.
ike@mike-desktop:~$ sudo fdisk /dev/sdb
Welcome to fdisk (util-linux 2.34).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.Command (m for help): d
Partition number (1,2, default 2): 1Partition 1 has been deleted.
Command (m for help): d
Selected partition 2
Partition 2 has been deleted.Command (m for help): d
No partition is defined yet!Command (m for help):
Now, we can create new partition by following steps below:
Type n and enter for new partition
Type p and enter for primary
Press enter for accept default partition as 1
Press enter again for default start sector
Press enter once more for default end sector
Type Y and enter to remove the device signature.
Type w and enter to write the change and exit
Command (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1):
First sector (2048-125042687, default 2048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-125042687, default 125042687):Created a new partition 1 of type ‘Linux’ and of size 59.6 GiB.
Partition #1 contains a vfat signature.Do you want to remove the signature? [Y]es/[N]o: Y
The signature will be removed by a write command.
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
Now, we can format our SSD Card by typing command:
sudo mkfs.ext4 /dev/sdb
If there’s any prompt, just type Y as answer to format the disk. You need to wait for a while. It might take some time depend on the size of your SSD card. Wait until everything is done.
mike@mike-desktop:~$ sudo mkfs.ext4 /dev/sdb
mke2fs 1.45.5 (07-Jan-2020)
Found a dos partition table in /dev/sdb
Proceed anyway? (y,N) y
Creating filesystem with 15630336 4k blocks and 3907584 inodes
Filesystem UUID: 677dfa26-c481-4056-a9aa-e81078750faf
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424Allocating group tables: done
Writing inode tables: done
Creating journal (65536 blocks): done
Writing superblocks and filesystem accounting information: done
Copy Root to SSD Card
Now it is time to copy the Root from SD card to SSD card. First we need to mount the disk by following command:
sudo mount /dev/sdb /mnt
We will use rsync to copy all the files from SD to SSD. If you not yet install rsync, you can install it:
sudo apt install rsync -y
Now we can process the copy:
sudo rsync -axv / /mnt
This will take some time to finish the copy. You can grab a coffee or watch a quick news on Youtube. Wait until the copy finished.
Now we need to find the PARTUUID of our SSD Card with command:
sudo blkid
Take note the PARTUUID because we will need to use it later.
mike@mike-desktop:~$ sudo blkid
/dev/mmcblk0p1: SEC_TYPE=”msdos” LABEL_FATBOOT=”system-boot” LABEL=”system-boot” UUID=”E40B-247F” TYPE=”vfat” PARTUUID=”d3408824-01″
/dev/mmcblk0p2: LABEL=”writable” UUID=”13641ce7-7d4d-46c3-a37d-955cecb6ac61″ TYPE=”ext4″ PARTUUID=”d3408824-02″
/dev/sda1: UUID=”ac1004dd-8fb7-40e0-8db8-e454599ec699″ TYPE=”ext4″ PARTUUID=”62b0e6c1-01″
/dev/loop0: TYPE=”squashfs”
/dev/loop1: TYPE=”squashfs”
/dev/loop2: TYPE=”squashfs”
/dev/loop3: TYPE=”squashfs”
/dev/loop4: TYPE=”squashfs”
/dev/loop5: TYPE=”squashfs”
/dev/loop6: TYPE=”squashfs”
In my case, the PARTUUID of the SSD Card is:
/dev/sda1: UUID=”ac1004dd-8fb7-40e0-8db8-e454599ec699″ TYPE=”ext4″ PARTUUID=”62b0e6c1-01″
Now we need to change the PARTUUID in two files:
sudo nano /boot/firmware/cmdline.txt
net.ifnames=0 dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=62b0e6c1-01 rootfstype=ext4 elevator=deadline rootwait fixrtc quiet splash plymouth.ignore-serial-consoles
sudo nano /mnt/etc/fstab
PARTUUID=62b0e6c1-01 / ext4 defaults 0 0
LABEL=system-boot /boot/firmware vfat defaults 0 1
Now, congratulation. We finished copy and change the configuration to use SSD card for the Root partition. You can now reboot the Pi:
sudo reboot
After reboot, you can check the size of the root partition, you should see the size will be change to the same size as your SSD Card.
df -h
Leave a Reply