{"id":819,"date":"2012-08-24T15:43:26","date_gmt":"2012-08-24T22:43:26","guid":{"rendered":"http:\/\/jim-zimmerman.com\/?p=819"},"modified":"2017-03-08T13:40:02","modified_gmt":"2017-03-08T20:40:02","slug":"adding-a-new-disk-volume-group-and-volume-in-centos6-from-the-command-line","status":"publish","type":"post","link":"https:\/\/jim-zimmerman.com\/?p=819","title":{"rendered":"Adding a new disk, volume group and volume in CentOS6 from the command line."},"content":{"rendered":"<p>I needed to add more storage to my CentOS6 machine for my remote system backups.  I decided to allocate a completely new volume group and volume to facilitate this need.  Here are the steps I used to create the volume:<\/p>\n<p>The new disk was added via vSphere, since this a VM.  I determined the correct device file by looking to the dmesg output.<\/p>\n<p>Initialize the whole disk using pvcreate.<br \/>\n# pvcreate \/dev\/sde<\/p>\n<p>For partitions, use pvcreate \/dev\/sde[x].<\/p>\n<p>Create a volume group<br \/>\n# vgcreate vg_vmlinux01_backup \/dev\/sde<\/p>\n<p>To add multiple disks or partions, use vgcreate volume_group_name \/dev\/sdx \/dev\/sdy &#8230;<\/p>\n<p>Activate the volume group:<br \/>\n# vgchange -a y vg_vmlinux01_backup<\/p>\n<p>Create logical volume<br \/>\nThis will allocate all remaining available space to the volume.  You can use -L to specify a particular size.  Not needed in my case.<br \/>\n# lvcreate -l 100%FREE -n lv_rmbackup vg_vmlinux01_backup<\/p>\n<p>Write the filesystem with the desired label.<br \/>\n# mkfs -t ext4  -j -L \/rmbackup  \/dev\/vg_vmlinux01_backup\/lv_rmbackup<\/p>\n<p>If you need to create the filesystem with more than the default number of inodes:<br \/>\n# mkfs -t ext4  -j -N 20000000 -L \/rmbackup  \/dev\/vg_vmlinux01_backup\/lv_rmbackup<\/p>\n<p>Modify the \/etc\/fstab:<br \/>\n# vi \/etc\/fstab<br \/>\n&#8230;<br \/>\nLABEL=\/rmbackup         \/rmbackup               ext4    defaults        1 0<br \/>\n&#8230;<\/p>\n<p>Mount it:<br \/>\n# mount \/rmbackup<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I needed to add more storage to my CentOS6 machine for my remote system backups. I decided to allocate a completely new volume group and volume to facilitate this need. Here are the steps I used to create the volume: The new disk was added via vSphere, since this a VM. I determined the correct [&#038;hellip<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[40,145,203,303],"class_list":["post-819","post","type-post","status-publish","format-standard","hentry","category-documentation","tag-centos","tag-command-line","tag-lvm","tag-volume"],"share_on_mastodon":{"url":"","error":""},"_links":{"self":[{"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/posts\/819","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=819"}],"version-history":[{"count":3,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/posts\/819\/revisions"}],"predecessor-version":[{"id":1500,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/posts\/819\/revisions\/1500"}],"wp:attachment":[{"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=819"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=819"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=819"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}