🚤LVM

type
status
date
slug
summary
tags
category
icon
password
Blocked by
Blocking
AI summary
📎
入门LVM,简单说说LVM中的LV、VG和PV,以及如何创建它们

存储的分类

按照物理介质分类

  • 机械硬盘 HDD
    • 特点:磁盘旋转存储,成本低,容量大,速度较慢(寻道时间影响数据的访问速度
    • 优点:适合海量数据的存储)(冷数据、归档
    • 缺点:随机读写性能差
  • 固态硬盘SSD
    • 特点:基于闪存芯片,随机读写性能强
    • 优点:低延迟、高性能
    • 缺点:成本高,写入寿命有限(芯片写入次数寿命有限
 

按照存储结构分类

  • block storage
    • 数据已固定的块设备存储和访问
    • 适合场景:数据库、虚拟机磁盘
    • 实例:传统SAN存储、iSCSI卷
 
  • file storage
    • 基于块设备,构建文件系统(ext4、xfs)
    • 数据通过文件路径访问,支持文件系统层级结构
    • 适合场景:共享路径、文档存储
    • 实例:NFS
    •  
  • object storage
    • 非结构化数据
    • 数据通过唯一的对象id访问,元数据可以扩展
    • 适合场景:海量非结构化数据,比图片、视频
    • 实例:AWS的s3(simple storage service, ceph object
 
  • network storage device
    • 通过网络协议(NFS、iSCSI、CephFS)访问远程存储资源
    • 存储的底层可以块设备或文件设备,支持集中化管理
 

文件系统类型

  • ext4(fourth extended file system
    • 提供日志功能(journaling):减少意外关机导致的数据损坏
    • 支持大文件和大分区
    • 广泛应用于linux的服务器和桌面系统
    • 是linux的默认文件系统之一
  • xfs
    • 高性能日志文件系统,支持超大文件和分区
    • 支持并发I/O操作,适合多线程读写
    • 设计注重高吞吐和低延迟
    • 支持实时子卷(real-time-subvolume),提供了更加细粒度的大磁盘I/O控制

LVM是什么

LVM(Logical Volume Manager)是 Linux 中的一种逻辑卷管理工具,它通过将物理磁盘分割成更灵活的逻辑卷,提供了更高效的磁盘空间管理方式。LVM的优势在于支持在线扩展和调整存储,不需要重启或大规模停机,非常适合动态变化的存储需求。

PV、VG、LV是什么

lv:logical volume LVM的底层单位,实际的物理存储设备或分区
vg:volume group将多个pv聚合在一起,形成一个存储池
pv:physical volume 从vg中分配可用存储空间,格式化后可以使用
 
notion image
 
 
  • physical volume
  • volume group
  • logical volume
  • mount
 
总结
  1. create PV — pvcreate
  1. create VG — vgcreate
  1. create LV — lvcreate
  1. create a filesystem — mkdf.*
  1. mkdir, mount volume and use
 

understanding snapshot

理解snapshot之前,得先了解logical volume 是如何存储数据的
logical volume由两个基本部分组成
  • metadata pointers
  • data block
创建snapshot时,lvm只需要创建lv的metadata poniter 的副本
 
 

lvm snapshot example

流程:
  1. 创建一个physical volume pv1
  1. 创建一个volume group vp1
  1. 创建一个logical volume lv1
  1. 初始化lv1文件系统
  1. mount 某个路径到lv1
  1. 向lv1文件系统写入一些数据
  1. 给lv1创建 snapshot
  1. 删除lv1文件系统中的数据
  1. 利用snapshot 恢复数据
    1. 将snapshot的lv_snap 合并到lv1中
    2. unmount 之前的路径
    3. 重新激活lv1
    4. 再次mount,可以发现之前已删除数据已经恢复
 

ref

  • 在linux中,通过lvm来创建pv、gv和lv;快照创建和恢复教程
  • k8s从1.20以后开始支持从snapshot导数据进一个新的pvc中
  • lvm对于snapshot 的支持
  • youtube lvm 讲解
Logical Volume Manager (LVM) - basics tutorial
Linux Command Line tutorial for forensics - 35 - Logical Volume Manager ♥️ SUBSCRIBE for more videos: https://www.youtube.com/bluemonkey4n6?sub_confirmation=1 Difficulty Level: advanced Prerequisites: strong understanding of linux command line strong understanding of partitions and file systems In this video, we will look at the logical volume manager that help you get the most out of disk space. Video timeline 00:00 intro 03:16 Physical Volumes 05:46 Volume Groups 07:36 Logical Volumes 10:44 LVM setup ⭕️ For other videos about the Linux command line, see other videos in this series: https://www.youtube.com/playlist?list=PLSbhiuoC0XgX70ZtgJ7d-1rLui0jZRabg Linux distro: CAINE  linux (http://www.caine-live.net) Virtualization software: Virtual Box (http://virtualbox.org) Icons made by freepik from @flaticon http://www.flaticon.com/authors/freepik Icons made by Smashicons from  ttp://www.flaticon.com/authors/smashicons This course was designed to provide information on how to use the command line environment in a Unix/Linux system to accomplish tasks such as imaging, data acquisition, and archiving.  his course covers the basics of Unix/Linux commands that allow users to view and edit text files, obtain hardware and system information, partitioning and formatting, process related commands, manipulating disks and partitions, imaging, archiving, logical acquisition, live system response, and basic networking. This would be beneficial for folks who are interested in #digitalforensics, #incidenceresponse, system administration, ethical hacking, or just plain linux.  his course covers material for beginners as well as for advanced users. This course would also be helpful if you are considering taking the CompTIA Linux+ certification test. #DFIR #Linux #LVM
Logical Volume Manager (LVM) - basics tutorial
Logical Volume Manager (LVM) - creating and restoring snapshots
Linux Command Line tutorial for forensics - 37 - Logical Volume Manager - creating and restoring snapshots ♥️ SUBSCRIBE for more videos: https://www.youtube.com/bluemonkey4n6?sub_confirmation=1 Difficulty Level: advanced Prerequisites: strong understanding of linux command line strong understanding of partitions and file systems basic understanding of LVMs (https://www.youtube.com/watch?v=JlWiNnuMm_4) In this video, we will look at creating and restoring snapshots with the logical volume manager. Video timeline 00:00 intro 01:19 Creating snapshots 05:56 Viewing snapshot 07:07 Modifying the original logical volume 07:50 Restoring snapshots ⭕️ For other videos about the Linux command line, see other videos in this series: https://www.youtube.com/playlist?list=PLSbhiuoC0XgX70ZtgJ7d-1rLui0jZRabg Linux distro: CAINE  linux (http://www.caine-live.net) Virtualization software: Virtual Box (http://virtualbox.org) Icons made by freepik from @flaticon http://www.flaticon.com/authors/freepik Icons made by Smashicons from  ttp://www.flaticon.com/authors/smashicons This course was designed to provide information on how to use the command line environment in a Unix/Linux system to accomplish tasks such as imaging, data acquisition, and archiving.  his course covers the basics of Unix/Linux commands that allow users to view and edit text files, obtain hardware and system information, partitioning and formatting, process related commands, manipulating disks and partitions, imaging, archiving, logical acquisition, live system response, and basic networking. This would be beneficial for folks who are interested in #digitalforensics, #incidenceresponse, system administration, ethical hacking, or just plain linux.  his course covers material for beginners as well as for advanced users. This course would also be helpful if you are considering taking the CompTIA Linux+ certification test. #DFIR #Linux #LVM
Logical Volume Manager (LVM) - creating and restoring snapshots
 
Prev
iptables in linux
Next
HELM
Loading...
Article List