LVM磁盘扩容记录
Last login: Sat Dec 28 08:35:14 2019 from 172.17.188.7 [root@zabbixserver ~]# ls anaconda-ks.cfg core.7459 core.8020 get-pip.py 公共 模板 视频 图片 文档 下载 音乐 桌面 [root@zabbixserver ~]# fdisk -l 磁盘 /dev/sdb:53.7 GB, 53687091200 字节,104857600 个扇区 Units = 扇区 of 1 * 512 = 512 bytes 扇区大小(逻辑/物理):512 字节 / 512 字节 I/O 大小(最小/最佳):512 字节 / 512 字节 磁盘 /dev/sda:214.7 GB, 214748364800 字节,419430400 个扇区 Units = 扇区 of 1 * 512 = 512 bytes 扇区大小(逻辑/物理):512 字节 / 512 字节 I/O 大小(最小/最佳):512 字节 / 512 字节 磁盘标签类型:dos 磁盘标识符:0x000b57af 设备 Boot Start End Blocks Id System /dev/sda1 * 2048 1026047 512000 83 Linux /dev/sda2 1026048 104857599 51915776 8e Linux LVM 磁盘 /dev/mapper/centos-root:49.0 GB, 48951721984 字节,95608832 个扇区 Units = 扇区 of 1 * 512 = 512 bytes 扇区大小(逻辑/物理):512 字节 / 512 字节 I/O 大小(最小/最佳):512 字节 / 512 字节 磁盘 /dev/mapper/centos-swap:4160 MB, 4160749568 字节,8126464 个扇区 Units = 扇区 of 1 * 512 = 512 bytes 扇区大小(逻辑/物理):512 字节 / 512 字节 I/O 大小(最小/最佳):512 字节 / 512 字节 [root@zabbixserver ~]# df -h 文件系统 容量 已用 可用 已用% 挂载点 /dev/mapper/centos-root 46G 46G 34M 100% / devtmpfs 7.8G 0 7.8G 0% /dev tmpfs 7.8G 0 7.8G 0% /dev/shm tmpfs 7.8G 8.9M 7.8G 1% /run tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup /dev/sdb 50G 12G 36G 25% /data /dev/sda1 497M 128M 369M 26% /boot tmpfs 1.6G 0 1.6G 0% /run/user/0 [root@zabbixserver ~]# fdisk /dev/sda 欢迎使用 fdisk (util-linux 2.23.2)。 更改将停留在内存中,直到您决定将更改写入磁盘。 使用写入命令前请三思。 命令(输入 m 获取帮助):p 磁盘 /dev/sda:214.7 GB, 214748364800 字节,419430400 个扇区 Units = 扇区 of 1 * 512 = 512 bytes 扇区大小(逻辑/物理):512 字节 / 512 字节 I/O 大小(最小/最佳):512 字节 / 512 字节 磁盘标签类型:dos 磁盘标识符:0x000b57af 设备 Boot Start End Blocks Id System /dev/sda1 * 2048 1026047 512000 83 Linux /dev/sda2 1026048 104857599 51915776 8e Linux LVM 命令(输入 m 获取帮助):n Partition type: p primary (2 primary, 0 extended, 2 free) e extended Select (default p): p 分区号 (3,4,默认 3):3 起始 扇区 (104857600-419430399,默认为 104857600): 将使用默认值 104857600 Last 扇区, +扇区 or +size{K,M,G} (104857600-419430399,默认为 419430399): 将使用默认值 419430399 分区 3 已设置为 Linux 类型,大小设为 150 GiB 命令(输入 m 获取帮助):t 分区号 (1-3,默认 3):3 Hex 代码(输入 L 列出所有代码):L 0 空 24 NEC DOS 81 Minix / 旧 Linu bf Solaris 1 FAT12 27 隐藏的 NTFS Win 82 Linux 交换 / So c1 DRDOS/sec (FAT- 2 XENIX root 39 Plan 9 83 Linux c4 DRDOS/sec (FAT- 3 XENIX usr 3c PartitionMagic 84 OS/2 隐藏的 C: c6 DRDOS/sec (FAT- 4 FAT16 <32M 40 Venix 80286 85 Linux 扩展 c7 Syrinx 5 扩展 41 PPC PReP Boot 86 NTFS 卷集 da 非文件系统数据 6 FAT16 42 SFS 87 NTFS 卷集 db CP/M / CTOS / . 7 HPFS/NTFS/exFAT 4d QNX4.x 88 Linux 纯文本 de Dell 工具 8 AIX 4e QNX4.x 第2部分 8e Linux LVM df BootIt 9 AIX 可启动 4f QNX4.x 第3部分 93 Amoeba e1 DOS 访问 a OS/2 启动管理器 50 OnTrack DM 94 Amoeba BBT e3 DOS R/O b W95 FAT32 51 OnTrack DM6 Aux 9f BSD/OS e4 SpeedStor c W95 FAT32 (LBA) 52 CP/M a0 IBM Thinkpad 休 eb BeOS fs e W95 FAT16 (LBA) 53 OnTrack DM6 Aux a5 FreeBSD ee GPT f W95 扩展 (LBA) 54 OnTrackDM6 a6 OpenBSD ef EFI (FAT-12/16/ 10 OPUS 55 EZ-Drive a7 NeXTSTEP f0 Linux/PA-RISC 11 隐藏的 FAT12 56 Golden Bow a8 Darwin UFS f1 SpeedStor 12 Compaq 诊断 5c Priam Edisk a9 NetBSD f4 SpeedStor 14 隐藏的 FAT16 <3 61 SpeedStor ab Darwin 启动 f2 DOS 次要 16 隐藏的 FAT16 63 GNU HURD or Sys af HFS / HFS+ fb VMware VMFS 17 隐藏的 HPFS/NTF 64 Novell Netware b7 BSDI fs fc VMware VMKCORE 18 AST 智能睡眠 65 Novell Netware b8 BSDI swap fd Linux raid 自动 1b 隐藏的 W95 FAT3 70 DiskSecure 多启 bb Boot Wizard 隐 fe LANstep 1c 隐藏的 W95 FAT3 75 PC/IX be Solaris 启动 ff BBT 1e 隐藏的 W95 FAT1 80 旧 Minix Hex 代码(输入 L 列出所有代码):8e 已将分区“Linux”的类型更改为“Linux LVM” 命令(输入 m 获取帮助):w The 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 at the next reboot or after you run partprobe(8) or kpartx(8) 正在同步磁盘。 [root@zabbixserver ~]# fdisk -l 磁盘 /dev/sdb:53.7 GB, 53687091200 字节,104857600 个扇区 Units = 扇区 of 1 * 512 = 512 bytes 扇区大小(逻辑/物理):512 字节 / 512 字节 I/O 大小(最小/最佳):512 字节 / 512 字节 磁盘 /dev/sda:214.7 GB, 214748364800 字节,419430400 个扇区 Units = 扇区 of 1 * 512 = 512 bytes 扇区大小(逻辑/物理):512 字节 / 512 字节 I/O 大小(最小/最佳):512 字节 / 512 字节 磁盘标签类型:dos 磁盘标识符:0x000b57af 设备 Boot Start End Blocks Id System /dev/sda1 * 2048 1026047 512000 83 Linux /dev/sda2 1026048 104857599 51915776 8e Linux LVM /dev/sda3 104857600 419430399 157286400 8e Linux LVM 磁盘 /dev/mapper/centos-root:49.0 GB, 48951721984 字节,95608832 个扇区 Units = 扇区 of 1 * 512 = 512 bytes 扇区大小(逻辑/物理):512 字节 / 512 字节 I/O 大小(最小/最佳):512 字节 / 512 字节 磁盘 /dev/mapper/centos-swap:4160 MB, 4160749568 字节,8126464 个扇区 Units = 扇区 of 1 * 512 = 512 bytes 扇区大小(逻辑/物理):512 字节 / 512 字节 I/O 大小(最小/最佳):512 字节 / 512 字节 [root@zabbixserver ~]# partprobe [root@zabbixserver ~]# mkfs.ext3 /dev/sda3 mke2fs 1.42.9 (28-Dec-2013) 文件系统标签= OS type: Linux 块大小=4096 (log=2) 分块大小=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 9830400 inodes, 39321600 blocks 1966080 blocks (5.00%) reserved for the super user 第一个数据块=0 Maximum filesystem blocks=4294967296 1200 block groups 32768 blocks per group, 32768 fragments per group 8192 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000, 7962624, 11239424, 20480000, 23887872 Allocating group tables: 完成 正在写入inode表: 完成 Creating journal (32768 blocks): 完成 Writing superblocks and filesystem accounting information: 完成 [root@zabbixserver ~]# lvm lvm> pvcreate /dev/sda3 WARNING: ext3 signature detected on /dev/sda3 at offset 1080. Wipe it? [y/n]: y Wiping ext3 signature on /dev/sda3. Physical volume "/dev/sda3" successfully created. lvm> vgextend centos /dev/sda3 Volume group "centos" successfully extended lvm> vgdisplay -v --- Volume group --- VG Name centos System ID Format lvm2 Metadata Areas 2 Metadata Sequence No 5 VG Access read/write VG Status resizable MAX LV 0 Cur LV 2 Open LV 2 Max PV 0 Cur PV 2 Act PV 2 VG Size 199.50 GiB PE Size 4.00 MiB Total PE 51073 Alloc PE / Size 12663 / 49.46 GiB Free PE / Size 38410 / <150.04 GiB VG UUID u3onLh-kUbe-xZam-Rtax-cpRI-8Vzd-71bl7h --- Logical volume --- LV Path /dev/centos/swap LV Name swap VG Name centos LV UUID 03PuaA-Spad-RrT2-5tou-bi06-XhJd-WNENCH LV Write Access read/write LV Creation host, time localhost, 2019-03-07 15:41:40 +0800 LV Status available # open 2 LV Size <3.88 GiB Current LE 992 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 PGCZ4p-khNK-sFot-dAID-nw9s-WS3s-p4kKxt LV Write Access read/write LV Creation host, time localhost, 2019-03-07 15:41:40 +0800 LV Status available # open 1 LV Size <45.59 GiB Current LE 11671 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 8192 Block device 253:0 --- Physical volumes --- PV Name /dev/sda2 PV UUID sfEsrt-bcRH-iOq8-ex0L-hbiy-2T4h-C4f7ZH PV Status allocatable Total PE / Free PE 12674 / 11 PV Name /dev/sda3 PV UUID bKdwap-3QLi-V6Cu-ijEI-45j3-Yy2P-QAm9q9 PV Status allocatable Total PE / Free PE 38399 / 38399 lvm> lvextend -l+38410 /dev/mapper/centos-root Size of logical volume centos/root changed from <45.59 GiB (11671 extents) to <195.63 GiB (50081 extents). Logical volume centos/root successfully resized. lvm> pvdisplay --- Physical volume --- PV Name /dev/sda2 VG Name centos PV Size 49.51 GiB / not usable 3.00 MiB Allocatable yes (but full) PE Size 4.00 MiB Total PE 12674 Free PE 0 Allocated PE 12674 PV UUID sfEsrt-bcRH-iOq8-ex0L-hbiy-2T4h-C4f7ZH --- Physical volume --- PV Name /dev/sda3 VG Name centos PV Size 150.00 GiB / not usable 4.00 MiB Allocatable yes (but full) PE Size 4.00 MiB Total PE 38399 Free PE 0 Allocated PE 38399 PV UUID bKdwap-3QLi-V6Cu-ijEI-45j3-Yy2P-QAm9q9 lvm> exit Exiting. [root@zabbixserver ~]# cat /etc/redhat-release CentOS Linux release 7.6.1810 (Core) [root@zabbixserver ~]# xfs_growfs /dev/mapper/centos-root meta-data=/dev/mapper/centos-root isize=256 agcount=4, agsize=2987776 blks = sectsz=512 attr=2, projid32bit=1 = crc=0 finobt=0 data = bsize=4096 blocks=11951104, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0 ftype=0 log =internal bsize=4096 blocks=5835, version=2 = sectsz=512 sunit=0 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0 data blocks changed from 11951104 to 51282944 [root@zabbixserver ~]# df -h df:无效选项 -- ?Try 'df --help' for more information. [root@zabbixserver ~]# df -h 文件系统 容量 已用 可用 已用% 挂载点 /dev/mapper/centos-root 196G 46G 151G 24% / devtmpfs 7.8G 0 7.8G 0% /dev tmpfs 7.8G 0 7.8G 0% /dev/shm tmpfs 7.8G 8.9M 7.8G 1% /run tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup /dev/sdb 50G 12G 36G 25% /data /dev/sda1 497M 128M 369M 26% /boot tmpfs 1.6G 0 1.6G 0% /run/user/0
版权声明:本文为sonnyBag原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。