Creating Physical Volumes - Red Hat ENTERPRISE LINUX 5.1 - LVM ADMINISTRATION Manual

Table of Contents

Advertisement

4.2.1. Creating Physical Volumes

The following subsections describe the commands used for creating physical volumes.
4.2.1.1. Setting the Partition Type
If you are using a whole disk device for your physical volume, the disk must have no partition table.
For DOS disk partitions, the partition id should be set to 0x8e using the fdisk or cfdisk command
or an equivalent. For whole disk devices only the partition table must be erased, which will effectively
destroy all data on that disk. You can remove an existing partition table by zeroing the first sector with
the following command:
dd if=/dev/zero of=PhysicalVolume bs=512 count=1
4.2.1.2. Initializing Physical Volumes
Use the pvcreate command to initialize a block device to be used as a physical volume. Initialization
is analogous to formatting a file system.
The following command initializes /dev/sdd1, /dev/sde1, and /dev/sdf1 for use as LVM physical
volumes.
pvcreate /dev/sdd1 /dev/sde1 /dev/sdf1
To initialize partitions rather than whole disks: run the pvcreate command on the partition. The
following example initializes /dev/hdb1 as an LVM physical volume for later use as part of an LVM
logical volume.
pvcreate /dev/hdb1
4.2.1.3. Scanning for Block Devices
You can scan for block devices that may be used as physical volumes with the lvmdiskscan
command, as shown in the following example.
# lvmdiskscan
/dev/ram0
/dev/sda
/dev/root
/dev/ram
/dev/sda1
/dev/VolGroup00/LogVol01
/dev/ram2
/dev/new_vg/lvol0
/dev/ram3
/dev/pkl_new_vg/sparkie_lv
/dev/ram4
[
16.00 MB]
[
17.15 GB]
[
13.69 GB]
[
16.00 MB]
[
17.14 GB] LVM physical volume
[
512.00 MB]
[
16.00 MB]
[
52.00 MB]
[
16.00 MB]
[
7.14 GB]
[
16.00 MB]
Creating Physical Volumes
17

Advertisement

Table of Contents
loading

This manual is also suitable for:

Enterprise linux 5.1 cluster logical volume manager

Table of Contents