You can not access any form of storage media without mounting the drive first. However, you can do this entire process from your terminal.
First, you need the partition ID (/dev/sdXY
). You can use the lsblk
command to find this. Once you have this ID, you can run sudo mount /dev/sdXY /mnt
. Your flash drive's filesystem will now be available at /mnt
and can be used from the terminal.
Devices in /dev
are known as block devices, and are raw representations of the filesystems contained within those devices (where applicable). While you can directly read and write from these devices, it's often a bad idea because you're ignoring a huge layer of filesystem abstraction and protection.
For most use cases, the only time you'd be reading from/writing to the raw block devices is for cloning or very low level device operations. The filesystem provides a huge layer of abstraction, error checking, and file safety.
Note: The section below this block of text is meant for educational purposes only. Please do not try this on any system/drive that you care about, as the results could very easily be catastrophic. I take no responsibility for what you do if you follow anything I say below.
You have been warned.
With that warning being said, and if you don't care about the contents of your flash drive, it is theoretically possible to read and write data to/from the flash drive using raw block operations.
At its simplest, you'd write a file (let's say files.zip
) to the flash drive using this command:
dd if=files.zip of=/dev/sdd bs=1024
This will copy the zipfile to your flash drive's raw block, but will also (likely) corrupt any partition or related data currently on the drive. It will also make a record of how many "blocks" were written to the drive -- make note of this. For this example, I'm going to say 1234 blocks were copied.
When you want to read the file from the flash drive onto another computer, you can do this with the inverse command:
dd if=/dev/sdd of=files.zip count=1234 bs=1024
This will pull the raw block data from the drive (containing a ZIP file) for the first 1234 blocks, and write it to files.zip
on your computer in the current directory. Also note that this ZIP file may not be actually readable due to corrupt/garbage data at the end of the file or similar. Be sure to note this if necessary. You can use the head
command to trim the ZIP file back if needed.
When you are done, you'll likely need to format the flash drive and re-partition it and the like, making this very infeasible for large operations. Just use the file system.