LVM HOWTO

LVM is a linux storage solution and here is the link for a beginner's howto:


lvm howto


1 LVM Overview

The Linux Logical Volume Manager (LVM) is a mechanism for virtualizing disks. It can create "virtual" disk partitions out of one or more physical hard drives, allowing you to grow, shrink, or move those partitions from drive to drive as your needs change. It also allows you to create larger partitions than you could achieve with a single drive.

LVM can be the back-end storage solution for OpenStack Cinder(Block Storage) and Swift(Object Storage).

2 LVM Layout

Basically LVM looks like this:

Thumbnail, click for full-size image.



3 Show Disk Partitions

Show the partitions of the hard disks:

fdisk -l


4 Create Physical Volumes and Display them

Create the physical volumes on the disk partitions:

pvcreate /dev/sda1 /dev/sdb2 /dev/sdc3

pvdisplay 



5 Create Volume Groups and Other Operations for them

Create a volume group named "filevg" on the physical volumes, then show/rename/remove it:

vgcreate filevg /dev/sda1 /dev/sdb2 /dev/sdc3

vgdisplay 

vgrename filevg datavg

vgscan

vgremove datavg




6 Operations of Logical Volumes

Next we create our logical volumes share (40GB), backup (5GB), and media (1GB) in the volume group fileserver. Together they use a little less than 50% of the available space (that way we can make use of RAID1 later on):

lvcreate --name share --size 40G fileserver

lvcreate --name backup --size 5G fileserver

lvcreate --name media --size 1G fileserver

lvdisplay; lvscan;  lvrename;  lvextend;  lvreduce;


7 Build File Systems and Mount the Logical Volumes

Build three file systems on above created logical volumes:


mkfs.ext3 /dev/fileserver/share

mkfs.xfs /dev/fileserver/backup

mkfs.reiserfs /dev/fileserver/media


Now we are ready to mount our logical volumes. I want to mount share in /var/sharebackup in /var/backup, and media in /var/media, therefore we must create these directories first:

mkdir /var/media /var/backup /var/share

Now we can mount our logical volumes:

mount /dev/fileserver/share /var/share
mount /dev/fileserver/backup /var/backup
mount /dev/fileserver/media /var/media

Now try to use them as normal file systems.


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值