Task: mount a disk with an NTFS file system (i.e., from Windows) on Linux (Debian or CentOS). The problem is that the files and folders on the disk are named in Russian, and not in UTF-8 (nor in KOI8-R) but in CP1251 (the Windows encoding).
If you just mount it as-is, you'll see either garbled characters or plain question marks instead of the Russian characters in file and folder names.
1) Let's install the needed locale into our system (if it's already installed, nothing bad will happen). Don't worry - this command won't set CP1251 as the default locale; it will only make the locale available for use.
$ sudo localedef --no-archive -c -f CP1251 -i ru_RU ru_RU.CP1251
2) Let's mount the disk with CP1251 support
$ sudo mount -t ntfs-3g -o locale=ru_RU.CP1251 /dev/sdb1 /mnt
Here, instead of /dev/sdb1 use the device name under which your NTFS disk is located. And instead of /mnt use the folder into which you want to mount this disk.
That's it, basically - the disk is mounted and you can work with it.
3) If you need the disk to be mounted at system startup, add the following entry to the fstab file:
/dev/sdb1 /mnt ntfs-3g locale=ru_RU.CP1251 0 0
Here, as before, you need to adjust the mount folder path and the disk name in /dev.
Comments