背景
我开始创建虚拟机的时候就是按照系统默认的给了20g现在不够用了,所以要扩展Linux的系统盘
在VMware上增加磁盘这个步骤请参照我上一篇文章这里不多加说明
https://blog.csdn.net/qq_21451945/article/details/102785446 这里我贴下我实现的步骤,我会把注释的部分加上表情(不能添加颜色)
添加的磁盘的分区成系统盘
😂
[root@node01 mnt]
Filesystem Size Used Avail Use
% Mounted on
/dev
/mapper
/centos
-root 18G 17G 1
.4G 93
% /
devtmpfs 2
.9G 0 2
.9G 0
% /dev
tmpfs 2
.9G 0 2
.9G 0
% /dev
/shm
tmpfs 2
.9G 8
.8M 2
.9G 1
% /run
tmpfs 2
.9G 0 2
.9G 0
% /sys
/fs
/cgroup
/dev
/sda3 79G 11G 65G 14
% /mnt
/dev
/sda1 497M 125M 372M 26
% /boot
tmpfs 580M 0 580M 0
% /run
/user
/996
tmpfs 580M 0 580M 0
% /run
/user
/0
😂
[root@node01 mnt]
Disk
/dev
/sdb: 53
.7 GB
, 53687091200 bytes
, 104857600 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
/dev
/sda: 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: 0x00044228
Device Boot
Start End Blocks Id System
/dev
/sda1
* 2048 1026047 512000 83 Linux
/dev
/sda2 1026048 41943039 20458496 8e Linux LVM
/dev
/sda3 41943040 209715199 83886080 83 Linux
Disk
/dev
/mapper
/centos
-root: 18
.8 GB
, 18756927488 bytes
, 36634624 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
/dev
/mapper
/centos
-swap: 2147 MB
, 2147483648 bytes
, 4194304 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
😂
[root@node01 mnt]
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
.
Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0xd824defb
.
Command
(m
for help
): m 😂
Command action
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)
Command (m for help): n 😂#添加分区
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p 😂#把它划分为主分区
Partition number (1-4, default 1):
First sector (2048-104857599, default 2048): 😂#直接回车(默认起始扇区和最后扇区)
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-104857599, default 104857599): 😂#直接回车(默认起始扇区和最后扇区)
Using default value 104857599
Partition 1 of type Linux and of size 50 GiB is set
Command (m for help): t 😂#由于我们上面分区的默认是Linux格式的,系统盘是Linux LVM格式的,因此转换格式
Selected partition 1
Hex code (type L to list all codes): 8e 😂#我们就选用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
.
Syncing disks
.
挂载系统盘
😂
[root@node01 mnt]
Disk
/dev
/sdb: 53
.7 GB
, 53687091200 bytes
, 104857600 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: 0xd824defb
Device Boot
Start End Blocks Id System
/dev
/sdb1 2048 104857599 52427776 8e Linux LVM
Disk
/dev
/sda: 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: 0x00044228
Device Boot
Start End Blocks Id System
/dev
/sda1
* 2048 1026047 512000 83 Linux
/dev
/sda2 1026048 41943039 20458496 8e Linux LVM
/dev
/sda3 41943040 209715199 83886080 83 Linux
Disk
/dev
/mapper
/centos
-root: 18
.8 GB
, 18756927488 bytes
, 36634624 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
/dev
/mapper
/centos
-swap: 2147 MB
, 2147483648 bytes
, 4194304 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
😂
[root@node01 mnt]
Physical volume
"/dev/sdb1" successfully created
😂
[root@node01 mnt]
--- Volume
group ---
VG Name centos
System ID
Format lvm2
Metadata Areas 1
Metadata
Sequence No 3
VG Access read
/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 1
Act PV 1
VG Size 19
.51 GiB
PE Size 4
.00 MiB
Total PE 4994
Alloc PE
/ Size 4984
/ 19
.47 GiB
Free PE
/ Size 10
/ 40
.00 MiB
VG UUID pHOcHG
-qLyN
-lTXE
-bWLY
-uc1X
-og0y
-cciCzv
😂
[root@node01 mnt]
Volume
group "centos" successfully extended
😂
[root@node01 mnt]
--- Volume
group ---
VG Name centos
System ID
Format lvm2
Metadata Areas 2
Metadata
Sequence No 4
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 69
.50 GiB
PE Size 4
.00 MiB
Total PE 17793
Alloc PE
/ Size 4984
/ 19
.47 GiB
Free PE
/ Size 12809
/ 50
.04 GiB
VG UUID pHOcHG
-qLyN
-lTXE
-bWLY
-uc1X
-og0y
-cciCzv
😂
[root@node01 mnt]
Filesystem Size Used Avail Use
% Mounted on
/dev
/mapper
/centos
-root 18G 17G 1
.4G 93
% /
devtmpfs 2
.9G 0 2
.9G 0
% /dev
tmpfs 2
.9G 0 2
.9G 0
% /dev
/shm
tmpfs 2
.9G 8
.8M 2
.9G 1
% /run
tmpfs 2
.9G 0 2
.9G 0
% /sys
/fs
/cgroup
/dev
/sda3 79G 11G 65G 14
% /mnt
/dev
/sda1 497M 125M 372M 26
% /boot
tmpfs 580M 0 580M 0
% /run
/user
/996
tmpfs 580M 0 580M 0
% /run
/user
/0
😂
[root@node01 mnt]
Size of logical volume centos
/root changed
from 17
.47 GiB
(4472 extents
) to 67
.47 GiB
(17272 extents
).
Logical volume root successfully resized
.
😂
[root@node01 mnt]
resize2fs 1
.42
.9
(28
-Dec
-2013
)
resize2fs: Bad magic number in super
-block
while trying to open
/dev
/centos
/root
Couldn't find valid filesystem superblock
.
😂
[root@node01 mnt]
/dev
/mapper
/centos
-root on
/ type xfs
(rw
,relatime
,attr2
,inode64
,noquota
)
[root@node01 mnt]
meta
-data=
/dev
/mapper
/centos
-root isize=256 agcount=4
, agsize=1144832 blks
= sectsz=512 attr=2
, projid32bit=1
= crc=0 finobt=0
data = bsize=4096 blocks=4579328
, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii
-ci=0 ftype=0
log =internal bsize=4096 blocks=2560
, version=2
= sectsz=512 sunit=0 blks
, lazy
-count=1
realtime =none extsz=4096 blocks=0
, rtextents=0
data blocks changed
from 4579328 to 17686528
😂
[root@node01 mnt]
Filesystem Size Used Avail Use
% Mounted on
/dev
/mapper
/centos
-root 68G 17G 52G 24
% /
devtmpfs 2
.9G 0 2
.9G 0
% /dev
tmpfs 2
.9G 0 2
.9G 0
% /dev
/shm
tmpfs 2
.9G 8
.8M 2
.9G 1
% /run
tmpfs 2
.9G 0 2
.9G 0
% /sys
/fs
/cgroup
/dev
/sda3 79G 11G 65G 14
% /mnt
/dev
/sda1 497M 125M 372M 26
% /boot
tmpfs 580M 0 580M 0
% /run
/user
/996
tmpfs 580M 0 580M 0
% /run
/user
/0
有任何问题,欢迎加扫码咨询(备注好对应的技术呦)