How to easily mount an Ext4 USB Device like a USB SD Card reader to a Raspberry Pi or another Linux distribution like Debian. This is an additional post to the Node-Red migration post. Especially if you want to copy some of your data from the SD Card of your old Raspberry Pi to your new Raspberry Pi 4 with a SSD Disk. Follow my linked article to all informations about a new Raspberry Pi 4 setup, or my Node-Red Setup post. The Node-Red migration post will follow soon, so stay tuned for this in my Smart Home section.
Create a Mountpoin
First of all you have to create a new directory, which you use afterwards to mount you device to. You best should add this in /media and choose any name you like in this case usb. The command looks like the following
sudo mkdir /media/usb
How to find the device name
The easiest way to get a list of all your devices which are connected to your Raspberry is the following. Make sure your USB adapter with the old SD card is plugged into your Raspberry Pi
sudo blkid -o list -w /dev/null
Now you get as output the list with the devices and the mount points. If you mount a Smart Card from a previous Raspberry Pi Os Installation, there should be 2 devices which are not mounted with the labels boot and rootfs. Take a look at the following example screenshot.
Mount the device
In the previous step you got the correct device name. Find the device with the ext4 filesystem, the label rootfs and which is not mounted. Get the correct device name, and use it of /dev/sdXX. In this example this would be /dev/sdb2, and mount it to your previous created directory.
sudo mount -t ext4 -o defaults /dev/sdXX /media/usb
After the device was successfully mounted, switch to this directory to work with the data there. You are now able to work normal with the data on your device, for example to copy needed data to your new system. This is just a temporary mount so if you reboot your Raspberry Pi this will not be mounted automatically. If you are interested leave me a comment, than I’ll wright another post how to permanent mount devices.
cd /media/usb ls -la
You temporary mounted a USB Device to your new Raspberry Pi 4, to get data from your old SD Card to your new Raspberry Pi, or even other Linux distributions. You need this for my next post where I will describe how to migrate your Node-Red Data from an old Device to a new one, so stay tuned.
If you have any questions or suggestions, or if you would like further information, please let me now in the comments.