首先是报错:管道被占用
根据百度到的:
关闭所有VMware开头的进程,并关机重启电脑。
然后还是报错:模块“Disk”启动失败
搜到的解决步骤是:
1、找到虚拟机所在的目录将 .vmx文件打开
将文件vmci0.present = "TRUE"改为vmci0.present = "FALSE"
2、删除以.lck为后缀名的文件
3、重新打开虚拟机
接着开机一直不成功
网上搜的是需要自己分区,我自己到计算机管理里看并没有需要分区的地方
只好来个大招,重启
开机的时候选择了 电源–打开电源时进入固件
不知道是不是这招有效,暂时没弄懂,反正黑屏几次,把我小心肝忽上忽下几次后竟然开机成功了
后续分区
后续查看磁盘容量果然扩容不成功,果然分区还是要的(一开始就应该舍得多分点给虚机啊)
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 895M 0 895M 0% /dev
tmpfs 910M 0 910M 0% /dev/shm
tmpfs 910M 11M 900M 2% /run
tmpfs 910M 0 910M 0% /sys/fs/cgroup
/dev/sda3 18G 15G 3.7G 80% / #按理说这里应该是至少8g剩余了
/dev/sda1 297M 205M 93M 69% /boot
tmpfs 182M 4.0K 182M 1% /run/user/42
tmpfs 182M 20K 182M 1% /run/user/1000
tmpfs 182M 0 182M 0% /run/user/0
OK,开始 愉快的分区之路
- 保存一个快照先
- 查看下当前分区情况
root@localhost ~]# fdisk -l Disk /dev/sda: 26.8 GB, 26843545600 bytes, 52428800 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: 0x000a247b Device Boot Start End Blocks Id System /dev/sda1 * 2048 616447 307200 83 Linux /dev/sda2 616448 4810751 2097152 82 Linux swap / Solaris /dev/sda3 4810752 41943039 18566144 83 Linux
- 进行分区
[root@localhost ~]# fdisk /dev/sda
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 #n:创建新分区;
Partition type:
p primary (3 primary, 0 extended, 1 free)
e extended
Select (default e): p # p:创建主分区;
Selected partition 4
First sector (41943040-52428799, default 41943040): #回车使用默认值 开始磁盘大小
Using default value 41943040
Last sector, +sectors or +size{K,M,G} (41943040-52428799, default 52428799): #回车使用默认值 结束磁盘大小
Using default value 52428799
Partition 4 of type Linux and of size 5 GiB is set
Command (m for help): w #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@localhost ~]# pvcreate /dev/sda4
Device /dev/sda4 not found.
万能大招,重启~!
[root@localhost allen]# pvcreate /dev/sda4
Physical volume "/dev/sda4" successfully created.
5、查看物理卷是否创建成功
root@localhost allen]# pvdisplay
"/dev/sda4" is a new physical volume of "5.00 GiB"
--- NEW Physical volume ---
PV Name /dev/sda4
VG Name
PV Size 5.00 GiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID GgRDQ2-JllL-636W-O2Or-ZP06-N785-7FzIYK
6、创建data卷组
[root@localhost allen]# vgcreate data /dev/sda4
Volume group "data" successfully created
7、查看卷组是否创建成功
[root@localhost allen]# vgdisplay
--- Volume group ---
VG Name data
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 1
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 0
Open LV 0
Max PV 0
Cur PV 1
Act PV 1
VG Size <5.00 GiB
PE Size 4.00 MiB
Total PE 1279
Alloc PE / Size 0 / 0
Free PE / Size 1279 / <5.00 GiB
VG UUID vwLjSp-Nss6-elpP-h2tq-47yr-8vXk-YisM09
8、激活卷组
[root@localhost allen]# vgchange -a y data
0 logical volume(s) in volume group "data" now active
9、根据上面的data卷中内部PE的大小Total PE 1279
,开始创建逻辑卷
[root@localhost allen]# lvcreate -l 1279 -n vbirdlv data
Logical volume "vbirdlv" created.
[root@localhost allen]# ll /dev/data/vbirdlv
lrwxrwxrwx. 1 root root 7 Feb 22 06:53 /dev/data/vbirdlv -> ../dm-0
10、查看LVM逻辑卷
Similar command is: 'lvdisplay'
[root@localhost allen]# lvdisplay
--- Logical volume ---
LV Path /dev/data/vbirdlv
LV Name vbirdlv
VG Name data
LV UUID O8vHRc-T1Wv-f64r-0VNm-YS3g-wiDu-TFCNLc
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2020-02-22 06:53:21 -0800
LV Status available
# open 0
LV Size <5.00 GiB
Current LE 1279
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:0
11、格式化逻辑卷并挂载
[root@localhost allen]# mkfs -t ext3 /dev/data/vbirdlv
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
327680 inodes, 1309696 blocks
65484 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1342177280
40 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
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
#挂载
[root@localhost allen]# mkdir /mnt/lvm
[root@localhost allen]# mount /dev/data/vbirdlv /mnt/lvm
[root@localhost allen]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 895M 0 895M 0% /dev
tmpfs 910M 0 910M 0% /dev/shm
tmpfs 910M 11M 900M 2% /run
tmpfs 910M 0 910M 0% /sys/fs/cgroup
/dev/sda3 18G 15G 3.6G 80% /
/dev/sda1 297M 205M 93M 69% /boot
tmpfs 182M 20K 182M 1% /run/user/1000
/dev/mapper/data-vbirdlv 4.8G 11M 4.6G 1% /mnt/lvm #新增
12、设置开机挂载
[root@localhost allen]# vi /etc/fstab
[root@localhost allen]# cat /etc/fstab
# /etc/fstab
# Created by anaconda on Wed Dec 4 15:39:51 2019
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=d6ba9cd5-abbd-4389-aadf-0a81fbe950d4 / xfs defaults 0 0
UUID=48ddd255-f6c1-4b28-8d01-b936af491f32 /boot xfs defaults 0 0
UUID=1b045637-612d-4f41-8765-a668e8d5f6db swap swap defaults 0 0
/dev/data/vbirdlv /mnt/lvm ext3 defaults 0 0
#要挂载的设备或伪文件系统 挂载点 文件系统类型 挂载选项 转储频率 自检次序
13、重启后测试下是否成功
[root@slave3 allen]# fdisk -l
Disk /dev/sda: 26.8 GB, 26843545600 bytes, 52428800 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: 0x000a247b
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 616447 307200 83 Linux
/dev/sda2 616448 4810751 2097152 82 Linux swap / Solaris
/dev/sda3 4810752 41943039 18566144 83 Linux
/dev/sda4 41943040 52428799 5242880 83 Linux
Disk /dev/mapper/data-vbirdlv: 5364 MB, 5364514816 bytes, 10477568 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@slave3 allen]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 895M 0 895M 0% /dev
tmpfs 910M 0 910M 0% /dev/shm
tmpfs 910M 11M 900M 2% /run
tmpfs 910M 0 910M 0% /sys/fs/cgroup
/dev/sda3 18G 15G 3.6G 80% /
/dev/mapper/data-vbirdlv 4.8G 11M 4.6G 1% /mnt/lvm
/dev/sda1 297M 205M 93M 69% /boot
tmpfs 182M 4.0K 182M 1% /run/user/42
tmpfs 182M 20K 182M 1% /run/user/1000
参考链接:
lvdisplay
Centos7中挂载新硬盘和扩展根目录
物理卷操作命令:pvcreate,pvscan,pvdisplay.卷组操作命令:vgcreate,vgdisplay.