Linux

為什麼我不能重命名隨身聽上的目錄?

  • October 23, 2019
$ lsblk -o+FSTYPE /dev/sdc1
NAME MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT     FSTYPE
sdc1   8:33   1  3.7G  0 part /mnt/bart_sdc1 vfat
$ cd /mnt/bart_sdc1
$ file dvorak-walzes
dvorak-walzes: directory
$ ls -dl dvorak-walzes
drwxrwxr-x 2 bart wheel 16384 Oct 23 14:03 dvorak-walzes
$ ls -dl .
drwxrwxr-x 13 bart wheel 32768 Jan  1  1970 .
$ mv /mnt/bart_sdc1/{d,D}vorak-walzes
mv: cannot move '/mnt/bart_sdc1/dvorak-walzes' to a subdirectory of itself,
'/mnt/bart_sdc1/Dvorak-walzes/dvorak-walzes'
$ type mv
mv is /usr/bin/mv
$ uname -rsv
Linux 5.3.7-arch1-1-ARCH #1 SMP PREEMPT Fri Oct 18 00:17:03 UTC 2019

FAT 文件系統的(驅動程序)不區分大小寫,含義dvorak-walzes等同於Dvorak-walzes,這就是為什麼您會收到以下投訴mv

mv: 無法將 ‘/mnt/bart_sdc1/dvorak-walzes’ 移動到其自身的子目錄中

Linux Kernel VFAT 文件的一部分說:

check=s|r|n   -- Case sensitivity checking setting.
                 s: strict, case sensitive
                 r: relaxed, case insensitive
                 n: normal, default setting, currently case insensitive

引用自:https://unix.stackexchange.com/questions/548329