By default, the linux system can recognize the fat32 U disk, but it cannot recognize the U disk in the ntfs format.
The specific mounting method is as follows
1. Insert the U disk
2. mkdir /mnt/usb This command is used to create the directory to mount the USB disk, you only need to create it once, if it already exists, you don’t need to create it again
3、fdisk -l
Find the U disk path.
The sdb1, sdb2, and sdb5 shown in the above figure are the partition information of the U disk. The following mounts the sdb5 partition in fat32 format.
4、mount -t vfat /dev/sdb5 /mnt/usb
This command is to load the u disk in fat32 format, if it is in ext2 format, use the following command
mount -t ext2 /dev/sdb5 /mnt/usb
5. df -h, you can see that the u disk has been mounted on the system.
6. Next, you can access the information in the U disk through the path /mnt/usb.
7. After using the USB flash drive, you need to uninstall the USB flash drive. When uninstalling the USB flash drive, you need to ensure that the USB flash drive is not accessed by other programs, and you need to exit the directory where the USB flash drive is located.
The uninstall command is
umount /mnt/usb
If there is really no FAT32 U disk, how to mount the hard disk with NTFS file system
When using Linux , we often encounter the situation that the hard disk cannot be read. This is because the file system supported under Linux is different from that under Windows. Linux does not support the NTFS file system (the commonly used file system in Windows) by default. , to make Linux support NTFS, we can solve it by installing the driver.
- In order for the Linux server to recognize the NTFS mobile hard disk, the ntfs-3g (Third Generation Read/Write NTFS Driver) package must be installed.
1. What is NTFS-3G
- NTFS-3G is an open source project
- NTFS-3G is a stable, full-featured, NTFS driver for Linux, Android, Mac OS X, FreeBSD, NetBSD, OpenSolaris, QNX, Haiku and other operating systems .
- The purpose of NTFS-3G is for continuous development. Users of various hardware platforms and operating systems need reliable intercommunication and drivers that support NTFS.
- NTFS-3G can provide a reliable, feature-rich, high-performance solution. After more than 12 years of development, NTFS-3G has gradually stabilized.
- Information address:
– Official website: http://www.tuxera.com/,
– Document manual: http://www.tuxera.com/community/ntfs-3g-manual/
– Download address: Open source NTFS-3G, Reliance Edge, TUFS, POSIX, other contributions - Tuxera
2. Download and install NTFS-3G
- Download NTFS-3G
– Enter the official download address under Linux system Open source NTFS-3G, Reliance Edge, TUFS, POSIX, other contributions - Tuxera
– Enter the download path and find the downloaded file - Unzip and install
- Preparations: If gcc is not installed in your Linux, please install this library first. The installation command is as follows:
yum -y install gcc
- Installation steps:
– Unzip:tar -zxvf ntfs-3g_ntfsprogs-2017.3.23.tgz
– Enter the unzipped directory:cd ntfs-3g_ntfsprogs-2017.3.23
– Prepare before compiling:./configure
– Compile:make
– Install:make install
After that, the system will prompt that the installation is successful, and you can use ntfs-3g to read and write NTFS partitions
3. Mount and read NTFS hard disk
- Insert the hard disk and view the information of the NTFS partition
sudo fdisk -l | grep NTFS
[root@DB-Server klb]# sudo fdisk -l | grep NTFS
/dev/sdc1 * 1 244 1955776+ 7 HPFS/NTFS
- 1
- 2
- 3
- Set the mount point and use the following command to mount
- Create a new folder usb in the /mnt/ folder, enter the corresponding folder, and use the command:
mkdir usb
- Mount the hard disk, the command format is as follows:
mount -t ntfs-3g 移动硬盘的分区设备文件名 挂载点
- 1
- For example, the obtained NTFS partition information is /dev/sdc1, and the mount point is set under /mnt/usb, you can use
mount -t ntfs-3g /dev/sdc1 /mnt/usb
- 1
or use directly
ntfs-3g ntfs-3g /dev/sdc1 /mnt/usb
- 1
- To set automatic mount at boot, you can add the following format statement in /etc/fstab
ntfs-3g silent,umask=0,locale=zh_CN.utf8 0 0
- 1
In this way, the display of Chinese file names in the NTFS partition can be realized.
- Unmount partitions (use with caution)
umount 挂载文件夹