fdisk and parted partition

There are two types of linux partitions I contact: one is using fdisk partition, and the other is parted partition. The former is for MBR mode partiti...

There are two types of linux partitions I contact: one is using fdisk partition, and the other is parted partition. The former is for MBR mode partition, and the latter is for GPT mode partition

fdisk partition:

Fdisk - L ----- > view disk information
Fdisk / dev / SDC -- > select the disk to operate (eg:/dev/sdc)

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)

1 Create a partition example: 2 Command (m for help): n 3 Partition type: 4 p primary (0 primary, 0 extended, 4 free) 5 e extended 6 Select (default p): p 7 Partition number (1-4, default 1): 1 8 First sector (2048-4194303, default 2048): 9 Using default value 2048 10 Last sector, +sectors or +size (2048-4194303, default 4194303): 11 Using default value 4194303 12 Partition 1 of type Linux and of size 2 GiB is set 13 14 Command (m for help): t 15 Selected partition 1 16 Hex code (type L to list all codes): 8e 17 Changed type of partition 'Linux' to 'Linux LVM'

Creating and expanding logical volumes

[root@localhost ~]# pvcreate /dev/sdc1 ---->Establish pv Physical volume "/dev/sdc1" successfully created [root@localhost ~]# vgextend rhel /dev/sdc1 ---->extend vg Volume group Volume group "rhel" successfully extended [root@localhost ~]# vgreduce rhel /dev/sdc1 --->If you don't want to join the existing vg Inside, I want to build one myself vg Volume group, expand the pv Remove it, Removed "/dev/sdc1" from volume group "rhel" [root@localhost ~]# vgcreate vg2 /dev/sdc1 --->Create new vg,And set up vg be known as vg2 Volume group "vg2" successfully created [root@localhost ~]# lvextend /dev/rhel/root /dev/sdc1 Physical Volume "/dev/sdc1" not found in Volume Group "rhel". --->No addition vg Group, directly expanding to logical volume will report error,To expand, first vgextend To the corresponding vg group [root@localhost ~]# pvremove /dev/sdc1 ---->remove pv Labels on physical volume "/dev/sdc1" successfully wiped
as lvextend If wrong entry is added, it will be solved as follows [root@localhost ~]# lvextend /dev/rhel/root /dev/sdc1 ---->Will expand/dev/sdc1 Extend to/dev/rhe1/root After that, I feel the extension error. How to exit, Size of logical volume rhel/root changed from 90.46 GiB (23158 extents) to 92.46 GiB (23669 extents). --->Remember that. extents Size, from 23158 to 23669 Logical volume root successfully resized [root@localhost ~]# lvreduce -l 23158 /dev/rhel/root ---->This is going to be extended/dev/sdc1 Back out,-l Parameter assignment extents Size, specify reduced/dev/rhel/root Size WARNING: Reducing active and open logical volume to 90.46 GiB THIS MAY DESTROY YOUR DATA (filesystem etc.) Do you really want to reduce root? [y/n]: y Size of logical volume rhel/root changed from 92.46 GiB (23669 extents) to 90.46 GiB (23158 extents). Logical volume root successfully resized ---->Success, can be re expanded later

[root @ localhost ~] ා lvcreate - L + 100% free rhel / dev / SDC1 - n lv2 ---- ----- > recreate an lv volume, - n parameter specifies that the created volume name rhel is a volume group, and
Logical volume "lv2" created.

3 December 2019, 21:12 | Views: 4460

Add new comment

For adding a comment, please log in
or create account

0 comments