0
点赞
收藏
分享

微信扫一扫

lvm在线添加磁盘并扩展lv

佃成成成成 2024-04-22 阅读 7
运维linux

kvm虚拟机,当前数据库正常运行但数据磁盘空间不足,客户已新挂了一个1T磁盘(/dev/sdf)
[root@db ~]# df -h|grep oracledata
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/datavg-datavol
                      197G  187G  0  100% /oracledata

[root@db ~]# fdisk /dev/sdf
Disk /dev/sdf: 1099.5 GB, 1099511627776 bytes
255 heads, 63 sectors/track, 133674 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x4242b110

   Device Boot      Start         End      Blocks   Id  System

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4) p
Partition number (1-4): 1
First cylinder (1-133674, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-133674, default 133674):
Using default value 133674

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@db ~]#   fdisk -l /dev/sdf

Disk /dev/sdf: 1099.5 GB, 1099511627776 bytes
255 heads, 63 sectors/track, 133674 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x4242b110

   Device Boot      Start         End      Blocks   Id  System
/dev/sdf1               1      133674  1073736373+  8e  Linux LVM
[root@db ~]# vgs|grep datavg
  VG       #PV #LV #SN Attr   VSize   VFree
  datavg     1   1   0 wz--n- 200.00g    0

[root@db ~]# pvcreate /dev/sdf1
  Physical volume "/dev/sdf1" successfully created
[root@db ~]#  pvdisplay
  "/dev/sdf1" is a new physical volume of "1023.99 GiB"
  --- NEW Physical volume ---
  PV Name               /dev/sdf1
  VG Name               
  PV Size               1023.99 GiB
  Allocatable           NO
  PE Size               0   
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               UgcLg6-JiFB-RjAz-3Xah-zxhO-fg5f-wnYARO
   
[root@db ~]# vgextend datavg /dev/sdf1
  Volume group "datavg" successfully extended
 
[root@db ~]#  vgs|grep datavg
  VG       #PV #LV #SN Attr   VSize   VFree   
  datavg     2   1   0 wz--n-   1.20t 1023.99g
 
[root@db ~]#  lvresize -l +100%FREE /dev/datavg/datavol
  Size of logical volume datavg/datavol changed from 200.00 GiB (51199 extents) to 1.20 TiB (313341 extents).
  Logical volume datavol successfully resized.
 
[root@db ~]# resize2fs /dev/datavg/datavol
resize2fs 1.43-WIP (20-Jun-2013)
Filesystem at /dev/datavg/datavol is mounted on /oracledata; on-line resizing required
old_desc_blocks = 13, new_desc_blocks = 77
The filesystem on /dev/datavg/datavol is now 320861184 blocks long.

[root@db ~]#  df -h|grep oracledata
/dev/mapper/datavg-datavol
                      1.2T  187G  967G  17% /oracledata


 

举报

相关推荐

0 条评论