To mount USB mass storage device on CentOS 7, you need to add a package repository first and install some exfat utilities.
Check your attached devices by fdisk
In my case, I am planning to mount 10T Harddisk, and it it shown as 9.1T in /dev/hda2 like below when I run fdisk -l
# fdisk -l WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion. Disk /dev/sda: 10000.8 GB, 10000831348736 bytes, 19532873728 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk label type: gpt Disk identifier: 8EEF9C29-5082-4436-AF97-D99E6C49C7B0 # Start End Size Type Name 1 34 262177 128M Microsoft reser Microsoft reserved partition Partition 1 does not start on physical sector boundary. 2 264192 19532871679 9.1T Microsoft basic Basic data partition WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion. Disk /dev/sdb: 2000.4 GB, 2000398934016 bytes, 3907029168 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk label type: gpt Disk identifier: E453250C-A828-43E8-AC48-CBE474111F11 # Start End Size Type Name 1 2048 411647 200M EFI System EFI System Partition 2 411648 2508799 1G Microsoft basic 3 2508800 3907028991 1.8T Linux LVM Disk /dev/mapper/centos-root: 1982.3 GB, 1982261624832 bytes, 3871604736 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk /dev/mapper/centos-swap: 16.8 GB, 16844324864 bytes, 32899072 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes
Install exfat utilities
In order to mount that device in exfat, you will need to add package repository for exfat as following
# sudo yum install -y http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-1.el7.nux.noarch.rpm
Once you run above command, you will see below
Loaded plugins: fastestmirror nux-dextop-release-0-1.el7.nux.noarch.rpm | 9.6 kB 00:00:00 Examining /var/tmp/yum-root-LUgBEg/nux-dextop-release-0-1.el7.nux.noarch.rpm: nux-dextop-release-0-1.el7.nux.noarch Marking /var/tmp/yum-root-LUgBEg/nux-dextop-release-0-1.el7.nux.noarch.rpm to be installed Resolving Dependencies --> Running transaction check ---> Package nux-dextop-release.noarch 0:0-1.el7.nux will be installed --> Finished Dependency Resolution Dependencies Resolved ====================================================================================================================================================== Package Arch Version Repository Size ====================================================================================================================================================== Installing: nux-dextop-release noarch 0-1.el7.nux /nux-dextop-release-0-1.el7.nux.noarch 3.5 k Transaction Summary ====================================================================================================================================================== Install 1 Package Total size: 3.5 k Installed size: 3.5 k Downloading packages: Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : nux-dextop-release-0-1.el7.nux.noarch 1/1 Verifying : nux-dextop-release-0-1.el7.nux.noarch 1/1 Installed: nux-dextop-release.noarch 0:0-1.el7.nux Complete!
Once you added the repository, you can install it as following
# sudo yum install -y exfat-utils fuse-exfat
Followings are the ouputs in my case
Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile epel/x86_64/metalink | 9.1 kB 00:00:00 * base: mirror.opensourcelab.co.kr * epel: fedora.cs.nctu.edu.tw * extras: mirror.opensourcelab.co.kr * nux-dextop: mirror.li.nux.ro * remi-safe: mirrors.thzhost.com * updates: mirror.opensourcelab.co.kr base | 3.6 kB 00:00:00 epel | 4.7 kB 00:00:00 extras | 2.9 kB 00:00:00 mysql-connectors-community | 2.5 kB 00:00:00 mysql-tools-community | 2.5 kB 00:00:00 mysql57-community | 2.5 kB 00:00:00 nux-dextop | 2.9 kB 00:00:00 remi-safe | 3.0 kB 00:00:00 updates | 2.9 kB 00:00:00 (1/8): mysql-connectors-community/x86_64/primary_db | 62 kB 00:00:00 (2/8): mysql-tools-community/x86_64/primary_db | 76 kB 00:00:00 (3/8): mysql57-community/x86_64/primary_db | 224 kB 00:00:00 (4/8): updates/7/x86_64/primary_db | 3.0 MB 00:00:00 (5/8): epel/x86_64/updateinfo | 1.0 MB 00:00:00 (6/8): remi-safe/primary_db | 1.7 MB 00:00:01 (7/8): epel/x86_64/primary_db | 6.8 MB 00:00:02 (8/8): nux-dextop/x86_64/primary_db | 1.8 MB 00:00:02 Resolving Dependencies --> Running transaction check ---> Package exfat-utils.x86_64 0:1.2.7-1.el7.nux will be installed ---> Package fuse-exfat.x86_64 0:1.2.7-1.el7.nux will be installed --> Processing Dependency: libfuse.so.2(FUSE_2.6)(64bit) for package: fuse-exfat-1.2.7-1.el7.nux.x86_64 --> Processing Dependency: libfuse.so.2(FUSE_2.5)(64bit) for package: fuse-exfat-1.2.7-1.el7.nux.x86_64 --> Processing Dependency: libfuse.so.2(FUSE_2.2)(64bit) for package: fuse-exfat-1.2.7-1.el7.nux.x86_64 --> Processing Dependency: libfuse.so.2()(64bit) for package: fuse-exfat-1.2.7-1.el7.nux.x86_64 --> Running transaction check ---> Package fuse-libs.x86_64 0:2.9.2-11.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ====================================================================================================================================================== Package Arch Version Repository Size ====================================================================================================================================================== Installing: exfat-utils x86_64 1.2.7-1.el7.nux nux-dextop 58 k fuse-exfat x86_64 1.2.7-1.el7.nux nux-dextop 39 k Installing for dependencies: fuse-libs x86_64 2.9.2-11.el7 base 93 k Transaction Summary ====================================================================================================================================================== Install 2 Packages (+1 Dependent package) Total download size: 190 k Installed size: 574 k Downloading packages: (1/3): fuse-libs-2.9.2-11.el7.x86_64.rpm | 93 kB 00:00:00 warning: /var/cache/yum/x86_64/7/nux-dextop/packages/fuse-exfat-1.2.7-1.el7.nux.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID 85c6cd8a: NOKEY2 ETA Public key for fuse-exfat-1.2.7-1.el7.nux.x86_64.rpm is not installed (2/3): fuse-exfat-1.2.7-1.el7.nux.x86_64.rpm | 39 kB 00:00:01 (3/3): exfat-utils-1.2.7-1.el7.nux.x86_64.rpm | 58 kB 00:00:01 ------------------------------------------------------------------------------------------------------------------------------------------------------ Total 108 kB/s | 190 kB 00:00:01 Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-nux.ro Importing GPG key 0x85C6CD8A: Userid : "Nux.Ro (rpm builder) <rpm@li.nux.ro>" Fingerprint: 561c 96bd 2f7f dc2a db5a fd46 e98b fbe7 85c6 cd8a Package : nux-dextop-release-0-1.el7.nux.noarch (@/nux-dextop-release-0-1.el7.nux.noarch) From : /etc/pki/rpm-gpg/RPM-GPG-KEY-nux.ro Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : fuse-libs-2.9.2-11.el7.x86_64 1/3 Installing : fuse-exfat-1.2.7-1.el7.nux.x86_64 2/3 Installing : exfat-utils-1.2.7-1.el7.nux.x86_64 3/3 Verifying : fuse-libs-2.9.2-11.el7.x86_64 1/3 Verifying : exfat-utils-1.2.7-1.el7.nux.x86_64 2/3 Verifying : fuse-exfat-1.2.7-1.el7.nux.x86_64 3/3 Installed: exfat-utils.x86_64 0:1.2.7-1.el7.nux fuse-exfat.x86_64 0:1.2.7-1.el7.nux Dependency Installed: fuse-libs.x86_64 0:2.9.2-11.el7 Complete!
Format and label
Format in exfat
# mkfs.exfat /dev/sda2
Once formatting is started, you will see below results
mkexfatfs 1.2.7 Creating... done. Flushing... done. File system created successfully.
Give label to partition as following - this is very import !!
# exfatlabel /dev/sda2 EX_PART
Mount
Create a folder in some nice location
# mkdir /mnt/10T
And you can simply mount it as following
mount /dev/sda2 /mnt/10T
Auto-mount USB mass storage while booting
The first thing what I tried is to get UUID for the required disk partition by ls -al /dev/disk/by-uuid/ as following
# ls -al /dev/disk/by-uuid/
Then you will see the table like below
drwxr-xr-x 2 root root 140 Jul 13 13:58 . drwxr-xr-x 8 root root 160 Jul 13 13:58 .. lrwxrwxrwx 1 root root 10 Jul 13 13:58 0C80-DEDB -> ../../sda1 lrwxrwxrwx 1 root root 10 Jul 13 13:58 2e3fddc0-f6db-4b5b-a4b1-f8cd51da5095 -> ../../dm-1 lrwxrwxrwx 1 root root 10 Jul 13 13:58 8a27fe79-e520-4eff-bf2d-69088cb95b83 -> ../../dm-0 lrwxrwxrwx 1 root root 10 Jul 13 13:58 9096-6D1E -> ../../sdb2 lrwxrwxrwx 1 root root 10 Jul 13 13:58 dd68fbad-bf99-4fd7-aee4-76fb8c0323f9 -> ../../sda2
In my case, I tried to mount /dev/sda2 above and its UUID is 636e9a0f-5fdf-43ca-8158-8f1af0a84f29, and I it at /etc/fstab like below:
UUID=9096-6D1E /mnt/10T ext4 defaults 0 0
What I intended is to mount the partition having the UUID like above to /mnt/10T, and it worked as I wanted.