Step 1 Scan the new LUNS.
Step 2 List the available disks and identify the one you want to use.
fdisk -l |grep /dev/ |grep -v dmStep 3 Use fdisk to label the disk. Here we are using disk sdb .
[root@cloudvedas scsi_host]# fdisk /dev/sdb Welcome to fdisk (util-linux 2.23.2). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Device does not contain a recognized partition table Building a new DOS disklabel with disk identifier 0x909f2c7b. Command (m for help): p Disk /dev/sdb: 1073 MB, 1073741824 bytes, 2097152 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: dos Disk identifier: 0x909f2c7b Device Boot Start End Blocks Id System Command (m for help):Step 4 Create Primary partition using option "n" of size 200MB.
Command (m for help): n Partition type: p primary (0 primary, 0 extended, 4 free) e extended Select (default p): p Partition number (1-4, default 1): First sector (2048-2097151, default 2048): Using default value 2048 Last sector, +sectors or +size{K,M,G} (2048-2097151, default 2097151): +200M Partition 1 of type Linux and of size 200 MiB is set(Don't miss the + used before 200M. It's very critical else it won't work as expected)
Step 4 Now let's check our new partition
Command (m for help): p Disk /dev/sdb: 1073 MB, 1073741824 bytes, 2097152 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: dos Disk identifier: 0xc1c8c781 Device Boot Start End Blocks Id System /dev/sdb1 2048 411647 204800 83 Linux Command (m for help):Step 5 In the above output we can see that the new partition is a standard linux partition. Let's Change the partition type to Linux LVM. Here we will use "8e" which is a Hex code for LVM. You can type L to list all codes.
Command (m for help): t Selected partition 1 Hex code (type L to list all codes): 8e -Changed type of partition 'Linux' to 'Linux LVM' Command (m for help): p Disk /dev/sdb: 1073 MB, 1073741824 bytes, 2097152 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: dos Disk identifier: 0xc1c8c781 Device Boot Start End Blocks Id System /dev/sdb1 2048 411647 204800 8e Linux LVM Command (m for help):Step 6 Finally save the changes with option "w"
Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks.Step 7 Let's list the partition table to cross check that our partition table is saved correctly.
[root@cloudvedas /]# fdisk -l /dev/sdb Disk /dev/sdb: 1073 MB, 1073741824 bytes, 2097152 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: dos Disk identifier: 0x0aa5ab95 Device Boot Start End Blocks Id System /dev/sdb1 2048 411647 204800 8e Linux LVM [root@cloudvedas /]#Cool! So, we have now a LVM partition which we can bring under LVM control using pvcreate.