Note:
Environment: VMware workstation
System: centos6.2
The following operations are performed under root
1. USB flash disk mounting
Mkdir/mnt/usb // create a directory for attaching a usb flash drive
Fdisk-l // view the USB flash drive mounted in the system. If the system has a hard disk, sdb1 indicates your USB flash drive./dev/sdb1 indicates that the USB flash drive has been recognized by the machine,
Mount/dev/sdb1/mnt/usb // mount the usb flash drive/dev/sdb1 to the/mnt/usb directory.
Cd/mnt/usb // enter the usb flash drive directory to view the content in the usb flash drive.
Umount/mnt/usb or umount/dev/sdb1 // uninstall the usb flash drive
2. mount a mobile hard disk
We usually use the mobile hard disk is NTFS format, linux by default is not supported NTFS partition, so you need to install a third-party plug-in ntfs-3g in linux.
Install ntfs-3g
Yum install gcc // install the compiler, always press Y, if you do not install gcc after the compilation of ntfs-3g will fail, gcc is a language lonux System Programming compiler,
Mkdir/usr/local/ntfs3g // create the folder ntfs3g for subsequent compilation and installation of NTFS-3g
Cd/usr/local/src // default source code package storage location in linux; source code package compilation and installation bit
Set:/usr/local/software name
Wget http://tuxera.com/opensource/ntfs-3g_ntfsprogs-2011.4.12.tgz // download ntfs-3g
Tar zxvf ntfs-3g_ntfsprogs-2011.4.12.tgz // decompress ntfs-3g Software Package
Cd ntfs-3g_ntfsprogs-2011.4.12 // enter the unzipped folder, do not know the directory name available ls to view the directory name
./Configure -- prefix =/usr/local/ntf3g // compile and specify the installation directory/usr/local/ntf3g
Make & make install // compile and install
Cd // return the root directory
Rm-r-f ntfs-3g_ntfsprogs * // delete all files headed by ntfs-3g_ntfsprogs don't mention waking, '*' indicates matching all,-r recursive processing, processes all files and subdirectories under the specified directory, and-f forces the deletion of files or directories. Mount
Fdisk-l // check the mounting information to see if the system recognizes the mobile hard disk./dev/sda1 indicates the first partition of the first hard disk, /dev/sdb1 indicates the first partition of the second hard disk,
Disk/dev/sdb: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065*512 = 8225280 bytes
Sector size (logical/physical): 512 bytes/512 bytes
I/O size (minimum/optimal): 512 bytes/512 bytes
Disk identifier: 0x7ab8d700
Device Boot Start End Blocks Id System
/Dev/sdb1*1 5222 41945683 + 7 HPFS/NTFS
/Dev/sdb2 5223 10444 41945715 7 HPFS/NTFS
/Dev/sdb3 10445 15666 41945715 7 HPFS/NTFS
/Dev/sdb4 15667 19457 30451207 + 7 HPFS/NTFS
The above is my drive information
Cd/mnt // enter the Directory
Mkdir usb1 usb2 usb3 usb4 // create four directories to mount each partition of the mobile hard disk.
Mount command 1: ntfs-3g/dev/sdb1/mnt/usb1-o locale = ar_SA.UTF-8, red can also be changed to zh_CN.GBK, it is obvious that the use of a certain encoding for mounting, to prevent garbled; // mount each partition to the corresponding directory, and do not add the following parts
Ntfs-3g/dev/sdb2/mnt/usb2-o locale = ar_SA.UTF-8
Ntfs-3g/dev/sdb3/mnt/usb3-o locale = ar_SA.UTF-8
Ntfs-3g/dev/sdb4/mnt/usb4-o locale = ar_SA.UTF-8
Mount command 2:
Mount ntfs-3g/dev/sdb1/mnt/usb1
......
Ls // view mobile hard disk Information
Copy and backup files
Cp-r/web/mnt/usb1 // copy all files in the web directory to the/mnt/usb1 directory, that is, copy the files to the/dev/sdb1 partition mounted to the mobile hard disk.
Umount/dev/sdb1 or umount/mnt/usb1 // unmount the mounted mobile hard disk
Automatically mount the mobile hard drive at startup
---- Edit/etc/fstab
Cp/etc/fstab/etc/fstabbak // back up data before editing.
Vi/etc/fstab // edit the file, add the following information at the end of the file, and press G (shift + g) at the end of the jump file)
/Dev/sdb1/mnt/usb1 ntfs-3g defaults 0 0
/Dev/sdb2/mnt/usb2 ntfs-3g defaults 0 0
/Dev/sdb3/mnt/usb3 ntfs-3g defaults 0 0
/Dev/sdb4/mnt/usb4 ntfs-3g defaults 0 0
: Wq! // Save and exit. After restart, the system will automatically mount the mobile hard disk.