HOW TO SPLIT VG (VOLUME GROUP) IN LINUX.

 

In this article we are going to learn how to create another volume group from already created one . Take a look at my diagram i’m going to split vg00 into another volume group and name will be vg11.

volume group in linux

splitting volume group

Follow these steps :

  • Create six partitions .
[root@localhost ~]# fdisk /dev/sda
The number of cylinders for this disk is set to 6147.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): n
Command action
   l   logical (5 or over)
   p   primary partition (1-4)
l
First cylinder (5482-6147, default 5482):
Using default value 5482
Last cylinder or +size or +sizeM or +sizeK (5482-6147, default 6147): +500M

Command (m for help): n
Command action
   l   logical (5 or over)
   p   primary partition (1-4)
l
First cylinder (5544-6147, default 5544):
Using default value 5544
Last cylinder or +size or +sizeM or +sizeK (5544-6147, default 6147): +500M

Command (m for help): n
Command action
   l   logical (5 or over)
   p   primary partition (1-4)
l
First cylinder (5606-6147, default 5606):
Using default value 5606
Last cylinder or +size or +sizeM or +sizeK (5606-6147, default 6147): +500M

Command (m for help): n
Command action
   l   logical (5 or over)
   p   primary partition (1-4)
l
First cylinder (5668-6147, default 5668):
Using default value 5668
Last cylinder or +size or +sizeM or +sizeK (5668-6147, default 6147): +500M
Command (m for help): n
Command action
   l   logical (5 or over)
   p   primary partition (1-4)
l
First cylinder (5730-6147, default 5730):
Using default value 5730
Last cylinder or +size or +sizeM or +sizeK (5730-6147, default 6147): +500M

Command (m for help): n
Command action
   l   logical (5 or over)
   p   primary partition (1-4)
l
First cylinder (5792-6147, default 5792):
Using default value 5792
Last cylinder or +size or +sizeM or +sizeK (5792-6147, default 6147): +500M

Command (m for help): p
Disk /dev/sda: 50.5 GB, 50562793472 bytes
255 heads, 63 sectors/track, 6147 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        5099    40957686   83  Linux
/dev/sda2            5100        5481     3068415   82  Linux swap / Solaris
/dev/sda4            5482        6147     5349645    5  Extended
/dev/sda5            5482        5543      497983+  83  Linux
/dev/sda6            5544        5605      497983+  83  Linux
/dev/sda7            5606        5667      497983+  83  Linux
/dev/sda8            5668        5729      497983+  83  Linux
/dev/sda9            5730        5791      497983+  83  Linux
/dev/sda10           5792        5853      497983+  83  Linux

Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
[root@localhost ~]# partprobe /dev/sda
  • Now create pv (physical volumes ) including sda5 , sda6, sda7 ,sda8, sda9 , sda10
[root@localhost ~]# pvcreate /dev/sda5 /dev/sda6 /dev/sda7 /dev/sda8 /dev/sda9 /dev/sda10
  Physical volume "/dev/sda5" successfully created
  Physical volume "/dev/sda6" successfully created
  Physical volume "/dev/sda7" successfully created
  Physical volume "/dev/sda8" successfully created
  Physical volume "/dev/sda9" successfully created
  Physical volume "/dev/sda10" successfully created
  • After creating physical volume create volume group over physical volumes.
[root@localhost ~]# vgcreate vg00 /dev/sda5 /dev/sda6 /dev/sda7 /dev/sda8 /dev/sda9 /dev/sda10
  Volume group "vg00" successfully created
  • Now vg00 has been created . We will make new volume group(vg11) taking its partition .
[root@localhost ~]# vgsplit vg00 vg11 /dev/sda8 /dev/sda9 /dev/sda10
  New volume group "vg11" successfully split from "vg00"

In this command (vgsplit vg00 vg11 sda8 , sda9 ,sda10) i wrote vg00 first because i want vg11 should be created from vg00 with partition afterwards.You can see now there is two volume group .

[root@localhost ~]# vgs
  VG   #PV #LV #SN Attr   VSize VFree
  vg00   3   0   0 wz--n- 1.42G 1.42G
  vg11   3   0   0 wz--n- 1.42G 1.42G

SO this is how you can split volume group.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s