## 刷新硬件信息 [root@i-351D0B02 ~]# partprobe ## 查看磁盘情况 [root@i-351D0B02 ~]# lsblk ##新建分区 [root@i-351D0B02 ~]# fdisk /dev/vda Welcome to fdisk (util-linux 2.23.2). ##创建分区 Command (m forhelp): n Partition type: p primary (1 primary, 0 extended, 3 free) e extended Select (default p): p Partition number (2-4, default 2): 2 First sector (16779264-209715199, default 16779264): Using default value 16779264 Last sector, +sectors or +size{K,M,G} (16779264-209715199, default 209715199): Using default value 209715199 Partition 2 of type Linux and of size 92 GiB is set ## 再次查看分区 Command (m forhelp): p
Disk /dev/vda: 107.4 GB, 107374182400 bytes, 209715200 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: 0x000504a5
Device Boot Start End Blocks Id System /dev/vda1 2048 16779263 8388608 82 Linux swap / Solaris /dev/vda2 16779264 209715199 96467968 83 Linux ## 检查分区是不否有错误 Command (m forhelp): v Remaining 2047 unallocated 512-byte sectors ## 保存分区信息 Command (m forhelp): w The partition table has been altered!
Calling ioctl() to re-read partition table. ## 刷新存储文件,centos6 使用 kpartx /dev/vda [root@i-351D0B02 ~]# partprobe ##格式化分区 [root@i-351D0B02 ~]# mkfs.xfs /dev/vda2 ##修改fstab并挂载 [root@i-351D0B02 ~]# vim /etc/fstab /dev/vda2 /data xfs defaults 0 0 [root@i-351D0B02 ~]# mount -a ##查看分区挂载 [root@i-351D0B02 ~]# df -Th
gdisk 分区工具
##安装gdisk包 yum install gdisk ##刷新存储 [root@i-5C222F91 ~]# partprobe ##创建分区 [root@i-5C222F91 ~]# gdisk /dev/vda Command (? forhelp): n Partition number (3-128, default 3): #查看分区情况 Command (? forhelp): p Number Start (sector) End (sector) Size Code Name 1 2048 1026047 500.0 MiB EF00 EFI System Partition 2 1026048 1640447 300.0 MiB 0700 3 1640448 104857566 49.2 GiB 8300 Linux filesystem #修改分区类型 Command (? forhelp): t Partition number (1-3): 3 Hex code or GUID (L to show codes, Enter = 8300): 0700 #检查分区情况 Command (? forhelp): v #保存分区 Command (? forhelp): w
Do you want to proceed? (Y/N): y #写入分区信息 ##刷新存储 [root@i-5C222F91 ~]# partprobe ##格式化分区 [root@i-351D0B02 ~]# mkfs.xfs /dev/vda2 ##修改fstab并挂载 [root@i-351D0B02 ~]# vim /etc/fstab /dev/vda2 /data xfs defaults 0 0 [root@i-351D0B02 ~]# mount -a ##查看分区挂载 [root@i-351D0B02 ~]# df -Th
## 刷新硬件信息 [root@i-351D0B02 ~]# partprobe ## 查看磁盘情况 [root@i-351D0B02 ~]# lsblk ##新建分区 [root@i-351D0B02 ~]# fdisk /dev/vda Welcome to fdisk (util-linux 2.23.2). ##创建分区 Command (m forhelp): n Partition type: p primary (1 primary, 0 extended, 3 free) e extended Select (default p): p Partition number (2-4, default 2): 2 First sector (16779264-209715199, default 16779264): Using default value 16779264 Last sector, +sectors or +size{K,M,G} (16779264-209715199, default 209715199): Using default value 209715199 Partition 2 of type Linux and of size 92 GiB is set ## 再次查看分区 Command (m forhelp): p
Disk /dev/vda: 107.4 GB, 107374182400 bytes, 209715200 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: 0x000504a5
Device Boot Start End Blocks Id System /dev/vda1 2048 16779263 8388608 82 Linux swap / Solaris /dev/vda2 16779264 209715199 96467968 83 Linux ## 检查分区是不否有错误 Command (m forhelp): v Remaining 2047 unallocated 512-byte sectors ## 保存分区信息 Command (m forhelp): w The partition table has been altered!
Calling ioctl() to re-read partition table. ## 刷新存储文件,centos6 使用 kpartx /dev/vda [root@i-351D0B02 ~]# partprobe ##创建pv卷 [root@i-351D0B02 ~]# pvcreate /dev/vda2 ##创建vg卷组 [root@i-351D0B02 ~]# vgcreate data /dev/vda2 ##创建lv逻辑卷 [root@i-351D0B02 ~]# lvcreate -l 100%FREE -n data data ##格式化逻辑卷 [root@i-351D0B02 ~]# mkfs.xfs /dev/mapper/data-data ##修改fstab并挂载 [root@i-351D0B02 ~]# vim /etc/fstab /dev/mapper/data-data /data xfs defaults 0 0 [root@i-351D0B02 ~]# mount -a ##查看分区挂载 [root@i-351D0B02 ~]# df -Th