查看数据盘的挂载路径,根据返回的文件路径卸载分区,直至完全卸载已挂载的分区。
[root@ecshost ~]# mount | grep "/dev/vdb"/dev/vdb1 on /mnt type ext4 (rw,relatime,data=ordered)[root@ecshost ~]# umount /dev/vdb1[root@ecshost ~]# mount | grep "/dev/vdb"
[root@ecshost ~]# fdisk -u /dev/vdbWelcome to fdisk (util-linux 2.23.2).Changes will remain in memory only, until you decide to write them.Be careful before using the write command.Command (m for help): pDisk /dev/vdb: 42.9 GB, 42949672960 bytes, 83886080 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk label type: dosDisk identifier: 0x9277b47bDevice Boot Start End Blocks Id System/dev/vdb1 2048 41943039 20970496 83 LinuxCommand (m for help): dSelected partition 1Partition 1 is deletedCommand (m for help): pDisk /dev/vdb: 42.9 GB, 42949672960 bytes, 83886080 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk label type: dosDisk identifier: 0x9277b47bDevice Boot Start End Blocks Id SystemCommand (m for help): wThe partition table has been altered!Calling ioctl() to re-read partition table.WARNING: Re-reading the partition table failed with error 16: Device or resource busy.The kernel still uses the old table. The new table will be used atthe next reboot or after you run partprobe(8) or kpartx(8)Syncing disks.
ext*文件系统(例如ext3和ext4):依次运行以下命令调整ext*文件系统大小并重新挂载分区。
[root@ecshost ~]# resize2fs /dev/vdb1resize2fs 1.42.9 (28-Dec-2013)Resizing the filesystem on /dev/vdb1 to 7864320 (4k) blocks.The filesystem on /dev/vdb1 is now 7864320 blocks long.[root@ecshost ~]# mount /dev/vdb1 /mnt