Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

You are running a Linux Server, and need to create new partition disk. In this example, a new 50 GB disk will be assigned as new LVM partition.

 

1. You need to add disk 50 GB from vCloud Director.

Image Added

2. Go to VM and check before condition. You see you only have 1 partition LVM. 

Image Added

 

3. Check all partition in server.

# lsblk

The new disk you add has been assigned as sdb

Image Added

 

4. Now. create new partition for sdb.

# fdsik /dev/sdb

Image Added

 

5. Type following command:

n

then select primary, type:

p

partition number, choose:

1

First sector, enter it as default.

Image Added

 

6. You need to change type of partition into LVM.

Type:

t

Partition type:

8e

Image Added

 

7. Now, check your sdb. Type:

p

you'll see /dev/sdb1 has created. Then type:

w

Image Added

Image Added

 

8. You need to choose the physical volumes that will be used to create the LVM. You can create the physical volumes using pvcreate command.

# pvcreate /dev/sdb1

Image Added

 

9. Volume group is collection of physical volumes. Volume groups are nothing but a pool of storage that consists of one or more physical volumes. Once you create the physical volume, you can create the volume group (VG) from these physical volumes (PV).

# vgcreate ubuntu_vgnew/dev/sdb1

note: ubuntu_vgnew is name of this volume group. you can change it as your preference.

Image Added

 

10. Now check your volume group.

# vgdisplay ubuntu_vgnew

Image Added

 

11. A volume group is divided up into logical volumes. We can create logical volume with lvcreate command by giving the name of a new logical volume, its size, and the volume group.

# lvcreate -L +49G -n vg_new ubuntu_vgnew

note:

  1. here, you create 50 GB size of available disk. 
  2. vg_new is name of logical volume. you can change it as your preference.

Image Added

 

12. Before using the partition, you need to format both new partitions with a file system. You can do this with mkfs command.

# mkfs.ext4 /dev/ubuntu_vgnew/vg_new

Image Added

 

13. Now, add new partition into fstab in order to make it mounted permanently.

# vim /etc/fstab

Add this line:

/dev/ubuntu_vgnew/vg_new     /data     ext4      default    0    0

Image Added

 

14. Create new directory to mounted. Sample here: /data

# mkdir data

Image Added

 

15. Now, mount new partition.

# mount /dev/ubuntu_vgnew/vg_new /data

Image Added

 

16. Check after condition. You'll see there is new partition listed.

Image Added