0% found this document useful (0 votes)
64 views3 pages

Create 1 or More Partition With Partition Code 8e'

The document discusses how to create and manage logical volumes using LVM on Linux. It involves creating physical volumes on partitions with code 8e, combining them into a volume group, creating logical volumes from the volume group, formatting and mounting the logical volumes, and resizing logical volumes using lvextend, lvreduce, and related commands.

Uploaded by

api-19914647
Copyright
© Attribution Non-Commercial (BY-NC)
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)
64 views3 pages

Create 1 or More Partition With Partition Code 8e'

The document discusses how to create and manage logical volumes using LVM on Linux. It involves creating physical volumes on partitions with code 8e, combining them into a volume group, creating logical volumes from the volume group, formatting and mounting the logical volumes, and resizing logical volumes using lvextend, lvreduce, and related commands.

Uploaded by

api-19914647
Copyright
© Attribution Non-Commercial (BY-NC)
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/ 3

LVM (logical Volume Manager)

create 1 or more partition with partition code ‘8e’


[root@server3 ~]# fdisk -l

Disk /dev/hda: 41.1 GB, 41110142976 bytes


255 heads, 63 sectors/track, 4998 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 1275 10241406 7 HPFS/NTFS
/dev/hda9 1931 2057 1020096 83 Linux
/dev/hda10 2058 2070 104391 8e Linux LVM
/dev/hda11 2071 2083 104391 8e Linux LVM

/dev/hda10 & /dev/hda11:


is raw partition for lvm create physical volume with them

[root@server3 ~]# pvcreate /dev/hda10


Physical volume "/dev/hda10" successfully created
[root@server3 ~]# pvcreate /dev/hda10
Physical volume "/dev/hda11" successfully created

After creating physical volume you have to create volume group with physical volume

[root@server3 ~]# vgcreate vgo /dev/hda10 /dev/hda11


Volume group "vgo" successfully created
[root@server3 ~]#

Create logical volume from volume group

[root@server3 ~]# lvcreate -L 100M -n lv1 vgo


Logical volume "lv1" created
[root@server3 ~]#

Apply the following command


[root@server3 ~]# lvdisplay

LV Name /dev/vgo/lv1 (ensure that lv name is /dev/vgo/lv1)

Finally format the lvm “/dev/vgo/lv1’


[root@server3 ~]# mkfs.ext3 /dev/vgo/lv1
[root@server3 ~]# mount /dev/vgo/lv1 /mnt
[root@server3 ~]# cd /mnt
[root@server3 mnt]# ls
lost+found
[root@server3 mnt]#

Resizing logical volume:

• lvextend
• lvreduce

Extend LVM:

[root@server3 ~]# lvextend -L +20M /dev/vgo/lv1


Extending logical volume lv1 to 120.00 MB
Logical volume lv1 successfully resized

[root@server3 ~]# e2fsck -f /dev/vgo/lv1

[root@server3 ~]# resize2fs /dev/vgo/lv1


resize2fs 1.39 (29-May-2006)
Resizing the filesystem on /dev/vgo/lv1 to 122880 (1k) blocks.
The filesystem on /dev/vgo/lv1 is now 122880 blocks long.

[root@server3 ~]# mount /dev/vgo/lv1 /mnt

[root@server3 ~]# df -h
File system Size Used Avail Use% Mounted on
/dev/hda8 12G 2.3G 8.6G 21% /
/dev/hda7 130M 9.8M 113M 8% /boot
/dev/mapper/vgo-lv1 117M 5.6M 105M 6% /mnt
[root@server3 ~]#

Note: after applying lvdisplay command

LVM Extend successfully done


Logical volume reduce (lvreduce)

[root@server3 ~]# umount /mnt


[root@server3 ~]# e2fsck -f /dev/vgo/lv1
[root@server3 ~]# resize2fs /dev/vgo/lv1 20M
[root@server3 ~]# lvreduce /dev/vgo/lv1 -L -100M

[root@server3 ~]# mount /dev/vgo/lv1 /mnt

[root@server3 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/hda8 12G 2.3G 8.6G 21% /
/dev/hda9 965M 18M 898M 2% /home
/dev/mapper/vgo-lv1 20M 4.6M 14M 25% /mnt
[root@server3 ~]#

Try with the following:

#lvremove
#vgremove
#pvremove
#vgextend

You might also like