当前位置:文档之家› linux挂载阵列

linux挂载阵列

1.在linux机器上使用磁阵当磁阵配置完毕后,该磁阵在linux操作系统看来,就是一个磁盘,即外接磁阵或内置磁盘在linux机器上的使用是完全相同的。

在/dev目录下应能看见该磁阵的设备文件。

例如,在linux 机器上原只有一个SCSI磁盘/dev/sda,现在增加了一个SCSI磁阵dev/sdb,这个/dev/sdb设备文件就是已同linux机器连接的磁阵。

如果看不到该设备文件,则需查找原因。

如果linux机器不在运行业务,应重启机器。

要能够使用磁阵(磁盘),必须要经过3个步骤:磁盘分区,分区格式化,文件系统挂载到某一目录。

(1)磁盘分区先检查所有linux已识别的所有磁盘的状态:[root@ftpnode2 ~]# fdisk -lDisk /dev/sda: 146.6 GB, 146685296640 bytes255 heads, 63 sectors/track, 17833 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesDevice Boot Start End Blocks Id System/dev/sda1 * 1 13 104391 83Linux/dev/sda2 14 17833 143139150 8eLinux LVMDisk /dev/sdb: 1796.7 GB, 1796776919040 bytes255 heads, 63 sectors/track, 218445 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesDisk /dev/sdb doesn't contain a valid partition table磁阵/dev/sdb还没有分区,需要对其进行分区。

本操作因为要把整个磁阵的容量都放在一个目录下使用,所以只配置一个分区。

[root@ftpnode2 ~]# fdisk /dev/sdbDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabelBuilding a new DOS disklabel. Changes will remain in memory only,until you decide to write them. After that, of course, the previouscontent won't be recoverable.The number of cylinders for this disk is set to 218445.There is nothing wrong with that, but this is larger than 1024,and could in certain setups cause problems with:1) software that runs at boot time (e.g., old versions of LILO)2) booting and partitioning software from other OSs(e.g., DOS FDISK, OS/2 FDISK)Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)Command (m for help): mCommand actiona toggle a bootable flagb edit bsd disklabelc toggle the dos compatibility flagd delete a partitionl list known partition typesm print this menun add a new partitiono create a new empty DOS partition tablep print the partition tableq quit without saving changess create a new empty Sun disklabelt change a partition's system idu change display/entry unitsv verify the partition tablew write table to disk and exitx extra functionality (experts only)Command (m for help): nCommand actione extendedp primary partition (1-4)pPartition number (1-4):First cylinder (1-218445, default 1): 1Last cylinder or +size or +sizeM or +sizeK (1-218445, default 218445): 200000Command (m for help): pDisk /dev/sdb: 1796.7 GB, 1796776919040 bytes255 heads, 63 sectors/track, 218445 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesDevice Boot Start End Blocks Id System/dev/sdb1 1 200000 1606499968+ 83 LinuxCommand (m for help): wThe partition table has been altered!Calling ioctl() to re-read partition table.Syncing disks.[root@ftpnode2 ~]#分区后的检查:[root@ftpnode2 ~]# fdisk -lDisk /dev/sda: 146.6 GB, 146685296640 bytes255 heads, 63 sectors/track, 17833 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesDevice Boot Start End Blocks Id System/dev/sda1 * 1 13 104391 83 Linux/dev/sda2 14 17833 143139150 8e Linux LVMDisk /dev/sdb: 1796.7 GB, 1796776919040 bytes255 heads, 63 sectors/track, 218445 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesDevice Boot Start End Blocks Id System/dev/sdb1 1 200000 1606499968+ 83 Linux[root@ftpnode2 ~]#磁阵/dev/sdb的分区已经完成,分区设备名为/dev/sdb1,容量为1800GB。

(2)分区格式化linux用于文件/目录读写的文件系统均为ext3的格式/类型,将分区/dev/sdb1用下面的命令格式化为ext3的文件系统格式:[root@ftpnode2 ~]# mkfs.ext3 /dev/sdb1mke2fs 1.35 (28-Feb-2004)Filesystem label=OS type: LinuxBlock size=4096 (log=2)Fragment size=4096 (log=2)200818688 inodes, 401624992 blocks20081249 blocks (5.00%) reserved for the super userFirst data block=0Maximum filesystem blocks=40265318412257 block groups32768 blocks per group, 32768 fragments per group16384 inodes per groupSuperblock backups stored on blocks:32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,102400000, 214990848Writing inode tables: doneCreating journal (8192 blocks): doneWriting superblocks and filesystem accounting information: doneThis filesystem will be automatically checked every 29 mounts or180 days, whichever comes first. Use tune2fs -c or -i to override.[root@ftpnode2 ~]#注:上述格式化未使用任何参数,均为默认值。

如果需要根据该磁阵实际存储对象进行优化的话,可使用相关参数让磁阵容量的利用最大化。

(3)文件系统挂载到某一目录挂载/dev/sdb1前,文件系统的检查:[root@ftpnode2 ~]# df -kFilesystem1K-blocks Used Available Use% Mounted on/dev/mapper/V olGroup00-LogV ol00138851328 3172424 128625592 3% / /dev/sda1 101086 13522 82345 15% /bootnone 517164 0 517164 0% /dev/shm[root@ftpnode2 ~]#将/dev/sdb1挂载到/unicom目录:[root@ftpnode2 ~]#mount /dev/sdb1 /unicom[root@ftpnode2 ~]#挂载/dev/sdb1后,文件系统的检查:[root@ftpnode2 ~]# df -kFilesystem 1K-blocks Used Available Use% Mounted on/dev/mapper/V olGroup00-LogV ol00138851328 3172424 128625592 3% //dev/sda1 101086 13522 82345 15% /bootnone 517164 0 517164 0% /dev/shm/dev/sdb1 1581292204 110656 1500856552 1% /unicom[root@ftpnode2 ~]#挂载后测试一下读/写/删除操作:cd /unicomdate > testcat ./testrm ./test最后,为了在系统重启后磁阵能够自动挂载,需在/etc/fstab 文件中增加一个条目,即该文件中的/dev/sdb1这一行。

相关主题