Wednesday, May 4

[SOLVED]: Cannot Copy Files From Linux To FAT Formatted USB Drive On Raspberry Pi

I got another query from one of my colleague asking how to copy files from Raspberry Pi filesystem running Linux kernel to an external USB drive that he had. Upon investigation, I found that the USB drive was formatted to a FAT32 based filesystem partition.

When I further looked into the issue, I realized that my colleague was trying to copy files from Raspberry Pi file sytem to the FAT formatted USB drive as a normal user and he was getting permission denied error.

Upon elevating his privileges to that of root using the sudo command, he was finally able to copy files from Linux filesytem on his Raspberry Pi to the external FAT32 formatted USB pen drive.

One thing I realize a lot of Linux users do not understand is that when you are trying to plug in a FAT formatted USB pen drive to a Linux system, the permission level required to access the mounted partition of that USB pen drive will be defined during the mount operation of that pen drive. Thus, if you do not specify the read/write/execute access permissions to this pen drive during mount operation of the FAT formatted USB pen drive, it will by default mount as readable/writable only for the super user (root).

So, if you intend to use the USB drive exclusively with a Linux machine, it is much more advisable to format that USB pen drive as a ext4 filesystem format. This way, there does not need a requirement to have the USB pen drive content accessible only through root permissions i.e. in other words, your USB pendrive contents will then become accessible to everyone, including those who do not have root privileges.

Hope this helps!