There is a new group of users "design" to add to the system. One way of dealing with this is to create a new volume group to hold their data. There are no new disks but there is plenty of free space on the existing disks that can be reallocated.
# pvscan
pvscan -- reading all physical volumes (this may take a while...)
pvscan -- ACTIVE PV "/dev/sda" of VG "dev" [1.95 GB / 0 free]
pvscan -- ACTIVE PV "/dev/sdb" of VG "sales" [1.95 GB / 1.27 GB free]
pvscan -- ACTIVE PV "/dev/sdc" of VG "ops" [1.95 GB / 564 MB free]
pvscan -- ACTIVE PV "/dev/sdd" of VG "dev" [1.95 GB / 0 free]
pvscan -- ACTIVE PV "/dev/sde" of VG "ops" [1.95 GB / 1.9 GB free]
pvscan -- ACTIVE PV "/dev/sdf" of VG "dev" [1.95 GB / 1.33 GB free]
pvscan -- ACTIVE PV "/dev/sdg1" of VG "ops" [996 MB / 432 MB free]
pvscan -- ACTIVE PV "/dev/sdg2" of VG "dev" [996 MB / 632 MB free]
pvscan -- total: 8 [13.67 GB] / in use: 8 [13.67 GB] / in no VG: 0 [0]
We decide to reallocate /dev/sdg1 and /dev/sdg2 to design so first we have to move the physical extents into the free areas of the other volumes (in this case /dev/sdf for volume group dev and /dev/sde for volume group ops).
Some space is still used on the chosen volumes so it is necessary to move that used space off onto some others.
Move all the used physical extents from /dev/sdg1 to /dev/sde and from /dev/sdg2 to /dev/sdf
# pvmove /dev/sdg1 /dev/sdepvmove -- moving physical extents in active volume group "ops" pvmove -- WARNING: moving of active logical volumes may cause data loss!
pvmove -- do you want to continue? [y/n]
ypvmove -- doing automatic backup of volume group "ops" pvmove -- 141 extents of physical volume "/dev/sdg1" successfully moved
# pvmove /dev/sdg2 /dev/sdfpvmove -- moving physical extents in active volume group "dev" pvmove -- WARNING: moving of active logical volumes may cause data loss!
pvmove -- do you want to continue? [y/n]
ypvmove -- doing automatic backup of volume group "dev" pvmove -- 91 extents of physical volume "/dev/sdg2" successfully moved
Now, split /dev/sdg2 from dev and add it into a new group called "design". it is possible to do this using vgreduce and vgcreate but the vgsplit command combines the two.
# vgsplit dev design /dev/sdg2
vgsplit -- doing automatic backup of volume group "dev"
vgsplit -- doing automatic backup of volume group "design"
vgsplit -- volume group "dev" successfully split into "dev" and "design"
Next, remove /dev/sdg1 from ops and add it into design.
# vgreduce ops /dev/sdg1vgreduce -- doing automatic backup of volume group "ops" vgreduce -- volume group "ops" successfully reduced by physical volume: vgreduce -- /dev/sdg1
# vgextend design /dev/sdg1vgextend -- INFO: maximum logical volume size is 255.99 Gigabyte vgextend -- doing automatic backup of volume group "design" vgextend -- volume group "design" successfully extended
Now create a logical volume. Rather than allocate all of the available space, leave some spare in case it is needed elsewhere.
# lvcreate -L750M -n users design
lvcreate -- rounding up size to physical extent boundary "752 MB"
lvcreate -- doing automatic backup of "design"
lvcreate -- logical volume "/dev/design/users" successfully created
# mke2fs /dev/design/users
mke2fs 1.18, 11-Nov-1999 for EXT2 FS 0.5b, 95/08/09
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
96384 inodes, 192512 blocks
9625 blocks (5.00<!-- ) reserved for the super user
First data block=0
6 block groups
32768 blocks per group, 32768 fragments per group
16064 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840
Writing inode tables: done
Writing superblocks and filesystem accounting information: done