Disk image files, mobile hard drives, USB flash drives, Windows and NFS network sharing in linux
Source: Internet
Author: User
Mount command format: mount [-tvfstype] [-ooptions] devicedir Where: 1.-tvfstype specifies the type of the file system, which is usually not required. Mount automatically selects the correct type. Common types include: CD or CD Image: iso9660...
Mount command format: mount [-t vfstype] [-o options] device dir where: 1.-t vfstype specifies the type of the file system, which is usually not required. Mount automatically selects the correct type. Common types include: Optical disc or optical disc image: iso9660 DOS fat16 file system: msdos Windows 9x fat32 file system: vfat Windows NT ntfs file system: ntfs Mount Windows File network sharing: smbfs UNIX (LINUX) file network sharing: nfs2.-o options is mainly used to describe the mounting method of a device or file. Commonly used parameters include: loop: used to mount a file as a hard disk partition to the system ro: Use read-only mode to mount the device rw: Use read/write mode to mount the device iocharset: specify the character set used to access the file system 3. the device to mount. 4. mount point of the dir device on the system ). In Windows, many people are used to making software and materials into disc image files and using virtual optical drives. In linux, it is more convenient to create and use a CD image than in Windows, without the need to borrow any third-party software packages. 1. create a CD image file from the CD. Put the CD in the optical drive and execute the following command. # Cp/dev/cdrom/home/sunky/mydisk. iso or # dd if =/dev/cdrom f =/home/sunky/mydisk. iso note: execute any of the above commands to make the current optical drive into a CD image file/home/sunky/mydisk. iso2, make the files and directories into a CD image file, and execute the following command. # Mkisofs-r-J-V mydisk-o/home/sunky/mydisk. iso/home/sunky/mydir note: this command creates all the directories and files in the/home/sunky/mydir directory into a CD image file/home/sunky/mydisk. iso, the disc size is: mydisk3, the disk image file mount # mkdir/mnt/vcdrom note: create a directory for mount point) # mount-o loop-t iso9660/home/sunky/mydisk. iso/mnt/vcdrom Note: Use/mnt/vcdrom to access the disk image file mydisk. all the files in iso. For linux systems, USB-connected mobile hard disks are treated as SCSI devices. Before inserting a mobile hard disk, use fdisk-l or more/proc/partitions to view the system's hard disk and hard disk partition. [Root at pldyrouter/] # fdisk-l here we can clearly see that the system has a SCSI hard disk/dev/sda and its four disk partitions/dev/sda1 --/dev/sda4, /dev/sda5 is the logical partition of/dev/sda4. After the mobile hard drive is connected, use fdisk-l or more/proc/partitions to view the system's hard disk and hard disk partition [root at pldyrouter/] # fdisk-l you should be able to find a SCSI hard disk/dev/sdc and its two disk partitions/dev/sdc1? /Dev/sdc2, where/dev/sdc5 is the logical partition of the/dev/sdc2 partition. We can use the following command to mount/dev/sdc1 and/dev/sdc5. # Mkdir-p/mnt/usbhd1 # mkdir-p/mnt/usbhd2 note: create a directory for mount point) # mount-t ntfs/dev/sdc1/mnt/usbhd1 # mount-t vfat/dev/sdc5/mnt/usbhd2 note: the-t ntfs parameter should be used for disk partitions in ntfs format, and The-t vfat parameter should be used for disk partitions in fat32 format. If the Chinese character file name is garbled or not displayed, you can use the following command format. # Mount-t ntfs-o iocharset = cp936/dev/sdc1/mnt/usbhd1 # mount-t vfat-o iocharset = cp936/dev/sdc5/mnt/usbhd2linux use fdisk the partition command and the mkfs file system creation command can make the partition of the mobile hard disk into the ext2 and ext3 formats specific to the linux system. In this way, it is more convenient to use in linux. Use the following command to directly mount the file. # Mount/dev/sdc1/mnt/USB HD1 mount a USB flash disk like a USB mobile hard disk. for linux systems, the USB flash disk is treated as a SCSI device. The usage is exactly the same as that of a mobile hard disk. Before inserting a USB flash drive, use fdisk-l or more/proc/partitions to view the hard disk and hard disk partition of the system. [Root at pldyrouter root] # After fdisk-l is inserted into the USB flash disk, use fdisk-l or more/proc/partitions to view the hard disk and hard disk partitions of the system. [Root at pldyrouter root] # a scsi hard disk/dev/sdd and a disk partition/dev/sdd1 are added to the fdisk-l System./dev/sdd1 is the USB disk to be attached. # Mkdir-p/mnt/usb note: create a directory for mount point # mount-t vfat/dev/sdd1/mnt/usb note: you can now access the usb flash drive through/mnt/usb. if the Chinese character file name is garbled or not displayed, use the following command. # Mount-t vfat-o iocharset = cp936/dev/sdd1/mnt/usb mount Windows file sharing the core of Windows network sharing is SMB/CIFS. mount) to share windows disks, you must install and use the samba software package. Currently, most popular linux distributions already contain samba packages. if samba is not installed on linux, install samba first. Of course, you can download the new version 3.0.10 from the official website www.samba.org. After windows system sharing is configured, you can mount the file on the linux client. the specific operation is as follows: # mkdir-p/mnt/samba note: create a directory for mount point # mount-t smbfs-o username = administrator, password = pldy123/10.140.133.23/c $/mnt/samba note: administrator and pldy123 are user names and passwords of windows computers whose IP addresses are 10.140.133.23, c $ is a disk shared by this computer so that files on windows disks can be accessed through/mnt/samba on linux. The preceding operations are successfully performed in redhat asserver3, redflag server 4.1, suse server 9, windows NT 4.0, windows 2000, windows xp, and windows 2003 environments. NFS file sharing for mounted UNIX systems is similar to windows network sharing. for UNIX (Linux) systems, they also have their own network sharing, that is, NFS (Network File System ), next we will take SUN Solaris2.8 and REDHAT as server 3 as an example to briefly introduce how to mount nfs network sharing in linux. Before mounting an NFS disk to a linux client, you must configure the NFS server. 1. configure the NFS server of the Solaris system as follows: (1) modify/etc/dfs/dfstab and add the shared directory share-F nfs-o rw/export/home/sunky (2) start the nfs service #/etc/init. d/nfs. server start (3) after the NFS service is started, you can also use the following command to add a new share # share/export/home/sunky1 # share/export/home/sunky2 note: /export/home/sunky and/export/home/sunky1 are shared directories. 2. configure NFS server in linux as follows: (1) modify/etc/exports, add the shared directory/export/home/sunky 10.140.133.23 (rw)/export/home/sunky1*(rw)/export/home/sunky2 linux-clie. Nt (rw) Note: sunky, sunky1, and sunky2 in the/export/home/directory are shared directories, 10.140.133.23, *, and linux-client are IP addresses or host names allowed to connect to the shared linux client. If you want to use the host name linux-client, you must add the linux-client host ip definition in the server host/etc/hosts file. Format: 10.140.133.23 linux-client (2) start and stop the NFS service/etc/rc. d/init. d/portmap start (PORTMAP is started by default in REDHAT)/etc/rc. d/init. d/nfs start the NFS service/etc/rc. d/init. d/nfs stop NFS service note: if a new share is added to the/etc/export file, stop the NFS service and then start the NFS service to enable the new share. The command exportfs-rv can also achieve the same effect. 3. mount the NFS share of other linux or UNIX systems on the linux client # mkdir-p/mnt/nfs note: create a directory for mount point) # mount-t nfs-o rw 10.140.133.9:/export/home/sunky/mnt/nfs note: Here we assume 10.140.133.9 is the host IP address of the NFS server. of course, the host name can also be used here, however, the server ip definition must be added to the local/etc/hosts file. /Export/home/sunky is the directory shared by the server. In this way, you can use/mnt/nfs on the linux client to access files shared by NFS on other linux or UNIX systems. The preceding operations are successfully performed in redhat as server 3, redflag server4.1, suse server 9, Solaris 7, Solaris 8, and Solaris 9 for x86 & iSCSI. Author ZHB_McCoy
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.