Beginner’s guide to lvm (logical volume management) - PowerPoint PPT Presentation

About This Presentation
Title:

Beginner’s guide to lvm (logical volume management)

Description:

This Presentation show the how to work with LVM (Logical Volume Management) on Linux. – PowerPoint PPT presentation

Number of Views:1221
Slides: 10
Provided by: cbitssexp34

less

Transcript and Presenter's Notes

Title: Beginner’s guide to lvm (logical volume management)


1
Beginners Guide to LVM (Logical Volume
Management)
2
  • In this presentation we will discuss about
    logical volume management. LVM or Logical Volume
    Management is a disk management tool that makes
    it easier to manage hard disk space. With the
    help of LVM we can easily manage our partitions,
    we can expand our partitions, reduce them,
    replace an incorrect disk or add a new disk to
    increase capacity. It is one of the important
    skills that you need to acquire if you work as a
    system administrator

3
How does LVM work ?
  • Before we learn how to create LVMs, we will
    briefly discuss how it works and will learn some
    of the terms associated with LVM.
  • To create LVM, we must first create simple
    partition with partition ID 8e with fdisk
    command. For this tutorial we use two discs, ie.
    / dev/sdb and / dev/sdc,
  • Then we will create physical volumes (aka PV) of
    these newly partitioned disks. Each physical
    volume can be a disk partition or even an entire
    disk.
  • After the creation of PVs, we create Volume
    Groups or VGs from physical volumes. VGs collects
    partitions in an administrative unit,
  • Finally, logical volumes or LVs are created from
    volume groups. LV corresponds to a disk partition.

Now that we have some idea of ??LVM, we will now
proceed to create an LVM
4
Creating a LVM
  • As mentioned above, we will first create
    partitions of disks / dev / sdb / dev / sdc
    with partition id 8e. The process for doing so is
    as follows
  • First we will prepare / dev / sdb disk for
    Logical Volume Management, start with

fdisk /dev/sdb
  • Type "n" to create a new partition,
  • Next type 'p' to create the primary partition
    (since this is a new disk, the partition number
    will be 1)
  • Nest for first cylinder value and last cylinder
    value, press enter to use default values, ie full
    hdd space
  • Type "t" to access the partition followed by "1"
    (partition number)
  • Now this is the part where we will enter
    partition ID to create LVM, ie 8e. Type '8e' now
    and press 'w' to write changes.

We have partitioned / dev / sdb to create LVM,
the same step should be repeated for / dev / sdc.
When both discs are prepared, we will move on to
the next step, ie. Create physical volume,
5
Creating Physical Volume
  • To create PV we use the command "pvcreate",

pvcreate /dev/sdb /dev/sdc
You will receive confirmation that physical
volume has been created. We can see and confirm
the newly created physical volume with 'pvd
display'
6
Creating Volume Group
  • Finally, we will create logical volume from the
    volume group 'vg01' using the 'lvcreate' command

lvcreate l 25G n lv01 vg01
Here, "-l 25G" means the size of the logical
volume, "-n lv01" means the name of LV is lv01
"vg01" is the name of Volume group. Use the
"lvdisplay" command to see the information about
the new LV
lvdsplay /dev/vg01/lv01
Now our LV has been created but before we can use
it we have to assign it a file system and mount
it to a point.
7
Assigning Filesystem Mounting LV
  • We will now assign a file system to LV 'lvo1'. We
    will assign "ext4" to it with "mkfs",

mkfs.ext4 /dev/vg01/lv01
mkdir /data
now we will mount the lv01 to /data
8
mount /dev/vg01/lv01 /data
  • But this is a temporary mount will be removed
    if our system restarts. To permanently mount it,
    we need to add the / etc / fstab file with the
    following entry

vim /etc/fstab /dev/vg01/lv01 /data ext4
defaults 0 0
Save and exit the file. Our lv is now ready to
use, we can add, delete files to it.
9
Contact us for more information
  • Address CBitss Technologies, sector 34 A, sco
    23-24-25, Chandigarh, 160022.
  • Mobile No -9914641983
  • Website - http//cbitss.in/linux-training-in-chand
    igarh/
Write a Comment
User Comments (0)
About PowerShow.com