6
This is a quick reference to setting XFS up on LVM. For more information
7
please see the LVM HOWTO at:
9
http://www.linuxdoc.org/HOWTO/LVM-HOWTO.html
13
You need a kernel with LVM support either built in or as a module.
14
This document assumes lvm as a module.
20
[root@crash /sbin]# modprobe lvm-mod
22
>>> Set partition type to 0x8e for partitions you wish to use with LVM
24
[root@crash /sbin]# fdisk /dev/sda1
25
Command (m for help): t
26
Partition number (1-4): 1
27
Hex code (type L to list codes): 8e
28
Changed system type of partition 1 to 8e (Unknown)
30
Command (m for help): w
31
The partition table has been altered!
33
>>> Write PV superblock on physical volumes
35
[root@crash /root]# pvcreate /dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sdd1
36
pvcreate -- physical volume "/dev/sda1" successfully created
37
pvcreate -- physical volume "/dev/sdb1" successfully created
38
pvcreate -- physical volume "/dev/sdc1" successfully created
39
pvcreate -- physical volume "/dev/sdd1" successfully created
41
>>> Create a volume group consisting of the PVs we just set up
43
[root@crash /root]# vgcreate vg00 /dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sdd1
44
vgcreate -- INFO: using default physical extent size 4 MB
45
vgcreate -- INFO: maximum logical volume size is 255.99 Gigabyte
46
vgcreate -- doing automatic backup of volume group "vg00"
47
vgcreate -- volume group "vg00" successfully created and activated
49
>>> Create a logical volume - striped across 4 PVs, 64 KB chunk size, 20 GB
51
[root@crash /root]# lvcreate -i 4 -I 64 -L 20G -n lv00 vg00
52
lvcreate -- rounding 20971520 KB to stripe boundary size 20975616 KB / 5121 PE
53
lvcreate -- doing automatic backup of "vg00"
54
lvcreate -- logical volume "/dev/vg00/lv00" successfully created
56
>>> Build a filesystem on the LV
58
[root@crash /root]# mkfs -t xfs /dev/vg00/lv00
59
meta-data=/dev/vg00/lv00 isize=256 agcount=20, agsize=262144 blks
60
data = bsize=4096 blocks=5242879, imaxpct=25
61
= sunit=0 swidth=0 blks, unwritten=1
62
naming =version 2 bsize=4096
63
log =internal log bsize=4096 blocks=1200
64
realtime =none extsz=65536 blocks=0, rtextents=0
66
[root@crash /root]# mount -t xfs /dev/vg00/lv00 /xfs
71
After a reboot you will need to reactivate the VGs/LVs:
76
These commands could be added to a startup script.