linux mount挂接新硬盘/光盘/U盘/移动硬盘/ISO并加载使用手记
================================================================================
一、过程步骤
1、#kudzu //检测新硬件,这一步必须!
2、#fdisk -l //查看是否找到新的硬盘,查看硬盘代号。
3、#fdisk /dev/sdb //为新硬盘分区,例如分成sdb1
#mkfs.ext3 /dev/sdb1 //把新硬盘格式化成ext3格式
4、#mkdir /disk2 //创建新的挂载点
5、#mount /dev/sdb1 /disk2/ //手动挂载分区,把硬盘挂到/disk2目录下。
6、#vi /etc/fstab
/dev/sdb1 /disk2 ext3 auto 1 2 //设置为开机自动挂载分区。
二.详细过程
2、
查看硬盘代号
[root@AMD-LINUX ~]# fdisk -l
Disk /dev/sda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0×0007d856
Device Boot Start End Blocks Id System
/dev/sda1 * 1 25 200781 83 Linux
/dev/sda2 26 1305 10281600 8e Linux LVM
Disk /dev/sdb: 2147 MB, 2147483648 bytes <=新硬盘255 heads, 63 sectors/track, 261 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesDisk identifier: 0×00000000Disk /dev/sdb doesn’t contain a valid partition tableDisk /dev/dm-0: 9395 MB, 9395240960 bytes255 heads, 63 sectors/track, 1142 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesDisk identifier: 0×00000000Disk /dev/dm-0 doesn’t contain a valid partition tableDisk /dev/dm-1: 1073 MB, 1073741824 bytes255 heads, 63 sectors/track, 130 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesDisk identifier: 0×30307800Disk /dev/dm-1 doesn’t contain a valid partition table3、fdisk 分区[root@AMD-LINUX ~]# fdisk /dev/sdbDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabelBuilding a new DOS disklabel with disk identifier 0×623223a1.Changes will remain in memory only, until you decide to write them.After that, of course, the previous content won’t be recoverable.Warning: invalid flag 0×0000 of partition table 4 will be corrected by w(rite)Command (m for help): p <=显示信息Disk /dev/sdb: 2147 MB, 2147483648 bytes255 heads, 63 sectors/track, 261 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesDisk identifier: 0×623223a1Device Boot Start End Blocks Id SystemCommand (m for help): n <=新建分区Command actione extendedp primary partition (1-4)p <=新建主分区Partition number (1-4): 1 <=分区号为1,即/dev/sdb1First cylinder (1-261, default 1):Using default value 1Last cylinder or +size or +sizeM or +sizeK (1-261, default 261):Using default value 261Command (m for help): p <=显示分区信息Disk /dev/sdb: 2147 MB, 2147483648 bytes255 heads, 63 sectors/track, 261 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesDisk identifier: 0×623223a1Device Boot Start End Blocks Id System/dev/sdb1 1 261 2096451 83 LinuxCommand (m for help): w <=保存退出The partition table has been altered!Calling ioctl() to re-read partition table.Syncing disks.4、创建挂载点[root@AMD-LINUX ~]# mkdir /disk2[root@AMD-LINUX ~]# fdisk -lDisk /dev/sda: 10.7 GB, 10737418240 bytes255 heads, 63 sectors/track, 1305 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesDisk identifier: 0×0007d856Device Boot Start End Blocks Id System/dev/sda1 * 1 25 200781 83 Linux/dev/sda2 26 1305 10281600 8e Linux LVMDisk /dev/sdb: 2147 MB, 2147483648 bytes255 heads, 63 sectors/track, 261 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesDisk identifier: 0×623223a1Device Boot Start End Blocks Id System/dev/sdb1 1 261 2096451 83 LinuxDisk /dev/dm-0: 9395 MB, 9395240960 bytes255 heads, 63 sectors/track, 1142 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesDisk identifier: 0×00000000Disk /dev/dm-0 doesn’t contain a valid partition tableDisk /dev/dm-1: 1073 MB, 1073741824 bytes255 heads, 63 sectors/track, 130 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesDisk identifier: 0×30307800Disk /dev/dm-1 doesn’t contain a valid partition table[root@AMD-LINUX ~]# mke2fs -j /dev/sdb1mke2fs 1.40.2 (12-Jul-2007)Filesystem label=OS type: LinuxBlock size=4096 (log=2)Fragment size=4096 (log=2)262144 inodes, 524112 blocks26205 blocks (5.00%) reserved for the super userFirst data block=0Maximum filesystem blocks=53687091216 block groups32768 blocks per group, 32768 fragments per group16384 inodes per groupSuperblock backups stored on blocks:32768, 98304, 163840, 229376, 294912Writing inode tables: doneCreating journal (8192 blocks): doneWriting superblocks and filesystem accounting information: doneThis filesystem will be automatically checked every 36 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
5、设置为开机自动挂载分区
[root@AMD-LINUX ~]# vi /etc/fstab
/dev/sdb1 /disk2 ext3 auto 1 2
6、手动挂载分区
[root@AMD-LINUX ~]# mount /dev/sdb1 /disk2
补充说明:
1/ windows 共享挂接
mount -t smbfs -o username=administrator,password=pldy123 //10.140.133.23/c$ /mnt/samba
2/ 挂接U盘
mount -t vfat /dev/sdd1 /mnt/usb
3/ 挂接移动硬盘
mount -t ntfs -o iocharset=cp936 /dev/sdc1 /mnt/usbhd1
-o iocharset=cp936 如果不乱码可以不加
4/ 从光盘制作光盘镜像文件
#cp /dev/cdrom /home/sunky/mydisk.iso 或
#dd if=/dev/cdrom of=/home/sunky/mydisk.iso
5/ 将文件和目录制作成光盘镜像文件
mkisofs -r -J -V mydisk -o /home/sunky/mydisk.iso /home/sunky/mydir
注:这条命令将/home/sunky/mydir目录下所有的目录和文件制作成光盘镜像文件/home/sunky/mydisk.iso,光盘卷标为:mydisk
6/ 挂接光盘文件
mount -o loop -t iso9660 /home/sunky/mydisk.iso /mnt/vcdrom
开心洋葱 , 版权所有丨如未注明 , 均为原创丨未经授权请勿修改 , 转载请注明linux mount挂接新硬盘/光盘/U盘/移动硬盘/ISO并加载使用手记!