Friday, September 14, 2012

Format a new disk for Linux LVM

Format a new disk in Linux LVM

1. Find the new disk from fdisk -l,


2. Format the disk using fdisk command. I am going to format the device /dev/sdc with 2 partitions.

 

Used the below options,

For first partition /dev/sdc1

a) Command (m for help): n  -----> New Partition

b) Command action
   e   extended
   p   primary partition (1-4)
p -----> Primary Partition

c) Partition number (1-4): 1
First cylinder (1-130, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-130, default 130): +500M -----> last cylinder we have a option by mentioning the size and create a partition instead of end cylinder number.

d) Command (m for help): t ----> To toggle the system type of the partition, here the filesystem type we need is Linux LVM
Selected partition 1
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)
  
e) Command (m for help): p

Disk /dev/sdc: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1          62      497983+  8e  Linux LVM
For Second Partition,

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (63-130, default 63):
Using default value 63
Last cylinder or +size or +sizeM or +sizeK (63-130, default 130): +500M

Command (m for help): t
Partition number (1-4): 2
Hex code (type L to list codes): 8e
Changed system type of partition 2 to 8e (Linux LVM)

Command (m for help): p

Disk /dev/sdc: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1          62      497983+  8e  Linux LVM
/dev/sdc2              63         124      498015   8e  Linux LVM


Command (m for help): w -----> To write all the modification at the end.
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@tilakhomelinux ~]# partprobe -----> informs the operating system kernel of partition table changes, by requesting that the operating system re-read the partition table.

0 comments:

Post a Comment

Pages