Skip to content

Instantly share code, notes, and snippets.

@maclarensg
Created September 12, 2018 04:00
Show Gist options
  • Save maclarensg/ac80594dafcd3eab72a43db2eb4cbcb7 to your computer and use it in GitHub Desktop.
Save maclarensg/ac80594dafcd3eab72a43db2eb4cbcb7 to your computer and use it in GitHub Desktop.
LVM #linux

LVM

Prepare the new disk

Create partition on deisk

# fdisk /dev/sdb 

Command (m for help): p

Disk /dev/sdb: 53.7 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x4cac4ba1

   Device Boot      Start         End      Blocks   Id  System

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-6527, default 1): 
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-6527, default 6527): 
Using default value 6527

Command (m for help): P

Disk /dev/sdb: 53.7 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x4cac4ba1

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        6527    52428096   83  Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

LVM - create physical vol

pvcreate /dev/sdb1
root@opg-preprod-kafka_sasl_1 ~]# pvdisplay
  --- Physical volume ---
  PV Name               /dev/sda3
  VG Name               vg_root
  PV Size               18.75 GiB / not usable 5.00 MiB
  Allocatable           yes (but full)
  PE Size               32.00 MiB
  Total PE              600
  Free PE               0
  Allocated PE          600
  PV UUID               mtgbJ2-JRFl-5LCF-ajvX-EIIM-5VLI-1G0J9K
   
  "/dev/sdb1" is a new physical volume of "50.00 GiB"
  --- NEW Physical volume ---
  PV Name               /dev/sdb1
  VG Name               
  PV Size               50.00 GiB
  Allocatable           NO
  PE Size               0   
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               Fmg41b-hnWS-2q82-RA6r-o6bU-B7hw-6Qf1A8

vgcreate -s 32M vg_extended /dev/sdb1
lvcreate -l 160 -n log vg_extended
lvextend --size 10G /dev/vg_extended/log
lvcreate -L 20G -n kafka vg_extended
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment