[root@iZbp1b8rhdgos3uz4tbcgsZ ~]# fdisk /dev/vdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x33939107.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1040253, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-1040253, default 1040253):
Using default value 1040253
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@iZbp1b8rhdgos3uz4tbcgsZ ~]# pvcreate /dev/vdb1
Physical volume "/dev/vdb1" successfully created
[root@iZbp1b8rhdgos3uz4tbcgsZ ~]# vgcreate vg_data /dev/vdb1
Volume group "vg_data" successfully created
[root@iZbp1b8rhdgos3uz4tbcgsZ ~]# vgdisplay
--- Volume group ---
VG Name vg_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 500.00 GiB
PE Size 4.00 MiB
Total PE 127999
Alloc PE / Size 0 / 0
Free PE / Size 127999 / 500.00 GiB
VG UUID OdvQI1-ly0T-uGfc-bNDe-iwIY-FbCi-cNHMnf
[root@iZbp1b8rhdgos3uz4tbcgsZ ~]# lvcreate -l +127999 -n lv_home vg_data
Rounding up size to full physical extent 125.00 GiB
Logical volume "lv_home" created
[root@iZbp1b8rhdgos3uz4tbcgsZ ~]# vgdisplay
--- Volume group ---
VG Name vg_data
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 2
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 0
Max PV 0
Cur PV 1
Act PV 1
VG Size 500.00 GiB
PE Size 4.00 MiB
Total PE 127999
Alloc PE / Size 32000 / 125.00 GiB
Free PE / Size 95999 / 375.00 GiB
VG UUID OdvQI1-ly0T-uGfc-bNDe-iwIY-FbCi-cNHMnf
[root@iZbp1b8rhdgos3uz4tbcgsZ ~]# lvscan
ACTIVE '/dev/vg_data/lv_home' [125.00 GiB] inherit
[root@iZbp1b8rhdgos3uz4tbcgsZ ~]# lvextend -l +92999 /dev/vg_data/lv_home
Extending logical volume lv_home to 488.28 GiB
Logical volume lv_home successfully resized
[root@iZbp1b8rhdgos3uz4tbcgsZ ~]# resize2fs /dev/vg_data/lv_home
resize2fs 1.41.12 (17-May-2010)
resize2fs: Bad magic number in super-block while trying to open /dev/vg_data/lv_home
Couldn't find valid filesystem superblock.
[root@iZbp1b8rhdgos3uz4tbcgsZ ~]# mkfs.ext4 -c /dev/vg_data/lv_home
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
32006144 inodes, 127998976 blocks
6399948 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
3907 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, 20480000, 23887872, 71663616, 78675968,
102400000
Checking for bad blocks (read-only test): 36.78% done, 22:00 elapsed
参考:https://blog.csdn.net/taiyang1987912/article/details/46328883
https://www.cnblogs.com/logicalsky/p/8502820.html
没有帐号? 立即注册