Sunday, April 20, 2014

Example Partition Creation

To begin, you will need to determine what devices are being used for LVM:

[root@system /]# pvscan
PV /dev/cciss/c0d0p2 VG rootvg lvm2 [17.56 GB / 352.00 MB free]
Total: 1 [17.56 GB] / in use: 1 [17.56 GB] / in no VG: 0 [0 ]
[root@system /]#

pvscan shows that on this system, we are working with device /dev/cciss/c0d0. Most systems will have something similar to /dev/sda. pvscan also shows that there is 17.56 GB allocated and 352 MB free.
The next step is to create a usable partition:

[root@system /]# parted
GNU Parted 1.8.1
Using /dev/md0
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted)

Run select to use the right device from pvscan:
(parted) select

New device? [/dev/md0]? /dev/cciss/c0d0
Using /dev/cciss/c0d0
(parted)
Get information about the current partitions by running print:
(parted) print

Model: Compaq Smart Array (cpqarray)
Disk /dev/cciss/c0d0: 73.4GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
1 32.3kB 263MB 263MB primary ext3 boot
2 263MB 19.1GB 18.9GB primary lvm

(parted)
We will be creating a new partition using mkpart. To get help for mkpart, type help mkpart:
(parted) help mkpart
mkpart PART-TYPE [FS-TYPE] START END make a partition

PART-TYPE is one of: primary, logical, extended
FS-TYPE is one of: ext3, ext2, fat32, fat16, hfsx, hfs+, hfs, jfs,
linux-swap, ntfs, reiserfs, hp-ufs, sun-ufs, xfs, apfs2, apfs1, asfs,
amufs5, amufs4, amufs3, amufs2, amufs1, amufs0, amufs, affs7, affs6,
affs5, affs4, affs3, affs2, affs1, affs0
START and END are disk locations, such as 4GB or 10%. Negative values
count from the end of the disk. For example, -1s specifies exactly the
last sector.

mkpart makes a partition without creating a new file system on the
partition. FS-TYPE may be specified to set an appropriate partition ID.
At the moment mkpart does not support ext3 file systems.
(parted)
Start the new partition from the end of the last partition.

(parted) mkpart primary 19.1G 30G
(parted)

To validate the new created partition, type print:

(parted) print

Model: Compaq Smart Array (cpqarray)
Disk /dev/cciss/c0d0: 73.4GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
1 32.3kB 263MB 263MB primary ext3 boot
2 263MB 19.1GB 18.9GB primary lvm
3 19.1GB 30.0GB 10.9GB primary

(parted)

Notice that the total size created is ~11 GB.
Finally, we must set the flag for lvm:

(parted) set 3 lvm on

(parted) print

Model: Compaq Smart Array (cpqarray)
Disk /dev/cciss/c0d0: 73.4GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
1 32.3kB 263MB 263MB primary ext3 boot
2 263MB 19.1GB 18.9GB primary lvm
3 19.1GB 30.0GB 10.9GB primary lvm

(parted)

Type quit to exit parted:

(parted) quit

No comments:

Post a Comment