How to mount the FAT32 format USB device under Linux

Source: Internet
Author: User

Hang u before the disk, run the command Cat/proc/partitions, See what partitions are present in the system. After inserting the U - disk, run the above command again to see what partition is coming out . is usually sda1.

1 , inserting U Disk

2 , input fdisk-l/DEV/SDA Look at the results of the output, such as mine:

[Email protected] proc]# fdisk-l/DEV/SDA

disk/dev/sda:2004 MB, 2004877312 bytes

247 heads, Sectors/track, 255 cylinders

Units = Cylinders of 15314 * 7840768 bytes

Device Boot Start End Blocks Id System

/DEV/SDA1 * 1 1957856 C W95 FAT32 (LBA)

Partition 1 has different physical/logical beginnings (Non-linux?):

phys= (0, 1, 1) logical= (0, 1, 3)

Partition 1 has different physical/logical endings:

phys= (505, 246, 0) logical= (255, 172, 42)

Partition 1 does not end on cylinder boundary.

[Email protected] proc]# mount-t vfat/dev/sda1/mnt/usb/

3 , look at the above output to know U The device on which the disk is located, such as mine is /dev/sda1 , then the mount, assuming I will U disk mount to /mnt/usb contents ( no, new ) , yes.

if it is FAT16 just use the following command

Mount-t Msdos/dev/sda1/mnt/usb

if it is FAT32

Mount-t Vfat/dev/sda1/mnt/usb

if it is ext2 format, just use the command:

Mount-t Ext2/dev/sda1/mnt/usb

4 , open /mnt/usb I can see you. U something on the plate!

Cd/mnt/usb

Specific commands:

1. Add -on FAT32 file System

The simplest usage

mount/dev/hda6/mnt/d

/dev/hda6 is the author Windows of the D disk, /mnt/d is the directory plus hang point. Linux recognizes What the file system type of the/DEV/HDA6 partition is and then hangs it. Of course, you can also specify the file system type of the partition, with the following command:

Mount-t vfat/dev/hda6/mnt/d

In the actual operation, directly add a Windows partition, the Chinese file name and directory name will be garbled, in order to avoid this situation can specify the character set, the command is as follows:

MOUNT/DEV/HDA6/MNT/D-O codepage=936,iocharset=cp936

Mount-t vfat/dev/hda6/mnt/d-O codepage=936,iocharset=cp936

Note: cp936 It means Simplified Chinese, cp950 it means traditional Chinese.

2. plus hang NTFS file system

in the current majority of Linux version, you need to recompile Linux core talent, plus hang NTFS Partitioning ( See other articles for compiling methods ) . After the core supports NTFS , you can mount it with the following command:

Mount-t ntfs/dev/hda2/mnt/c

also for Chinese file names and directory names will be garbled problems can be specified character set, but with the addition of hanging VFAT partition, the actual use of the command is feasible:

Mount-t Ntfs-o iocharset=cp936/dev/hda2/mnt/c-R

Mount-t Ntfs-o iocharset=cp936,rw/dev/hda2/mnt/c

3. attach The file system on the U-disk

now useUmore and more people on the plate, in factLinuxunder UseUthe disk is also very simple,LinuxtheUSBThe device has good support when you insertUafter the disk,Udisk is recognized as aSCSIusually you can hang it with the following commandUthe file system on the disk

Mount/dev/sda1/usb

also for the Chinese file name and directory name will be garbled problem can specify a character set, the command is similar to the above FAT32 introduced by:

Mount/dev/sda1/usb-o pagecode=936,iocharset=cp936

4. Add a directory to the Linux system shared by Samba

Use Samba The shared directory is really hard to say what kind of filesystem it was, but it's not important, as long as it's transparent to the user. When hanging, we specify the type of smbfs, when the partition of the samba shared, also appear in Chinese file name and directory name garbled situation, can be hung with the following command:

Mount-t Smbfs-o

username=terry,password=terry,codepage=936,iocharset=cp936

terry-linux/terry/mp3/

Mount-t Smbfs-o

username=terry,password=terry,codepage=936,iocharset=cp936

192.168.100.228/terry/mp3/

Note: You can not write directly Password=terry This parameter, the system interface will ask you to enter a password, so that you can prevent someone directly see your password. Depending on the situation, The parameters after-O can be increased or decreased.

5. Add -on Window system shared directory

in a local area network, it is often necessary to access other Windows the system shares out the directory, in Linux , install the Samba you can use it later Samba to access the command in the Windows shared resources of the machine.

with smbclient to List Windows shared resources for machines

Smbclient-l 192.168.100.111

according to the above list Windows shared resources, you can choose to attach to the local Linux in the Windows shared resources, and then use the Smbmount or Mount to add a hang, please refer to the following several commands:

Smbmount//192.168.100.111/public/public/

Mount//192.168.100.111/d/mnt/cdrom-o username=terry ( to enter the password at the command line )

Mount//192.168.100.111/d/mnt/cdrom-o username=terry$1234 ( so you don't have to enter a password at the command line )

Note: In addition to the command-line methods described above, the best way to do this is to use other clients, such as Linneighborhood , networkneighbours , Ksmbshare etc., please refer to other articles.

All of the above is the command line, each use to enter once, if you often want to hang some file system, you want to automatically when the startup should be how to do? Two methods are described below:

Method 1.

Put the attached command on the /etc/rc.d/rc.local the.

Method 2.

Modifying a partition configuration file /etc/fstab , put the file system on at startup, here's my /etc/fstab File:

label=//ext3 Defaults

1 1

None/dev/pts devpts gid=5,mode=620

0 0

Label=/home/home ext3 Defaults

0 S

NONE/PROC proc Defaults

0 0

NONE/DEV/SHM TMPFS Defaults

0 0

/DEV/HDA4 Swap swap Defaults

0 0

/dev/cdrom/mnt/cdrom iso9660

Noauto,owner,kudzu,ro 0 0

/dev/hda2/ntfs NTFS defaults,iocharset=cp936 0 0

/dev/hda6/win vfat defaults,codepage=936,iocharset= cp936 0 0

192.168.100.228/terry/mp3 Smbfs username=terry,password=terry,codepage=cp936,iocharset=cp936 0 0

Please note the last three lines:

line Fourth, put my C disk, NTFS format of

The third line, add my D disk, FAT32 format of

The second-to-last line, plus the other one installed on my LAN Samba of the Linux a directory on the file server.

all of the above commands must be Root identity to execute

Run out U after the disk, remember to uninstall it to pull out U disk, operate as follows:

# umount-l/mnt/usb

How to mount the FAT32 format USB device under Linux

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.