Esxi上Linux虚拟机硬盘(LVM)扩容
Xplorist Lv6

Esxi上Linux虚拟机硬盘(LVM)扩容

reference-site-list

说明

  • 把esxi虚拟机下的debian10由默认的16G扩容到了40G,但是并没有生效,还需要到debian10中队linux进行设置,由于太困了,等明天再来测试。

  • 2021-07-23 01:27:00 把debian10中的samba文件夹成功扩容到120G,还算挺开心的,今晚上学到了不少东西,收获颇丰。

code

1
apt-get install psmisc

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135

root@debian10:~# fdisk -l
Disk /dev/sda: 40 GiB, 42949672960 bytes, 83886080 sectors
Disk model: Virtual disk
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x9d31c4bd

Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 31553535 31551488 15G 83 Linux
/dev/sda2 31555582 33552383 1996802 975M 5 Extended
/dev/sda5 31555584 33552383 1996800 975M 82 Linux swap / Solaris
root@debian10:~# fdisk /dev/sda

Welcome to fdisk (util-linux 2.33.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): F
Unpartitioned space /dev/sda: 24 GiB, 25770852352 bytes, 50333696 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes

Start End Sectors Size
33552384 83886079 50333696 24G

Command (m for help): n
Partition type
p primary (1 primary, 1 extended, 2 free)
l logical (numbered from 5)
Select (default p): p
Partition number (3,4, default 3): 3
First sector (31553536-83886079, default 31553536): 33552384
Last sector, +/-sectors or +/-size{K,M,G,T,P} (33552384-83886079, default 83886079):

Created a new partition 3 of type 'Linux' and of size 24 GiB.

Command (m for help): w
The partition table has been altered.
Syncing disks.

root@debian10:~# fdisk -l
Disk /dev/sda: 40 GiB, 42949672960 bytes, 83886080 sectors
Disk model: Virtual disk
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x9d31c4bd

Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 31553535 31551488 15G 83 Linux
/dev/sda2 31555582 33552383 1996802 975M 5 Extended
/dev/sda3 33552384 83886079 50333696 24G 83 Linux
/dev/sda5 31555584 33552383 1996800 975M 82 Linux swap / Solaris

Partition table entries are not in disk order.
root@debian10:~# df -h
Filesystem Size Used Avail Use% Mounted on
udev 983M 0 983M 0% /dev
tmpfs 200M 4.6M 195M 3% /run
/dev/sda1 15G 13G 1.9G 87% /
tmpfs 997M 0 997M 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 997M 0 997M 0% /sys/fs/cgroup
tmpfs 200M 0 200M 0% /run/user/0
root@debian10:~# df -TH
Filesystem Type Size Used Avail Use% Mounted on
udev devtmpfs 1.1G 0 1.1G 0% /dev
tmpfs tmpfs 210M 4.8M 205M 3% /run
/dev/sda1 ext4 16G 14G 2.0G 87% /
tmpfs tmpfs 1.1G 0 1.1G 0% /dev/shm
tmpfs tmpfs 5.3M 0 5.3M 0% /run/lock
tmpfs tmpfs 1.1G 0 1.1G 0% /sys/fs/cgroup
tmpfs tmpfs 210M 0 210M 0% /run/user/0
root@debian10:~# mke2fs /dev/sda3
mke2fs 1.44.5 (15-Dec-2018)
Creating filesystem with 6291456 4k blocks and 1575936 inodes
Filesystem UUID: ab94ac34-fd32-4f4e-9a09-5a1bdb26217b
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000

Allocating group tables: done
Writing inode tables: done
Writing superblocks and filesystem accounting information: done

root@debian10:/home/voidx/smb# vi /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sda1 during installation
UUID=def02d03-b923-44c7-802b-6c7e20fd62ac / ext4 errors=remount-ro 0 1
# swap was on /dev/sda5 during installation
UUID=2d7dce9e-7263-415a-a6bf-24d4448f2389 none swap sw 0 0
/dev/sr0 /media/cdrom0 udf,iso9660 user,noauto 0 0
/dev/sda3 /home/voidx/smb/share ext4 defaults 1 2

root@debian10:~# reboot
root@debian10:~# df -Th
Filesystem Type Size Used Avail Use% Mounted on
udev devtmpfs 983M 0 983M 0% /dev
tmpfs tmpfs 200M 4.6M 195M 3% /run
/dev/sda1 ext4 15G 13G 1.9G 87% /
tmpfs tmpfs 997M 0 997M 0% /dev/shm
tmpfs tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs tmpfs 997M 0 997M 0% /sys/fs/cgroup
/dev/sda3 ext4 24G 44M 23G 1% /home
tmpfs tmpfs 200M 0 200M 0% /run/user/0

root@debian10:~# chmod -R -f 777 /home/voidx/smb/share

root@debian10:~# vi /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sda1 during installation
UUID=def02d03-b923-44c7-802b-6c7e20fd62ac / ext4 errors=remount-ro 0 1
# swap was on /dev/sda5 during installation
UUID=2d7dce9e-7263-415a-a6bf-24d4448f2389 none swap sw 0 0
/dev/sr0 /media/cdrom0 udf,iso9660 user,noauto 0 0
#/dev/sda3 /home/voidx/smb/share ext4 defaults 1 2
root@debian10:~# reboot


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
root@debian10:~# fdisk -l
Disk /dev/sda: 140 GiB, 150323855360 bytes, 293601280 sectors
Disk model: Virtual disk
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x9d31c4bd

Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 31553535 31551488 15G 83 Linux
/dev/sda2 31555582 33552383 1996802 975M 5 Extended
/dev/sda3 33552384 83886079 50333696 24G 83 Linux
/dev/sda5 31555584 33552383 1996800 975M 82 Linux swap / Solaris

Partition table entries are not in disk order.
root@debian10:~# fdisk /dev/sda

Welcome to fdisk (util-linux 2.33.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): d
Partition number (1-3,5, default 5): 3

Partition 3 has been deleted.

Command (m for help): n
Partition type
p primary (1 primary, 1 extended, 2 free)
l logical (numbered from 5)
Select (default p): p
Partition number (3,4, default 3): 3
First sector (31553536-293601279, default 31553536): 33552384
Last sector, +/-sectors or +/-size{K,M,G,T,P} (33552384-293601279, default 293601279):

Created a new partition 3 of type 'Linux' and of size 124 GiB.
Partition #3 contains a ext2 signature.

Do you want to remove the signature? [Y]es/[N]o: y

The signature will be removed by a write command.

Command (m for help): w
The partition table has been altered.
Syncing disks.
root@debian10:~# fdisk -l
Disk /dev/sda: 140 GiB, 150323855360 bytes, 293601280 sectors
Disk model: Virtual disk
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x9d31c4bd

Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 31553535 31551488 15G 83 Linux
/dev/sda2 31555582 33552383 1996802 975M 5 Extended
/dev/sda3 33552384 293601279 260048896 124G 83 Linux
/dev/sda5 31555584 33552383 1996800 975M 82 Linux swap / Solaris

Partition table entries are not in disk order.

root@debian10:~# e2fsck -f /dev/sda3
e2fsck 1.44.5 (15-Dec-2018)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/sda3: 18/1575936 files (0.0% non-contiguous), 2599163/6291456 blocks
root@debian10:~# resize2fs -p /dev/sda3
resize2fs 1.44.5 (15-Dec-2018)
Resizing the filesystem on /dev/sda3 to 32506112 (4k) blocks.
Begin pass 1 (max = 800)
Extending the inode table XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
The filesystem on /dev/sda3 is now 32505856 (4k) blocks long.

root@debian10:~# vi /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sda1 during installation
UUID=def02d03-b923-44c7-802b-6c7e20fd62ac / ext4 errors=remount-ro 0 1
# swap was on /dev/sda5 during installation
UUID=2d7dce9e-7263-415a-a6bf-24d4448f2389 none swap sw 0 0
/dev/sr0 /media/cdrom0 udf,iso9660 user,noauto 0 0
/dev/sda3 /home/voidx/smb/share ext4 defaults 1 2

root@debian10:~# reboot

root@debian10:~# df -Th
Filesystem Type Size Used Avail Use% Mounted on
udev devtmpfs 983M 0 983M 0% /dev
tmpfs tmpfs 200M 4.6M 195M 3% /run
/dev/sda1 ext4 15G 2.7G 12G 20% /
tmpfs tmpfs 997M 0 997M 0% /dev/shm
tmpfs tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs tmpfs 997M 0 997M 0% /sys/fs/cgroup
/dev/sda3 ext4 123G 9.6G 107G 9% /home/voidx/smb/share
tmpfs tmpfs 200M 0 200M 0% /run/user/0

 评论