{"id":342,"date":"2011-01-11T11:45:53","date_gmt":"2011-01-11T10:45:53","guid":{"rendered":"https:\/\/thebc.ch\/blog\/?p=342"},"modified":"2013-09-08T21:23:17","modified_gmt":"2013-09-08T19:23:17","slug":"work-with-lvm-logical-volume-manager","status":"publish","type":"post","link":"https:\/\/thebc.ch\/blog\/?p=342","title":{"rendered":"Work with LVM (Logical Volume Manager)"},"content":{"rendered":"<div class='toc toc'>\n<h2>Contents<\/h2>\n<ul class='toc-odd level-1'>\n\t<li>\n\t\t<a href=\"#Concatenate_two_disk_to_one_large_disk\">Concatenate two disk to one large disk<\/a>\n\t\t<ul class='toc-even level-2'>\n\t\t\t<li>\n\t\t\t\t<a href=\"#Prepare_the_disks\">Prepare the disks<\/a>\n\t\t\t<\/li>\n\t\t\t<li>\n\t\t\t\t<a href=\"#Verify_the_creation_of_the_Physical_Volumes\">Verify the creation of the Physical Volumes<\/a>\n\t\t\t<\/li>\n\t\t\t<li>\n\t\t\t\t<a href=\"#Create_the_VolumeGroup\">Create the VolumeGroup<\/a>\n\t\t\t<\/li>\n\t\t\t<li>\n\t\t\t\t<a href=\"#Verify_the_creation_of_the_Volume_Group\">Verify the creation of the Volume Group<\/a>\n\t\t\t<\/li>\n\t\t\t<li>\n\t\t\t\t<a href=\"#Create_the_Logical_Volume_inside_the_Volume_Group\">Create the Logical Volume inside the Volume Group<\/a>\n\t\t\t<\/li>\n\t\t\t<li>\n\t\t\t\t<a href=\"#Verify_the_creation_of_the_Logical_Volume\">Verify the creation of the Logical Volume<\/a>\n\t\t\t<\/li>\n\t\t\t<li>\n\t\t\t\t<a href=\"#Scan_for_changes_this_probably_create_devpool_snd\">Scan for changes (this probably create \/dev\/pool_snd)<\/a>\n\t\t\t<\/li>\n\t\t\t<li>\n\t\t\t\t<a href=\"#Create_the_File_System\">Create the File System<\/a>\n\t\t\t<\/li>\n\t\t\t<li>\n\t\t\t\t<a href=\"#Create_the_mount-point_in_etcfstab\">Create the mount-point in \/etc\/fstab<\/a>\n\t\t\t<\/li>\n<\/ul>\n<\/ul>\n<\/ul>\n<\/div>\n<div class='toc-end'>&nbsp;<\/div>\n<span id=\"Concatenate_two_disk_to_one_large_disk\"><h2>Concatenate two disk to one large disk<\/h2><\/span>\n<p><a id=\"Prepare_the_disks\" name=\"Prepare_the_disks\"><\/a><\/p>\n<span id=\"Prepare_the_disks\"><h3>Prepare the disks<\/h3><\/span>\n<pre>[root@moloch mnt]# pvcreate \/dev\/hdg1\r\n  Physical volume \"\/dev\/hdg1\" successfully created\r\n[root@moloch mnt]# pvcreate \/dev\/hdh1\r\n  Physical volume \"\/dev\/hdh1\" successfully created\r\n[root@moloch mnt]#<\/pre>\n<p><a id=\"Verify_the_creation_of_the_Physical_Volumes\" name=\"Verify_the_creation_of_the_Physical_Volumes\"><\/a><\/p>\n<span id=\"Verify_the_creation_of_the_Physical_Volumes\"><h3>Verify the creation of the Physical Volumes<\/h3><\/span>\n<pre>[root@moloch ~]# pvdisplay\r\n\r\n  --- NEW Physical volume ---\r\n  PV Name               \/dev\/hdg1\r\n  VG Name\r\n  PV Size               279.46 GB\r\n  Allocatable           NO\r\n  PE Size (KByte)       0\r\n  Total PE              0\r\n  Free PE               0\r\n  Allocated PE          0\r\n  PV UUID               KnJHSq-tQaX-VN22-ThLJ-D7Fc-Zhsq-qUQc72\r\n\r\n  --- NEW Physical volume ---\r\n  PV Name               \/dev\/hdh1\r\n  VG Name\r\n  PV Size               279.46 GB\r\n  Allocatable           NO\r\n  PE Size (KByte)       0\r\n  Total PE              0\r\n  Free PE               0\r\n  Allocated PE          0\r\n  PV UUID               tbhxQF-JGNE-JDtP-LHUl-Qkmx-azOn-XspVS5\r\n\r\n[root@moloch ~]# $<\/pre>\n<p>&nbsp;<\/p>\n<p><a id=\"Create_the_VolumeGroup\" name=\"Create_the_VolumeGroup\"><\/a><\/p>\n<span id=\"Create_the_VolumeGroup\"><h3>Create the VolumeGroup<\/h3><\/span>\n<pre>[root@moloch ~]# vgcreate pool_snd \/dev\/hdg1 \/dev\/hdh1\r\n  Volume group \"pool_snd\" successfully created\r\n[root@moloch ~]#<\/pre>\n<p><a id=\"Verify_the_creation_of_the_Volume_Group\" name=\"Verify_the_creation_of_the_Volume_Group\"><\/a><\/p>\n<span id=\"Verify_the_creation_of_the_Volume_Group\"><h3>Verify the creation of the Volume Group<\/h3><\/span>\n<pre>[root@moloch ~]# pvdisplay\r\n  --- Physical volume ---\r\n  PV Name               \/dev\/hdg1\r\n  VG Name               pool_snd\r\n  PV Size               279.46 GB \/ not usable 1.63 MB\r\n  Allocatable           yes\r\n  PE Size (KByte)       4096\r\n  Total PE              71541\r\n  Free PE               71541\r\n  Allocated PE          0\r\n  PV UUID               KnJHSq-tQaX-VN22-ThLJ-D7Fc-Zhsq-qUQc72\r\n\r\n  --- Physical volume ---\r\n  PV Name               \/dev\/hdh1\r\n  VG Name               pool_snd\r\n  PV Size               279.46 GB \/ not usable 1.63 MB\r\n  Allocatable           yes\r\n  PE Size (KByte)       4096\r\n  Total PE              71541\r\n  Free PE               71541\r\n  Allocated PE          0\r\n  PV UUID               tbhxQF-JGNE-JDtP-LHUl-Qkmx-azOn-XspVS5\r\n\r\n[root@moloch ~]# vgdisplay\r\n  --- Volume group ---\r\n  VG Name               pool_snd\r\n  System ID\r\n  Format                lvm2\r\n  Metadata Areas        2\r\n  Metadata Sequence No  1\r\n  VG Access             read\/write\r\n  VG Status             resizable\r\n  MAX LV                0\r\n  Cur LV                0\r\n  Open LV               0\r\n  Max PV                0\r\n  Cur PV                2\r\n  Act PV                2\r\n  VG Size               558.91 GB\r\n  PE Size               4.00 MB\r\n  Total PE              143082\r\n  Alloc PE \/ Size       0 \/ 0\r\n  Free  PE \/ Size       143082 \/ 558.91 GB\r\n  VG UUID               eMK8Xy-r3N4-eeOb-XZTj-A2js-7hHo-AOjbkS\r\n\r\n[root@moloch ~]#<\/pre>\n<p><a id=\"Create_the_Logical_Volume_inside_the_Volume_Group\" name=\"Create_the_Logical_Volume_inside_the_Volume_Group\"><\/a><\/p>\n<span id=\"Create_the_Logical_Volume_inside_the_Volume_Group\"><h3>Create the Logical Volume inside the Volume Group<\/h3><\/span>\n<pre>[root@moloch ~]# lvcreate -L 558.91G -n snd pool_snd\r\n  Rounding up size to full physical extent 558.91 GB\r\n  Logical volume \"snd\" created\r\n[root@moloch ~]#<\/pre>\n<p>Note: The &#8220;-L 558.91G&#8221; you will find with vgdisplay<\/p>\n<p><a id=\"Verify_the_creation_of_the_Logical_Volume\" name=\"Verify_the_creation_of_the_Logical_Volume\"><\/a><\/p>\n<span id=\"Verify_the_creation_of_the_Logical_Volume\"><h3>Verify the creation of the Logical Volume<\/h3><\/span>\n<pre>[root@moloch ~]# lvscan\r\n  ACTIVE            '\/dev\/pool_mov\/mov' [701.20 GB] normal\r\n  ACTIVE            '\/dev\/pool_snd\/snd' [558.91 GB] inherit\r\n[root@moloch ~]#<\/pre>\n<p><a id=\"Scan_for_changes_.28this_probably_create_.2Fdev.2Fpool_snd.29\" name=\"Scan_for_changes_.28this_probably_create_.2Fdev.2Fpool_snd.29\"><\/a><\/p>\n<span id=\"Scan_for_changes_this_probably_create_devpool_snd\"><h3>Scan for changes (this probably create \/dev\/pool_snd)<\/h3><\/span>\n<pre>[root@moloch ~]# vgscan\r\n  Reading all physical volumes.  This may take a while...\r\n  Found volume group \"pool_mov\" using metadata type lvm1\r\n  Found volume group \"pool_snd\" using metadata type lvm2\r\n[root@moloch ~]#<\/pre>\n<p><a id=\"Create_the_File_System\" name=\"Create_the_File_System\"><\/a><\/p>\n<span id=\"Create_the_File_System\"><h3>Create the File System<\/h3><\/span>\n<pre>[root@moloch ~]# mke2fs -j \/dev\/pool_snd\/snd\r\nmke2fs 1.39 (29-May-2006)\r\nFilesystem label=\r\nOS type: Linux\r\nBlock size=4096 (log=2)\r\nFragment size=4096 (log=2)\r\n73269248 inodes, 146514944 blocks\r\n7325747 blocks (5.00%) reserved for the super user\r\nFirst data block=0\r\nMaximum filesystem blocks=0\r\n4472 block groups\r\n32768 blocks per group, 32768 fragments per group\r\n16384 inodes per group\r\nSuperblock backups stored on blocks:\r\n        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,\r\n        4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,\r\n        102400000\r\n\r\nWriting inode tables: done\r\nCreating journal (32768 blocks): done\r\nWriting superblocks and filesystem accounting information: done\r\n\r\nThis filesystem will be automatically checked every 25 mounts or\r\n180 days, whichever comes first.  Use tune2fs -c or -i to override.\r\n[root@moloch ~]#<\/pre>\n<p><a id=\"Create_the_mount-point_in_.2Fetc.2Ffstab\" name=\"Create_the_mount-point_in_.2Fetc.2Ffstab\"><\/a><\/p>\n<span id=\"Create_the_mount-point_in_etcfstab\"><h3>Create the mount-point in \/etc\/fstab<\/h3><\/span>\n<pre>##### DATA-POOL's ###################################\r\n\r\n##  POOL_SND [ hdg1 300GB - hdh1 300GB ] 600GB\r\n\/dev\/pool_snd\/snd       \/mnt\/pool_snd           ext3    defaults        1 0\r\n\r\n################################################<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Concatenate two disk to one large disk Prepare the disks [root@moloch mnt]# pvcreate \/dev\/hdg1 Physical volume &#8220;\/dev\/hdg1&#8221; successfully created [root@moloch mnt]# pvcreate \/dev\/hdh1 Physical volume &#8220;\/dev\/hdh1&#8221; successfully created [root@moloch mnt]# Verify the creation of the Physical Volumes [root@moloch ~]# pvdisplay &hellip; <a href=\"https:\/\/thebc.ch\/blog\/?p=342\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,6],"tags":[419,420],"class_list":["post-342","post","type-post","status-publish","format-standard","hentry","category-linux","category-lvm","tag-lmv","tag-logical-volume-manager"],"_links":{"self":[{"href":"https:\/\/thebc.ch\/blog\/index.php?rest_route=\/wp\/v2\/posts\/342","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thebc.ch\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thebc.ch\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thebc.ch\/blog\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/thebc.ch\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=342"}],"version-history":[{"count":12,"href":"https:\/\/thebc.ch\/blog\/index.php?rest_route=\/wp\/v2\/posts\/342\/revisions"}],"predecessor-version":[{"id":3602,"href":"https:\/\/thebc.ch\/blog\/index.php?rest_route=\/wp\/v2\/posts\/342\/revisions\/3602"}],"wp:attachment":[{"href":"https:\/\/thebc.ch\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=342"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thebc.ch\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=342"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thebc.ch\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=342"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}