Problem
cp: cannot open '/media/router/media/2020/2020-08-26-Giant-stairs/DJI_0159.MP4' for reading: No such file or directory
The /media/router was mounted using below command.
sudo mount -t cifs -o username=<user name>,password=<pass>,vers=1.0 //192.168.1.1/USB_Media /media/router
The //192/168.1.1/USB_Media is the external hard disk connected to USB port in my router. That path is mounted into RasPi. The location is /mediate/router.
The destination is another mount where it has mounted an external disk directly connected to RasPi.
Troubleshooting
As I am now following more of scientific debugging, the first hypothesis was as follows.
Hypothesis 1 - The file doesn't exist
The immediate thing is to check whether the file exists by using the below command.
pi@raspberrypi:~ $ ls /media/router/media/2020/2020-08-26-Giant-stairs/DJI_0159.MP4
Hypothesis 2 - Not enough permissions on the file
Shows permissions properly. Now what?
yes, google. Went through a lot of links where cp fails on the different cases including NAS permissions etc...
Hypothesis 3 - ls command is not case sensitive but cp is
This is about questioning my Linux knowledge. Maybe the entire community where Linux file system is known for case sensitivity. I looked at each character in the path and figured one change. It is /Media, instead of /media when its coming second time in the path. The new command goes below
pi@raspberrypi:~ $ sudo cp /media/router/Media/2020/2020-08-26-Giant-stairs/DJI_0159.MP4 /media/usbadata64gb/share
It worked magically.
Findings
When I checked the ls command in the Linux file system, it is case sensitive. But in this particular mounted path, the ls command is not case sensitive but the cp command is. The cifs command options MAN page says there is a 'nocase' option if we want to avoid case sensitivity. By default, it's case sensitive.
This behavior seems known, below are some links.
https://superuser.com/questions/680492/mounts-arent-case-sensitive
https://bugzilla.redhat.com/show_bug.cgi?id=432837
https://unix.stackexchange.com/questions/521125/access-windows-shared-files-from-linux-case-insensitive
No comments:
Post a Comment