Installation guide

Chapter 4. LVM Administration with CLI Commands
32
3. Use the vgexport command to export the volume group. This prevents it from being accessed by
the system from which you are removing it.
After you export the volume group, the physical volume will show up as being in an exported
volume group when you execute the pvscan command, as in the following example.
[root@tng3-1]# pvscan
PV /dev/sda1 is in exported VG myvg [17.15 GB / 7.15 GB free]
PV /dev/sdc1 is in exported VG myvg [17.15 GB / 15.15 GB free]
PV /dev/sdd1 is in exported VG myvg [17.15 GB / 15.15 GB free]
...
When the system is next shut down, you can unplug the disks that constitute the volume group
and connect them to the new system.
4. When the disks are plugged into the new system, use the vgimport command to import the
volume group, making it accessible to the new system.
5. Activate the volume group with the -a y argument of the vgchange command.
6. Mount the file system to make it available for use.
4.3.15. Recreating a Volume Group Directory
To recreate a volume group directory and logical volume special files, use the vgmknodes command.
This command checks the LVM2 special files in the /dev directory that are needed for active logical
volumes. It creates any special files that are missing removes unused ones.
You can incorporate the vgmknodes command into the vgscan command by specifying the mknodes
argument to the vgscan command.
4.4. Logical Volume Administration
This section describes the commands that perform the various aspects of logical volume
administration.
4.4.1. Creating Linear Logical Volumes
To create a logical volume, use the lvcreate command. If you do not specify a name for the logical
volume, the default name lvol# is used where # is the internal number of the logical volume.
When you create a logical volume, the logical volume is carved from a volume group using the free
extents on the physical volumes that make up the volume group. Normally logical volumes use up any
space available on the underlying physical volumes on a next-free basis. Modifying the logical volume
frees and reallocates space in the physical volumes.
The following command creates a logical volume 10 gigabytes in size in the volume group vg1.
# lvcreate -L 10G vg1