centos系统分区扩容

5个月前 ( 11-26 ) 173阅读 180评论

image.png

首先扩容硬盘

image.png

image.png

[root@ecs_784 ~]# fdisk /dev/sda 

The device presents a logical sector size that is smaller than
the physical sector size. Aligning to a physical sector (or optimal
I/O) size boundary is recommended, or performance may be impacted.
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): n
Partition type:
   p   primary (2 primary, 0 extended, 2 free)
   e   extended
Select (default p): p
Partition number (3,4, default 3): 
First sector (83886080-209715199, default 83886080): 
Using default value 83886080
Last sector, +sectors or +size{K,M,G} (83886080-209715199, default 209715199): 
Using default value 209715199
Partition 3 of type Linux and of size 60 GiB is set

Command (m for help): t
Partition number (1-3, default 3): 
Hex code (type L to list all codes): 8e
Changed type of partition 'Linux' to 'Linux LVM'

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@ecs_784 ~]# mkfs -t ext3 /dev/sda3
mke2fs 1.42.9 (28-Dec-2013)
Discarding device blocks: done                            
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
3932160 inodes, 15728640 blocks
786432 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
480 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

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information:        
done

[root@ecs_784 ~]# 
[root@ecs_784 ~]# 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.
[root@ecs_784 ~]# pvdisplay
  --- Physical volume ---
  PV Name               /dev/sda2
  VG Name               centos
  PV Size               39.51 GiB / not usable 3.00 MiB
  Allocatable           yes 
  PE Size               4.00 MiB
  Total PE              10114
  Free PE               11
  Allocated PE          10103
  PV UUID               nWpySs-yBbw-BN7g-u1G7-xvU1-KAc2-q1Vfx5
   
  "/dev/sda3" is a new physical volume of "60.00 GiB"
  --- NEW Physical volume ---
  PV Name               /dev/sda3
  VG Name               
  PV Size               60.00 GiB
  Allocatable           NO
  PE Size               0   
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               WOOOXV-ugpD-hc0z-ugiF-tJFK-Ptbn-ozAnLG
   
[root@ecs_784 ~]# vgextend centos /dev/sda3
  Volume group "centos" successfully extended
  
[root@ecs_784 ~]# lvextend -L +60G /dev/mapper/centos-root

image.png

文章版权声明:除非注明,否则均为IT技术交流分享 IDC管理计费系统 私有云管理系统 PVE管理系统 私有云系统原创文章,转载或复制请以超链接形式并注明出处。
取消
支付宝二维码
支付宝二维码
微信二维码