磁盘扩容操作:
    fdisk -l 查看有哪些盘

    umount /data 卸载磁盘
    fdisk /dev/vdb  对磁盘进行操作。可以新建删除分区。。
    [root@iZbp13okxpwhhgbz5t0j7jZ ~]# fdisk /dev/vdb
    Welcome 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): m
    Command action
       a   toggle a bootable flag
       b   edit bsd disklabel
       c   toggle the dos compatibility flag
       d   delete a partition
       g   create a new empty GPT partition table
       G   create an IRIX (SGI) partition table
       l   list known partition types
       m   print this menu
       n   add a new partition
       o   create a new empty DOS partition table
       p   print the partition table
       q   quit without saving changes
       s   create a new empty Sun disklabel
       t   change a partition's system id
       u   change display/entry units
       v   verify the partition table
       w   write table to disk and exit
       x   extra functionality (experts only)

    Command (m for help): d
    Selected partition 1
    Partition 1 is deleted

    Command (m for help):
    Command (m for help): p

    Disk /dev/vdb: 257.7 GB, 257698037760 bytes, 503316480 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk label type: dos
    Disk identifier: 0x00000000

       Device Boot      Start         End      Blocks   Id  System

    Command (m for help): n
    Partition type:
       p   primary (0 primary, 0 extended, 4 free)
       e   extended
    Select (default p): p
    Partition number (1-4, default 1):
    First sector (2048-503316479, default 2048):
    Using default value 2048
    Last sector, +sectors or +size{K,M,G} (2048-503316479, default 503316479):
    Using default value 503316479
    Partition 1 of type Linux and of size 240 GiB is set

    Command (m for help): p

    Disk /dev/vdb: 257.7 GB, 257698037760 bytes, 503316480 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk label type: dos
    Disk identifier: 0x00000000

       Device Boot      Start         End      Blocks   Id  System
    /dev/vdb1            2048   503316479   251657216   83  Linux

    Command (m for help): w
    The 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 at
    the next reboot or after you run partprobe(8) or kpartx(8)
    Syncing disks.
    [root@iZbp13okxpwhhgbz5t0j7jZ ~]# fdisk -l

    Disk /dev/vda: 21.5 GB, 21474836480 bytes, 41943040 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk label type: dos
    Disk identifier: 0x000b2d99

       Device Boot      Start         End      Blocks   Id  System
    /dev/vda1   *        2048    41943039    20970496   83  Linux

    Disk /dev/vdb: 257.7 GB, 257698037760 bytes, 503316480 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk label type: dos
    Disk identifier: 0x00000000

       Device Boot      Start         End      Blocks   Id  System
    /dev/vdb1            2048   503316479   251657216   83  Linux


    重新分区后,对磁盘进行格式化。
    使用 resize2fs 指令扩大文件系统大小,原有数据不会丢失。
     
    e2fsck -f /dev/xvdb1   时间会相对长 180G大概5分钟
     
    resize2fs /dev/xvdb1

    然后在挂载磁盘即可扩容成功。

    mount /dev/vdb1 /data  挂载磁盘