In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
9 introduction to Linux LVM9.1.1 LVM in Appendix 9.1
LVM is short for Logical Volume Manager (logical Volume Management), which is implemented by Heinz Mauelshagen on the Linux 2.4 kernel. LVM collects the partitions of one or more hard disks logically, which is equivalent to a large hard disk to use. When the hard disk space is not enough, you can continue to add the partitions of other hard disks to it, which can realize the dynamic management of disk space. Compared with ordinary disk partitions, it has great flexibility.
Compared with traditional disks and partitions, LVM provides a higher level of disk storage for computers. It makes it more convenient for system administrators to allocate storage space for applications and users. Storage volumes managed by LVM can be resized and removed at any time as needed (file system tools may need to be upgraded). LVM also allows storage volumes to be managed by user groups, allowing administrators to identify storage volumes with more intuitive names such as "sales", "development" instead of physical disk names such as "sda", "sdb".
The LVM model is shown in the figure:
Four disk partitions can form a large space, and then divide some logical partitions on these spaces. When there is not enough space in a logical partition, you can divide some space from the remaining space for partitions that do not have enough space.
9.1.2 basic terminology of LVM
As mentioned earlier, LVM is a logical layer added between the disk partition and the file system to shield the underlying disk partition layout for the file system, provide an abstract volume, and establish the file system on the volume. First, let's discuss the following LVM terms:
Physical storage medium (The physical media): in this case, the storage device of the system: the hard disk, such as / dev/hda1, / dev/sda, etc., is the storage unit at the lowest level of the storage system.
Physical volume (Physical Volume): a physical volume refers to a hard disk partition or a device that logically has the same function as a disk partition (such as RAID). It is the basic storage logic block of LVM, but compared with basic physical storage media (such as partitions, disks, etc.), it contains management parameters related to LVM.
Volume group (Volume Group): a LVM volume group is similar to a physical hard disk in a non-LVM system and consists of physical volumes. You can create one or more "LVM partitions" (logical volumes) on a volume group, and the LVM volume group consists of one or more physical volumes.
Logical volumes (Logical Volume): LVM's logical volumes are similar to hard disk partitions in non-LVM systems, and file systems can be established on top of logical volumes (such as / home or / usr, etc.).
PE (Physical Extent): each physical volume is divided into basic units called PE (Physical Extents), and PE with a unique number is the smallest unit that can be addressed by LVM. The size of PE is configurable and defaults to 4MB.
LE (Logical Extent): logical volumes are also divided into basic addressable units called LE (Logical Extents). In the same volume group, the size of LE and PE are the same and correspond one to one.
To put it simply:
PV: is a physical disk partition
The physical disk partition in VG:LVM, that is, PV, must be added to VG, which can be understood as a warehouse or several large hard drives.
LV: that is, the logical partition from the VG
The following figure shows the relationship among PV, VG, and LV:
9.1.3 install LVM
First determine if the lvm tool is installed on the system:
[root@rhel65 ~] # rpm-qa | grep lvm
Mesa-private-llvm-3.3-0.3.rc3.el6.x86_64
Lvm2-libs-2.02.100-8.el6.x86_64
Lvm2-2.02.100-8.el6.x86_64
If the command result input is similar to the above example, then the system has installed the LVM management tool; if the command has no output, it means that the LVM management tool is not installed, then you need to download it from the network or install the LVM rpm toolkit from the CD.
9.1.4 create and manage LVM
To create a LVM system, you generally need to go through the following steps:
1. Create a partition
Use partition tools (such as fdisk, etc.) to create LVM partitions in the same way as other general partitions, except that the partition type of LVM is 8e.
[root@rhel65 ~] # fdisk-l
Disk / dev/sda: 21.5 GB, 21474836480 bytes
64 heads, 32 sectors/track, 20480 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000059fe
Device Boot Start End Blocks Id System
/ dev/sda1 * 2 501 512000 83 Linux
/ dev/sda2 502 20480 20458496 8e Linux LVM
Disk / dev/mapper/VolGroup-lv_root: 18.8 GB, 18798870528 bytes
255 heads, 63 sectors/track, 2285 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk / dev/mapper/VolGroup-lv_swap: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk / dev/sdb: 53.7 GB, 53687091200 bytes
64 heads, 32 sectors/track, 51200 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Use fdisk to create partitions and enter partition management according to the absolute path of the device file (/ dev/hda)
[root@rhel65 ~] # fdisk / dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x4849a8f8.
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): M
Command action
A toggle a bootable flag
B edit bsd disklabel
C toggle the dos compatibility flag
D delete a partition
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
Command action
E extended
P primary partition (1-4)
P
Partition number (1-4): 1
First cylinder (1-51200, default 1):
Using default value 1
Last cylinder, + cylinders or + size {KMagne Mpeng} (1-51200, default 51200): + 10G
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): l
0 Empty 24 NEC DOS 81 Minix / old Lin bf Solaris
1 FAT12 39 Plan 9 82 Linux swap / So C1 DRDOS/sec (FAT-
2 XENIX root 3c PartitionMagic 83 Linux c4 DRDOS/sec (FAT-
3 XENIX usr 40 Venix 80286 84 OS/2 hidden C: C6 DRDOS/sec (FAT-
4 FAT16
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.