Unable to Unmount USB Boot Drive on RPi 4 after Booting from SD Card

I am running Ubuntu Mate 20.10 on a Raspberry Pi 4 with 8GB RAM. I started with Mate on an SD Card and then I transferred it to an Samsung 860 EVO SSD in a DeskPi Pro. Mate boots and runs fine on the SSD. I am trying to backup the Mate image on the SSD but I am unable to Unmount the writable partition on the SSD after booting from another Mate image on the Micro SD card. Using the Disks utility, when I try to unmount the partition, it says:

Error unmounting File System
Error unmounting /dev/sda2; target is busy (udisks-error-quark, 14)
UUID: xxxxxxxxxxxxxxxxxxxxx
Partition Type: Linux
Contents: Ext4 (version 1.0) -- Mounted at Filesystem root.

I tried the same thing using the dd utility and get a similar error. Any ideas why I am unable to unmount the SSD after booting from the SD card? Thanks.

I get the impression that /dev/sda2 refers to the second partition on the boot device, not the SSD necessarily. At least, that's how it often worked a few years ago. Let me explain this in more detail.

The exact device drivers for the SATA SSD are very different from the device drivers which control the MicroSD card. The two devices need different drivers. Generally speaking, when you load up a Linux system, the first device drivers loaded are the ones needed to get the whole system booted up; after the essential drivers are loaded, the drivers for all the other devices are loaded. In one case, you boot from the SSD; the system needs to load device drivers for the SATA interface, so those are loaded. Once the essential system initialization is complete, the system scans and probes and discovers an SD card inserted, so it loads the device drivers for that -- and the SD card is recognized as /dev/sdb, while the SSD is assigned /dev/sda since it was the first "disk" assigned a "device node". But when you boot from the SD card, it gets the /dev/sda designation, and the SSD's drivers are loaded second, so it is assigned /dev/sdb.

So, make sure that /dev/sda is really the SSD. Furthermore, ensure that you did indeed boot from the MicroSD card.

Thanks for taking the time to respond Gordon! I appreciate that. I have attached some screen shots that show the details of the disks on my RPi4-8Gb. When I try to Create a Disk image of /dev/sda using the Disks tool I get the error that I put in the opening post. I have verified that my boot sequence will boot from SD if there is a card present. I am new to Linux so this may be normal but I found it a bit odd. When I boot with Ubuntu Mate from the SD, my desktop looks the same as if I booted from the USB SSD.

As an additional test, I booted an instance of Raspbian Lite from the SD card. I verified that both /dev/sda1 and /dev/sda2 are not mounted. Then I mounted an extenal USB drive that I want to write the image to. Then I ran this command:

sudo dd if=/dev/sda conv=sync,noerror bs=64K | gzip -c > /home/dean/rpi8-ext/backup.img.gz

and it immediately returns Permission Denied. I verfied that I do have write permission on the output media. Any ideas what my problem might be? Thanks!

I created a bootable SD image of Ubuntu Server 21.04 and when I booted that SD image, my Mate Desktop from the USB drive appeared and I have the same problem when I try to umount sda2, it says target is busy. Is there any way to have the SD card image load without the Mate desktop from the USB Drive?

I also found that if I run the sudo su command in the CLI when booting with a Raspbian image, I am able to umount both sda1 and sda2 and run the dd utility. The only problem there is that my SSD is 500GB and it appears that dd copies the entire device. I have not tried this but I think that if I create a smaller partition on the SSD, that the dd utility would be a viable option.

As a workaround, can you please try unplugging the USB drive before the system boots up, then boot up the system from the SD card, then plug in the USB drive?

1 Like