挂在磁盘操作(还有一个300G的盘没显示出来):
[root@iZgo67bo9s3uaijzqrgbaxZ ori]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/hda1 39G 12G 26G 32% /
tmpfs 4.0G 0 4.0G 0% /dev/shm
[root@iZgo67bo9s3uaijzqrgbaxZ backup]# fdisk -l //查找未挂载的磁盘信息
Disk /dev/hda: 42.9 GB, 42949672960 bytes
224 heads, 56 sectors/track, 6687 cylinders
Units = cylinders of 12544 * 512 = 6422528 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 6688 41940992 83 Linux
Partition 1 does not end on cylinder boundary.
Disk /dev/xvdb: 322.1 GB, 322122547200 bytes
224 heads, 56 sectors/track, 50155 cylinders
Units = cylinders of 12544 * 512 = 6422528 bytes
Disk /dev/xvdb doesn't contain a valid partition table
[root@iZgo67bo9s3uaijzqrgbaxZ opt]#mkfs -t ext4 /dev/xvdb //格式化未挂载的磁盘,使用ext4格式
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
39321600 inodes, 78643200 blocks
3932160 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
2400 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 31 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@iZgo67bo9s3uaijzqrgbaxZ sdb]#mount /dev/xvdb /home //将磁盘挂载到创建的目录上
实现自动挂载 vi /etc/fstab 添加 /dev/xvdb /home ext4 defaults 0 0
[root@iZgo67bo9s3uaijzqrgbaxZ sdb]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/hda1 39G 12G 26G 32% /
tmpfs 4.0G 0 4.0G 0% /dev/shm
/dev/xvdb 296G 191M 281G 1% /mnt/sdb
[root@iZgo67bo9s3uaijzqrgbaxZ sdb]# mount -l //显示挂载信息
[root@iZgo67bo9s3uaijzqrgbaxZ sdb]# mount /home //卸载挂载,卸载时需要先停掉运行在挂载磁盘上的应用