Linux下LVM邏輯卷管理
分割槽
[root@db01 ~]# fdisk -l
Disk /dev/sda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 1305 10377990 8e Linux LVM
Disk /dev/sdb: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdb doesn't contain a valid partition table
[root@db01 ~]#
[root@db01 ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. 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)
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-652, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-652, default 652):
Using default value 652
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@db01 ~]#
[root@db01 ~]# fdisk -l
Disk /dev/sda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 1305 10377990 8e Linux LVM
Disk /dev/sdb: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 652 5237158+ 83 Linux
[root@db01 ~]#
[root@db01 ~]#
[root@db01 ~]# pvcreate /dev/sdb1
Physical volume "/dev/sdb1" successfully created
[root@db01 ~]#
[root@db01 ~]# vgcreate testvg /dev/sdb1
/dev/hdc: open failed: No medium found
Volume group "testvg" successfully created
[root@db01 ~]#
[root@db01 ~]# vgdisplay
--- Volume group ---
VG Name testvg
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 4.99 GB
PE Size 4.00 MB
Total PE 1278
Alloc PE / Size 0 / 0
Free PE / Size 1278 / 4.99 GB
VG UUID SMGvyj-hKdO-ILqF-Z9y3-1qPb-WHyQ-K7zN5d
--- Volume group ---
VG Name VolGroup00
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 3
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 1
Act PV 1
VG Size 9.88 GB
PE Size 32.00 MB
Total PE 316
Alloc PE / Size 316 / 9.88 GB
Free PE / Size 0 / 0
VG UUID wH67cF-9Z6s-YEXC-yf0U-q0ep-NK0g-7gC25V
[root@db01 ~]#
[root@db01 ~]#
Logical volume "lv_test01" created
[root@db01 ~]#
[root@db01 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
7.7G 4.3G 3.0G 60% /
/dev/sda1 99M 12M 82M 13% /boot
tmpfs 506M 0 506M 0% /dev/shm
新建lv
建立pv
pvcreate /dev/sdb1
建立vg
vgcreate testvg /dev/sdb1
建立lv,單位是M
或指定pe數量
擴充套件lv
將sdc2擴充套件加到testvg中
vgextend testvg /dev/sdc2
將lv_test01擴充套件到12G
lvextend -L12G /dev/testvg/lv_test01
將lv_test01增加1G
lvextend -L +1G /dev/testvg/lv_test01
檔案系統
建立ext3格式檔案系統
mkfs.ext3 /dev/testvg/lv_test01
或者
mkfs -t ext3 /dev/testvg/lv_test01
掛載到/mount_test
mount /dev/testvg/lv_test01 /mount_test
擴充套件lv後需對檔案系統resize(正對ext2、ext3、ext4等)
df –h –T 檢視檔案系統格式
e2fsck -f /dev/testvg/lv_test01 -- 可不執行
resize2fs -p /dev/testvg/lv_test01
如果檔案系統格式為reiserfs
resize_reiserfs -f /dev/testvg/lv_test01
刪除
刪除testvg中的pv,pvdisplay確認pv是否在用
vgreduce testvg /dev/hda1
刪除lv
umount /dev/testvg/lv_test01
lvremove /dev/testvg/lv_test01
啟用 vg
取消啟用vg
vgchange -an /dev/vg001
啟用vg
vgchange -ay vg001
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26964624/viewspace-2564488/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- LVM 邏輯卷管理LVM
- Linux—磁碟配額,管理LVM邏輯卷LinuxLVM
- linux之LVM邏輯卷LinuxLVM
- LVM_邏輯卷管理LVM
- 在Linux中,如何使用LVM管理邏輯卷?LinuxLVM
- Linux LVM Logical Volume Management 邏輯卷的管理LinuxLVM
- 如何在 Ubuntu 中管理和使用邏輯卷管理 LVMUbuntuLVM
- Linux作業系統邏輯盤卷管理LVM建立步驟(轉)Linux作業系統LVM
- 什麼是LVM邏輯卷管理?0基礎學Linux運維LVMLinux運維
- 一文全解:LVM(邏輯卷管理器)LVM
- 『學了就忘』Linux檔案系統管理 — 65、LVM邏輯卷管理介紹LinuxLVM
- lvm收縮邏輯卷空間LVM
- lvm 擴充邏輯卷空間(linux的磁碟擴容)LVMLinux
- linux 磁碟分割槽掛載-LVM-物理卷PV,卷組VG,邏輯卷LVLinuxLVM
- Centos8中建立LVM精簡邏輯卷CentOSLVM
- Linux下的磁碟分割槽和邏輯卷Linux
- Linux-使用者管理與建立邏輯卷Linux
- 在LVM中恢復已刪除的邏輯卷LVM
- Lvm邏輯卷管理、建立、使用、擴充套件、縮減、遷移、快照、恢復LVM套件
- linux 磁碟自動化分割槽掛載-LVM-物理卷PV,卷組VG,邏輯卷LV-shellLinuxLVM
- linux系統下分割槽邏輯卷擴容Linux
- linux系統掛載邏輯卷和擴充套件邏輯卷組Linux套件
- ENGINEER01 - 分割槽規劃和使用,LVM邏輯卷LVM
- LVM邏輯卷線上動態擴容磁碟空間LVM
- 實操CentOS8系統中建立LVM邏輯卷CentOSLVM
- 手把手教學----LVM邏輯卷管理與磁碟配額實操全流程LVM
- 如何新建邏輯卷及磁碟掛載,邏輯卷擴容
- Linux硬碟掛載與磁碟分割槽基礎(二)(物理卷、卷組、邏輯卷)Linux硬碟
- Centos7使用SSM管理LVM卷CentOSSSMLVM
- Linux下使用LVM管理(擴充套件/縮小/刪除)LinuxLVM套件
- 如何在 Linux 分割槽或邏輯卷中建立檔案系統Linux
- Centos8中遷移邏輯卷CentOS
- linux snapper/lvm2卷 建立、備份與恢復LinuxAPPLVM
- 如何在CentOS/RHEL 7上藉助ssm管理LVM卷?CentOSSSMLVM
- Linux LVM磁碟管理與FS掛載LinuxLVM
- 11 管理邏輯備庫
- Linux LVMLinuxLVM
- 邏輯、集合運算上的卷積一覽(FMT、FWT,……)卷積