Linux 建立LVM(Logical Volume)
近期和其它同事參與了儲存的劃分,由於工作性質,這方面的命令已經特別陌生,重新梳理了LVM建立過程,以便不時之需;
---1 作業系統版本
[root@chen ~]# cat /etc/issue
Red Hat Enterprise Linux Server release 6.4 (Santiago)
Kernel \r on an \m
---2 需要建立LVM的磁碟
[root@chen ~]# fdisk -l
Disk /dev/sdb: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/sdc: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/sdd: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
---3 建立PV(Physical Volume)
[root@chen ~]# pvcreate /dev/sdb
Physical volume "/dev/sdb" successfully created
[root@chen ~]# pvcreate /dev/sdc
Physical volume "/dev/sdc" successfully created
[root@chen ~]# pvcreate /dev/sdd
Physical volume "/dev/sdd" successfully created
---4 檢視PV
[root@chen ~]# pvdisplay
"/dev/sdb" is a new physical volume of "1.00 GiB"
--- NEW Physical volume ---
PV Name /dev/sdb
VG Name
PV Size 1.00 GiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID JA8nPJ-LP8N-cw1U-qCY3-0yiD-yYJd-XiiHBq
"/dev/sdc" is a new physical volume of "1.00 GiB"
--- NEW Physical volume ---
PV Name /dev/sdc
VG Name
PV Size 1.00 GiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID CRoe30-68V7-vVgt-QKss-kS3H-pufb-znImot
"/dev/sdd" is a new physical volume of "1.00 GiB"
--- NEW Physical volume ---
PV Name /dev/sdd
VG Name
PV Size 1.00 GiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID sb7VKF-JY1B-vACE-hUZI-e2KQ-PfXe-CMCBVF
[root@chen ~]# pvscan
PV /dev/sdb lvm2 [1.00 GiB]
PV /dev/sdc lvm2 [1.00 GiB]
PV /dev/sdd lvm2 [1.00 GiB]
Total: 3 [3.00 GiB] / in use: 0 [0 ] / in no VG: 3 [3.00 GiB]
---5 建立VG(Volumne Group)
[root@chen ~]# vgcreate VolGroup001 /dev/sdb /dev/sdc /dev/sdd
Volume group "VolGroup001" successfully created
---6 檢視VG
[root@chen ~]# vgdisplay
--- Volume group ---
VG Name VolGroup001
System ID
Format lvm2
Metadata Areas 3
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 3
Act PV 3
VG Size 2.99 GiB
PE Size 4.00 MiB
Total PE 765
Alloc PE / Size 0 / 0
Free PE / Size 765 / 2.99 GiB
VG UUID DwFmKs-LONs-aF91-vrHt-9C9S-YoyQ-CLGwRn
[root@chen ~]# vgscan
Reading all physical volumes. This may take a while...
Found volume group "VolGroup001" using metadata type lvm2
---7 建立LV(Logical Volume)
[root@chen ~]# lvcreate -L 2G -n lvData01 VolGroup001
Logical volume "lvData01" created
---8 檢視LV
[root@chen ~]# lvdisplay
--- Logical volume ---
LV Path /dev/VolGroup001/lvData01
LV Name lvData01
VG Name VolGroup001
LV UUID 5V8LUf-I835-isBg-l0zN-tfhI-XmkS-sibQ7s
LV Write Access read/write
LV Creation host, time chen, 2018-04-19 23:43:42 +0800
LV Status available
# open 0
LV Size 2.00 GiB
Current LE 512
Segments 3
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
[root@chen ~]# lvscan
ACTIVE '/dev/VolGroup001/lvData01' [2.00 GiB] inherit
[root@chen ~]# fdisk -l
......
Disk /dev/mapper/VolGroup001-lvData01: 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/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
---9 格式化
[root@chen ~]# mkfs -t ext4 /dev/mapper/VolGroup001-lvData01
---10 掛載
[root@chen ~]# mkdir /data
[root@chen ~]# mount /dev/VolGroup001/lvData01 /data
[root@chen ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 48G 29G 16G 65% /
tmpfs 932M 76K 932M 1% /dev/shm
/dev/sda1 194M 33M 152M 18% /boot
/dev/sr0 3.5G 3.5G 0 100% /media/RHEL_6.4 x86_64 Disc 1
/dev/mapper/VolGroup001-lvData01
2.0G 67M 1.9G 4% /data
[root@chen ~]# vi /etc/fstab
/dev/mapper/VolGroup001-lvData01 /data ext4 defaults 0 0
歡迎關注我的微信公眾號"IT小Chen",共同學習,共同成長!!!
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29785807/viewspace-2153105/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Linux LVM Logical Volume Management 邏輯卷的管理LinuxLVM
- Oracle DG建立Logical Standby DatabaseOracleDatabase
- 在 Linux 中建立 LVM 分割槽的分步指南LinuxLVM
- docker建立volume 指定volume 匯出image 匯入imageDocker
- Linux LVMLinuxLVM
- [20181113]Logical Standby建立2.txt
- linux之lvmLinuxLVM
- 使用Linux lvmLinuxLVM
- linux snapper/lvm2卷 建立、備份與恢復LinuxAPPLVM
- Linux(06):LVM 案例LinuxLVM
- linux LVM詳解LinuxLVM
- 4 Creating a Logical Standby Database 建立邏輯備庫Database
- Linux(05):LVM簡介LinuxLVM
- LVM詳細介紹及建立LVM
- LVM建立的詳細步驟LVM
- Linux作業系統邏輯盤卷管理LVM建立步驟(轉)Linux作業系統LVM
- Linux 新增LVM分割槽及LVM分割槽擴容LinuxLVM
- Linux中LVM是什麼?LVM名詞有哪些?LinuxLVM
- linux之LVM邏輯卷LinuxLVM
- linux 給lvm磁碟擴容LinuxLVM
- Linux擴充套件LVM空間Linux套件LVM
- Linux中的LVM和軟RAIDLinuxLVMAI
- Linux下LVM邏輯卷管理LinuxLVM
- 在Linux中,LVM是什麼?LinuxLVM
- Linux中lvm分割槽是什麼?LVM優缺點有哪些?LinuxLVM
- 修改 VOLUME 自動建立預設許可權問題
- Linux LVM磁碟管理與FS掛載LinuxLVM
- Linux作業系統中分割槽格式轉換LVM格式及多磁碟建立PV、VG、LVLinux作業系統LVM
- Centos8中建立LVM精簡邏輯卷CentOSLVM
- Linux—磁碟配額,管理LVM邏輯卷LinuxLVM
- 在Linux中,如何使用LVM管理邏輯卷?LinuxLVM
- How to Optimize PostgreSQL Logical ReplicationSQL
- 1.1 Logical Structure of Database ClusterStructDatabase
- Linux中raid和lvm有什麼區別?Linux學習教程LinuxAILVM
- lvmLVM
- 實操CentOS8系統中建立LVM邏輯卷CentOSLVM
- Linux的LVM與磁碟配額(理論+配寫)LinuxLVM
- kubernetes物件之Volume物件