In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the characteristics of LVM, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.
LVM (Logical Volume Manager) logical volume management is a logical layer added between the hard disk partition and the file system, shielding the underlying hard disk partition layout for the file system, and providing an abstract disk volume to establish the file system on the disk volume.
Basic features of LVM: (cluster logical volume management can be realized through plug-in CLVM)
PV physical Volume
LV logical volumes (logical volume management: an abstraction layer is generated on physical storage to create logical storage volumes to facilitate device naming) (the following is the classification of logical volumes) Linear linear volumes (this is the default lvm form, which occupies disks sequentially By default, each PE size is 4MB2: create VG (volume group), but it is actually a space pool. Different PV join the same VG3: create LV (logical volume). The PE that makes up LV may come from different physical disks 4: format LV Narrator area vgcfgrestore recovery volume group descriptor area vgchange change volume group properties vgck check volume group metadata vgconvert convert volume group metadata format vgcreate create volume group vgdisplay display volume group properties vgexport so that the volume group does not know (what is this) vgextend add physical volumes to the volume group vgimportclone import and rename duplicate volume groups (such as hardware snapshots) vgmerge merge two volume groups vgmknodes recreate the volume group directory and logic Volume Special File vgreduce reduces volume groups by deleting one or more physical volumes (kicking physical volumes out of VG) vgremove deletes volume groups vgrename renames volume groups vgs reports about volume group information vgscan scans all disks of volume groups and rebuilds cache vgsplit splits volume groups into two Move any logical volume from one volume group to another by moving the entire physical volume lv operation commands lvchange change logical volume properties lvconvert convert logical volumes from linear to mirror or snapshot lvcreate create logical volumes in existing volume groups lvdisplay display logical volume properties lvextend extended logical volume size lvmconfig displays configuration information lvmdiskscan scans all settings visible by lvm2 after loading lvm.conf and any other configuration file Prepare lvmdump to create lvm2 information dump for diagnostic purposes lvreduce reduce logical volume size lvremove delete logical volume lvrename rename logical volume lvresize resize logical volume lvs report information about logical volumes lvscan scan all logical volumes PV management create PVpvcreate / dev/sdb1 delete pv revocation PV (need to kick out vg first) pvremove / dev/sdb1VG management make VGvgcreate datavg / dev/sdb1vgcreate datavg / dev/sdb1 / dev/sdb2# explanation: Vgcreate vg name partition vgcreate-s 16m datavg2 / dev/sdb3# explanation:-s specifies that the size of pe is 16m By default, it is not specified that 4m removes the missing disk vgreduce from the volume group-- removemissing datavgvgreduce-- removemissing datavg-- force # forcefully removes the extended VG space vgextend datavg / dev/sdb3pvs kicks out a member of the vg vgreduce datavg / dev/sdb3vgsLV management to create LVlvcreate-n lvdata1-L 1.5G datavg# interpretation:-n lv's name,-L specifies the size of lv, datavg is the name of vg Indicates that a snapshot of LVM is forcibly activated from the logical volume lvchange-ay / dev/datavg/lvdata1lvchange-ay / dev/datavg/lvdata1-K # after vg activation repair
Purpose: note that the purpose is data consistent backup, first make a snapshot, freeze the current system, so that the contents of the snapshot can remain unchanged for the time being, and the system itself continues to run, by re-mounting the backup snapshot volume to achieve uninterrupted backup.
Lvcreate-s-n kuaizhao01-L 100m / dev/datavg/lvdata1 View, delete usage 1: view physical volume information pvs,pvdisplay2: view volume group information vgs,vgdisplay3: view logical volume information lvs,lvdisplay4: delete LVlvremove / dev/mapper/VG-mylv5: delete VGvgremove VG6: delete PV (note that the deletion order is LV,VG,PV) pvremove / dev/sdbvg volume group rename
Vgrename xxxx-vgid-xxxx-xxxx xinname
Stretch a logical volume LV1: use vgdisplay to see how much free space is left in vg 2: extend the logical volume lvextend-L + 1G / dev/VG/LV01lvextend-L + 1G / dev/VG/LV01-r # this command indicates that the file system is updated while it is extended, but not all distributions support it, except for some file systems that do not support online extension 3: after the extension operation Df-h you will find that the size has not changed 4: update the file system (contend for different file systems, the update command is also different) e2fsck-f / dev/datavg/lvdata1 # ext4 file system, check the lv file system resize2fs / dev/VG/LV01 # ext4 file system command, this command is followed by the lv device name on the xfs_growfs / nas # xfs file system, which is directly followed by the mount point when the file system is updated You will find that df-h shrinks logical volume LV (must be offline, umount) 1: uninstall 2: shrink file system resize2fs / dev/VG/LV01 2G3: shrink LVlvreduce-L-1G / dev/VG/LV014: view lvs, mount use stretch a volume group VG1: insert a new hard disk, if it is not a hot-swappable disk, you can try this to force refresh the hard disk interface for i in / sys/class/scsi_host/* on the system Do echo "- -" > $i/scan Done2: striping / dev/sdd Formatted as PEpvcreate / dev/sdd3: add a new PV to the existing VG vgextend VG / dev/sdd4: view the size of the vgs reduced volume group VG (make sure no PE is in use) 1: remove a PV from the specified volume vgreduce VG / dev/sdd2: view the reduced volume group size add and kick disks into and out of the VG kick sdd1 out of the datavg group vgreduce datavg / dev/sdd1 add sdb1 to the datavg group vgextend datavg / dev/sdb1lvm disaster recovery Complex scene case # scene reproduction: three disks to do lvm Now a piece of physics is broken. Put the remaining two pieces on other linux servers # recovery step 1, check the disk information, lvm information, make sure you can find the lvm-related information, and find the name of the VG group (pvs,lvs,vgs,fidsk,blkid). Second: delete the damaged disk roles in the lvm information. (forced failure disk) "vgreduce-removemissing VG_name" third: forced activation of VG group "vgchange-ay" fourth: forced activation of LVM "lvchange-ay / dev/VG_name" fifth: thank you for attentively reading this article. I hope the article "what are the characteristics of LVM" shared by the editor will be helpful to you. At the same time, I also hope that you will support and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
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.