0% found this document useful (0 votes)
29 views4 pages

LVM Practical 01

Uploaded by

Om Shirdhankar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views4 pages

LVM Practical 01

Uploaded by

Om Shirdhankar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

LOGICAL VOLUME MANAGEMENT LDUP: 02/06/04 Wed 0200

by MISCHTY
==============
=========================
Practical-01-minimum
=========================

GOAL : * Make /home a LVM partition of 500 MB at install time [using fdisk - 8e]
* Create a single PV of this partition using it entirely
* Create a VG - vadapav - using this PV
* Create a LV [idli] out of this PV

Let us examine an example of creating a Logical Volume.

I have a HD of Size : 8.5GB

1. Create the following partitions as fresh installation :


[Do a minimum Install]

/dev/hda1 100M 83 Linux /boot


/dev/hda2 <------------------ 5 Extended ---------------------------->
-------- LVM PV ------> /dev/hda5 500M 8e Linux LVM /home
/dev/hda6 600M 82 Linux swap swap
/dev/hda7 500M 83 Linux /
/dev/hda8 1000M 83 Linux /tmp
/dev/hda9 1000M 83 Linux /var
/dev/hda10 4500M 83 Linux /usr

2.
# blockdev --rereadpt /dev/hda

or

# hdparm -z /dev/hda

3. After installing, login as root, and at the prompt :

# vgscan

# vgdisplay

4. Now we create the PVs :

# pvcreate /dev/hda5

Run the test-tools suite :

# pvscan |

# pvdisplay /dev/hda5

# pvdata -v /dev/hda5

5. Create a VG called "vadapav" and add this PV [/dev/hda5] to it :

# vgcreate vadapav /dev/hdb5

################### Config File - StopCheck #1 ########## START ##############


Note : Let check out the config/data files created by the above command :

--> /etc/lvmtab.d/vadapav

# vgscan -v

--> /etc/lvmtab

--> /etc/lvmconf/vadapav.conf

--> /dev/vadapav/group

--> cat /proc/lvm/global

Also check out the dirs under /proc/lvm/..

################### Config File - StopCheck #1 ########## END##############

Now let's run those test tools again :

6. # vgscan

7. # vgdisplay -v vadapav

8. # lvcreate -l 120 -n idli vadapav

or we could do this too :

# lvcreate -L 480 -n idli vadapav

###############################################################################

Now let's run those test tools again :

But first let us backup our VGDA

9. # vgcfgbackup

--> /etc/lvmconf/vadapav.conf

# vgcfgrestore

10. # vgscan

11. # vgdisplay -v vadapav

################### Config File - StopCheck #2 ########## BEGIN ############

12. Once again , let check out the config/data files created by the above cmd :

--> /etc/lvmtab.d/vadapav

--> /etc/lvmtab

--> /etc/lvmconf/vadapav.conf

--> /dev/vadapav/
--> cat /proc/lvm/global

Also check out the dirs under /proc/lvm/..

################### Config File - StopCheck #2 ########## END ############

Ok, we're nearly there, let's make a filesystem:

12. # mke2fs /dev/vadapav/idli

13. # mke2fs -j /dev/vadapav/idli

14. # mount /dev/vadapav/idli /home

# cd /home

# ls

lost+found

# mount

/dev/hda7 on / type ext3 (rw)


none on /proc type proc (rw)
/dev/hda1 on /boot type ext3 (rw)
none on /dev/pts type devpts (rw,gid=5,mode=620)
none on /dev/shm type tmpfs (rw)
/dev/hda9 on /tmp type ext3 (rw)
/dev/hda10 on /usr type ext3 (rw)
/dev/hda8 on /var type ext3 (rw)
/dev/vadapav/idli on /home type ext3 (rw)

15. # df -h

Filesystem Size Used Avail Use% Mounted on


/dev/hda7 471M 79M 369M 18% /
/dev/hda1 99M 9.0M 85M 10% /boot
none 121M 0 121M 0% /dev/shm
/dev/hda9 950M 17M 886M 2% /tmp
/dev/hda10 4.3G 355M 3.8G 9% /usr
/dev/hda8 950M 28M 874M 4% /var
/dev/vadapav/idli 465M 8.1M 433M 2% /home

16. # adduser foo


# passwd ...

Now login as foo and create a file "dad" with some data

17. Now to configure /etc/fstab to automate things :

/dev/vadapav/idli /home ext3 defaults 0 0

18. reboot

And we're done!

Congrats !
19. Check with mount, df -h, ls /home or login and as foo

################################################################################
Test-tools suite :

# vgscan
# vgdisplay
# pvscan
# pvdisplay /dev/hda5
# lvscan
# lvdisplay /dev/vadapav/idli
# lvmdiskscan

*************************

You might also like