简体   繁体   English

显示fat32 usb磁盘的卷标?

[英]Show the volume label of a fat32 usb disk?

In my case, I modify the volume label of a fat32 usb disk as "usb 磁盘“(with chinese chars) with windows system. 就我而言,我在Windows系统中将fat32 usb磁盘的卷标修改为“ usb磁盘”(带有中文字符)。

Then I plug the usb disk in a ubuntu(13.04), 然后我将USB磁盘插入ubuntu(13.04),

ls /dev/disk/by-label

shows "USB\\x20\\xb4\\xc5\\xc5\\xcc". 显示“ USB \\ x20 \\ xb4 \\ xc5 \\ xc5 \\ xcc”。

or, I use udev rules to auto mount the external usb disk, on a angstrom beaglebone. 或者,我使用udev规则自动将外部usb磁盘挂载到Angle beaglebone上。

IMPORT{program}="/sbin/blkid -o udev -p %N"
ENV{ID_FS_LABEL}!="", ENV{mount_point}="/media/%E{ID_FS_LABEL}"
ACTION=="add", RUN+="/bin/mkdir -p %E{mount_point}", RUN+="/bin/mount -o iocharset=utf8 /dev/%k %E{mount_point}"

I get a "/media/USB_ _ _" mount point. 我得到一个“ / media / USB_ _ _”安装点。

How can I get the right volume label? 如何获得正确的卷标?

Test a ntfs and ext3 usb disk is fine. 测试一个ntfs和ext3 usb磁盘是否正常。

FAT, VFAT, and FAT32 don't seem to use unicode filenames -- at least not as I understand it. FAT,VFAT和FAT32似乎不使用unicode文件名-至少不是我所理解的那样。 They can use most characters from "OEM" code pages (which I don't completely understand), but even then there are many characters that can't be displayed. 他们可以使用“ OEM”代码页中的大多数字符(我不完全了解),但是即使那样,仍有许多字符无法显示。

It is explained in this Microsoft page: http://msdn.microsoft.com/en-us/library/windows/desktop/dd317748%28v=vs.85%29.aspx 在此Microsoft页中对此进行了说明: http : //msdn.microsoft.com/zh-cn/library/windows/desktop/dd317748%28v=vs.85%29.aspx

"NTFS stores file names in Unicode. In contrast, the older FAT12, FAT16, and FAT32 file systems use the OEM character set. For more information, see Code Pages. “ NTFS使用Unicode存储文件名。相比之下,较早的FAT12,FAT16和FAT32文件系统使用OEM字符集。有关更多信息,请参见代码页。

"Non-Unicode applications that create FAT files sometimes have to use the standard C runtime library conversion functions to translate between the Windows code page character set and the OEM code page character set. With Unicode implementations of the file system functions, it is not necessary to perform such translations. “创建FAT文件的非Unicode应用程序有时必须使用标准的C运行时库转换函数来在Windows代码页字符集和OEM代码页字符集之间进行转换。使用文件系统功能的Unicode实现,则不需要执行此类翻译。

"Your application can use generic string types, as described in Windows Data Types for Strings. The application can also use generic function prototypes using techniques described in Conventions for Function Prototypes. For either generic string types or generic function prototypes, your application can use a single source file to compile either a Unicode or a non-Unicode version. To allow for this, the application provides macros for functions that are not invoked when compiling for Unicode. “您的应用程序可以使用通用字符串类型,如Windows字符串数据类型中所述。该应用程序还可以使用函数原型约定中所述的技术来使用通用函数原型。对于通用字符串类型或通用函数原型,您的应用程序都可以使用单个源文件以编译Unicode或非Unicode版本,为此,应用程序提供了针对Unicode编译时未调用的函数的宏。

"In both NTFS and FAT file systems, the special file name characters are: '\\', '/', '.', '?', and '*'. On OEM code pages, these special characters are in the ASCII range of characters (0x00 through 0x7F). Their Unicode equivalents are the same values in a 2-byte form, 0x0000 through 0x007F. “在NTFS和FAT文件系统中,特殊文件名字符为:'\\','/','。','?'和'*'。在OEM代码页上,这些特殊字符在ASCII范围内字符(0x00到0x7F),它们的Unicode等效值是2字节形式的相同值,即0x0000到0x007F。

" Caution Windows code page and OEM code page character sets used on Japanese-language operating systems contain the Yen symbol (¥) instead of a backslash (\\). Thus, the Yen symbol is a prohibited character for NTFS and FAT file systems. When mapping Unicode to a Japanese-language code page, WideCharToMultiByte and other conversion functions map both backslash (U+005C) and the normal Unicode Yen symbol (U+00A5) to this same character. For security reasons, your applications should not typically allow the character U+00A5 in a Unicode string that might be converted for use as a FAT file name. For more information, see Security Considerations: International Features." “日语操作系统上使用的警告 Windows代码页和OEM代码页字符集包含日元符号(¥)而不是反斜杠(\\)。因此,日元符号是NTFS和FAT文件系统的禁止字符。将Unicode映射到日语代码页,WideCharToMultiByte和其他转换函数将反斜杠(U + 005C)和常规Unicode日元符号(U + 00A5)都映射到同一字符。出于安全原因,您的应用程序通常不应允许Unicode字符串中的字符U + 00A5,可以转换为FAT文件名。有关更多信息,请参见安全性注意事项:国际功能。

This Wikipedia page: http://en.wikipedia.org/wiki/Comparison_of_file_systems makes it a little clearer 此Wikipedia页面: http : //en.wikipedia.org/wiki/Comparison_of_file_systems使其更加清晰

"Any byte except for values 0-31, 127 (DEL) and: " * / : < > ? “除值0-31、127(DEL)和:“ * /:<>? \\ | \\ | + , . +,。 ; ; = [] (lowcase az are stored as AZ). = [](小写字母az存储为AZ)。 With VFAT LFN any Unicode except NUL" 使用VFAT LFN时,除NUL以外的任何Unicode都可以。

Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM