首页 > 编程知识 正文

lvextend扩容命令,存储硬盘扩容

时间:2023-05-04 13:19:37 阅读:185167 作者:2842

[root@hdp1 ~]# fdisk -l磁盘 /dev/sda:37.6 GB, 37580963840 字节,73400320 个扇区Units = 扇区 of 1 * 512 = 512 bytes扇区大小(逻辑/物理):512 字节 / 512 字节I/O 大小(最小/最佳):512 字节 / 512 字节磁盘标签类型:dos磁盘标识符:0x000d731a 设备 Boot Start End Blocks Id System/dev/sda1 * 2048 1026047 512000 83 Linux/dev/sda2 1026048 41943039 20458496 8e Linux LVM磁盘 /dev/mapper/centos-root:18.8 GB, 18798870528 字节,36716544 个扇区Units = 扇区 of 1 * 512 = 512 bytes扇区大小(逻辑/物理):512 字节 / 512 字节I/O 大小(最小/最佳):512 字节 / 512 字节磁盘 /dev/mapper/centos-swap:2147 MB, 2147483648 字节,4194304 个扇区Units = 扇区 of 1 * 512 = 512 bytes扇区大小(逻辑/物理):512 字节 / 512 字节I/O 大小(最小/最佳):512 字节 / 512 字节[root@hdp1 ~]# fdisk /dev/sda欢迎使用 fdisk (util-linux 2.23.2)。更改将停留在内存中,直到您决定将更改写入磁盘。使用写入命令前请三思。命令(输入 m 获取帮助):m命令操作 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)命令(输入 m 获取帮助):nPartition type: p primary (2 primary, 0 extended, 2 free) e extendedSelect (default p): p分区号 (3,4,默认 3):3起始 扇区 (41943040-73400319,默认为 41943040):将使用默认值 41943040Last 扇区, +扇区 or +size{K,M,G} (41943040-73400319,默认为 73400319):将使用默认值 73400319分区 3 已设置为 Linux 类型,大小设为 15 GiB命令(输入 m 获取帮助):wThe partition table has been altered!Calling ioctl() to re-read partition table.WARNING: Re-reading the partition table failed with error 16: 设备或资源忙.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)正在同步磁盘。[root@hdp1 ~]# fdisk -l磁盘 /dev/sda:37.6 GB, 37580963840 字节,73400320 个扇区Units = 扇区 of 1 * 512 = 512 bytes扇区大小(逻辑/物理):512 字节 / 512 字节I/O 大小(最小/最佳):512 字节 / 512 字节磁盘标签类型:dos磁盘标识符:0x000d731a 设备 Boot Start End Blocks Id System/dev/sda1 * 2048 1026047 512000 83 Linux/dev/sda2 1026048 41943039 20458496 8e Linux LVM/dev/sda3 41943040 73400319 15728640 83 Linux磁盘 /dev/mapper/centos-root:18.8 GB, 18798870528 字节,36716544 个扇区Units = 扇区 of 1 * 512 = 512 bytes扇区大小(逻辑/物理):512 字节 / 512 字节I/O 大小(最小/最佳):512 字节 / 512 字节磁盘 /dev/mapper/centos-swap:2147 MB, 2147483648 字节,4194304 个扇区Units = 扇区 of 1 * 512 = 512 bytes扇区大小(逻辑/物理):512 字节 / 512 字节I/O 大小(最小/最佳):512 字节 / 512 字节[root@hdp1 ~]# pvcreate /dev/sda3 Device /dev/sda3 not found (or ignored by filtering).[root@hdp1 ~]# fdisk -l磁盘 /dev/sda:37.6 GB, 37580963840 字节,73400320 个扇区Units = 扇区 of 1 * 512 = 512 bytes扇区大小(逻辑/物理):512 字节 / 512 字节I/O 大小(最小/最佳):512 字节 / 512 字节磁盘标签类型:dos磁盘标识符:0x000d731a 设备 Boot Start End Blocks Id System/dev/sda1 * 2048 1026047 512000 83 Linux/dev/sda2 1026048 41943039 20458496 8e Linux LVM/dev/sda3 41943040 73400319 15728640 83 Linux磁盘 /dev/mapper/centos-root:18.8 GB, 18798870528 字节,36716544 个扇区Units = 扇区 of 1 * 512 = 512 bytes扇区大小(逻辑/物理):512 字节 / 512 字节I/O 大小(最小/最佳):512 字节 / 512 字节磁盘 /dev/mapper/centos-swap:2147 MB, 2147483648 字节,4194304 个扇区Units = 扇区 of 1 * 512 = 512 bytes扇区大小(逻辑/物理):512 字节 / 512 字节I/O 大小(最小/最佳):512 字节 / 512 字节[root@hdp1 ~]# pvcreate /dev/sda3 Physical volume "/dev/sda3" successfully created.[root@hdp1 ~]# pvs PV VG Fmt Attr PSize PFree /dev/sda2 centos lvm2 a-- <19.51g 0 /dev/sda3 lvm2 --- 15.00g 15.00g[root@hdp1 ~]# vgextend centos /dev/sda3 Volume group "centos" successfully extended[root@hdp1 ~]# vgs VG #PV #LV #SN Attr VSize VFree centos 2 2 0 wz--n- 34.50g <15.00g[root@hdp1 ~]# df -h文件系统 容量 已用 可用 已用% 挂载点/dev/mapper/centos-root 18G 8.5G 9.1G 49% /devtmpfs 477M 0 477M 0% /devtmpfs 493M 0 493M 0% /dev/shmtmpfs 493M 7.2M 486M 2% /runtmpfs 493M 0 493M 0% /sys/fs/cgroup/dev/sda1 497M 154M 344M 31% /boottmpfs 99M 8.0K 99M 1% /run/user/42tmpfs 99M 0 99M 0% /run/user/0[root@hdp1 ~]# lvdisplay --- Logical volume --- LV Path /dev/centos/swap LV Name swap VG Name centos LV UUID zk0Ifz-tqLh-shJC-yq1r-20vf-wwKz-IB16nc LV Write Access read/write LV Creation host, time localhost, 2018-08-01 13:14:19 +0800 LV Status available # open 2 LV Size 2.00 GiB Current LE 512 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 8192 Block device 253:1 --- Logical volume --- LV Path /dev/centos/root LV Name root VG Name centos LV UUID 1ZaMHo-U63q-bDzg-MuNB-uEqJ-TtZk-0jtqlV LV Write Access read/write LV Creation host, time localhost, 2018-08-01 13:14:19 +0800 LV Status available # open 1 LV Size <17.51 GiB Current LE 4482 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 8192 Block device 253:0 [root@hdp1 ~]# lvextend +15000 /dev/centos/root Please specify a logical volume path. Run `lvextend --help' for more information.[root@hdp1 ~]# lvextend -l +15000 /dev/centos/root Insufficient free space: 15000 extents needed, but only 3839 available[root@hdp1 ~]# lvextend -l +3839 /dev/centos/root Size of logical volume centos/root changed from <17.51 GiB (4482 extents) to 32.50 GiB (8321 extents). Logical volume centos/root successfully resized.[root@hdp1 ~]# df -h文件系统 容量 已用 可用 已用% 挂载点/dev/mapper/centos-root 18G 8.5G 9.1G 49% /devtmpfs 477M 0 477M 0% /devtmpfs 493M 0 493M 0% /dev/shmtmpfs 493M 7.2M 486M 2% /runtmpfs 493M 0 493M 0% /sys/fs/cgroup/dev/sda1 497M 154M 344M 31% /boottmpfs 99M 12K 99M 1% /run/user/42tmpfs 99M 0 99M 0% /run/user/0[root@hdp1 ~]# xfs_growfs /dev/centos/rootmeta-data=/dev/mapper/centos-root isize=512 agcount=4, agsize=1147392 blks = sectsz=512 attr=2, projid32bit=1 = crc=1 finobt=0 spinodes=0data = bsize=4096 blocks=4589568, imaxpct=25 = sunit=0 swidth=0 blksnaming =version 2 bsize=4096 ascii-ci=0 ftype=1log =internal bsize=4096 blocks=2560, version=2 = sectsz=512 sunit=0 blks, lazy-count=1realtime =none extsz=4096 blocks=0, rtextents=0data blocks changed from 4589568 to 8520704[root@hdp1 ~]# df -h文件系统 容量 已用 可用 已用% 挂载点/dev/mapper/centos-root 33G 8.5G 25G 27% /devtmpfs 477M 0 477M 0% /devtmpfs 493M 0 493M 0% /dev/shmtmpfs 493M 7.2M 486M 2% /runtmpfs 493M 0 493M 0% /sys/fs/cgroup/dev/sda1 497M 154M 344M 31% /boottmpfs 99M 12K 99M 1% /run/user/42tmpfs 99M 0 99M 0% /run/user/0

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。