Difference between revisions of "LVM"
(→Resizing a drive) |
(→Resizing a drive) |
||
Line 287: | Line 287: | ||
<pre> |
<pre> |
||
− | lvextend -L+ |
+ | lvextend -L+30G /dev/lvmfiles/media |
+ | Extending logical volume media to 130.00 GiB |
||
+ | Logical volume media successfully resized |
||
</pre> |
</pre> |
||
Revision as of 16:53, 16 February 2013
Below is a load of dumps from the LVM system on village.
Contents
Physical Volumes pvdisplay
--- Physical volume --- PV Name /dev/sdb1 VG Name lvmfiles PV Size 931.51 GiB / not usable 3.19 MiB Allocatable yes (but full) PE Size 4.00 MiB Total PE 238466 Free PE 0 Allocated PE 238466 PV UUID 0dUblD-zgsH-9s6Q-u8zf-LXIT-jNrg-xh1CRe --- Physical volume --- PV Name /dev/sdc1 VG Name lvmfiles PV Size 931.51 GiB / not usable 3.19 MiB Allocatable yes PE Size 4.00 MiB Total PE 238466 Free PE 219140 Allocated PE 19326 PV UUID BfWIaH-uKm3-oTWd-EF0h-7rAG-NxQr-oO3wF0 --- Physical volume --- PV Name /dev/sda3 VG Name lvmskynet PV Size 228.69 GiB / not usable 1.89 MiB Allocatable yes PE Size 4.00 MiB Total PE 58545 Free PE 45433 Allocated PE 13112 PV UUID O2ZbFp-OcHn-QRdz-L3OS-hndQ-oOP0-2cdfZq
Volume groups vgdisplay
--- Volume group --- VG Name lvmfiles System ID Format lvm2 Metadata Areas 2 Metadata Sequence No 23 VG Access read/write VG Status resizable MAX LV 0 Cur LV 6 Open LV 6 Max PV 0 Cur PV 2 Act PV 2 VG Size 1.82 TiB PE Size 4.00 MiB Total PE 476932 Alloc PE / Size 257792 / 1007.00 GiB Free PE / Size 219140 / 856.02 GiB VG UUID OlfSXF-Mpro-rtSM-YOAI-kbek-lGql-wMijpI --- Volume group --- VG Name lvmskynet System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 7 VG Access read/write VG Status resizable MAX LV 0 Cur LV 4 Open LV 4 Max PV 0 Cur PV 1 Act PV 1 VG Size 228.69 GiB PE Size 4.00 MiB Total PE 58545 Alloc PE / Size 13112 / 51.22 GiB Free PE / Size 45433 / 177.47 GiB VG UUID mxwF0z-8GXs-Sm8N-3UEd-Yd7W-2i6T-zBFs9c
Logical Volumes lvdisplay
--- Logical volume --- LV Name /dev/lvmfiles/home VG Name lvmfiles LV UUID dqaHbW-hc6l-wUC5-ZIKh-qqkY-l7ht-1IQVQM LV Write Access read/write LV Status available # open 1 LV Size 120.00 GiB Current LE 30720 Segments 2 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 254:1 --- Logical volume --- LV Name /dev/lvmfiles/publicity VG Name lvmfiles LV UUID AESS8v-XNba-p12U-UQGK-dh5s-4SZx-ZUXp3m LV Write Access read/write LV Status available # open 1 LV Size 220.00 GiB Current LE 56320 Segments 5 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 254:2 --- Logical volume --- LV Name /dev/lvmfiles/media VG Name lvmfiles LV UUID L61nI1-9Rce-kRwf-DsQe-KVq2-c7K1-vNHzBO LV Write Access read/write LV Status available # open 1 LV Size 100.00 GiB Current LE 25600 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 254:3 --- Logical volume --- LV Name /dev/lvmfiles/storage VG Name lvmfiles LV UUID vc1Wfr-N0qN-9NTd-Jvoq-ZiVZ-ko2b-shylYS LV Write Access read/write LV Status available # open 1 LV Size 100.00 GiB Current LE 25600 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 254:4 --- Logical volume --- LV Name /dev/lvmfiles/dcinema VG Name lvmfiles LV UUID im2vFb-XIHr-7Pgu-jzj2-qucd-8vIb-y2iyp2 LV Write Access read/write LV Status available # open 1 LV Size 417.00 GiB Current LE 106752 Segments 5 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 254:5 --- Logical volume --- LV Name /dev/lvmfiles/marketing VG Name lvmfiles LV UUID qKQHL2-FR02-WTlI-fNZp-eE52-zn2U-Px7qwr LV Write Access read/write LV Status available # open 1 LV Size 50.00 GiB Current LE 12800 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 254:6 --- Logical volume --- LV Name /dev/lvmskynet/root VG Name lvmskynet LV UUID hzPsI2-S3dy-a4ev-r6JQ-ICC6-dPH7-7oIBhf LV Write Access read/write LV Status available # open 1 LV Size 9.31 GiB Current LE 2384 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 254:0 --- Logical volume --- LV Name /dev/lvmskynet/usr VG Name lvmskynet LV UUID d15cO9-myXP-KeKJ-Kxz5-DUUN-MKuc-8fZubf LV Write Access read/write LV Status available # open 1 LV Size 18.62 GiB Current LE 4768 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 254:7 --- Logical volume --- LV Name /dev/lvmskynet/var VG Name lvmskynet LV UUID NRJ1cE-Gds2-CTNv-U6WD-qfWb-vu8y-PkeKql LV Write Access read/write LV Status available # open 1 LV Size 18.62 GiB Current LE 4768 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 254:8 --- Logical volume --- LV Name /dev/lvmskynet/tmp VG Name lvmskynet LV UUID a8XzQa-DbSY-FqMb-uSkb-HwLt-Ltls-Cxzhhp LV Write Access read/write LV Status available # open 1 LV Size 4.66 GiB Current LE 1192 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 254:9
df dump df -h
(Correct as of 15th Feb)
Filesystem Size Used Avail Use% Mounted on /dev/mapper/lvmskynet-root 9.2G 738M 8.0G 9% / tmpfs 1.9G 0 1.9G 0% /lib/init/rw udev 1.9G 220K 1.9G 1% /dev tmpfs 1.9G 0 1.9G 0% /dev/shm /dev/sda1 464M 39M 401M 9% /boot /dev/mapper/lvmskynet-tmp 4.6G 138M 4.3G 4% /tmp /dev/mapper/lvmskynet-usr 19G 1.2G 17G 7% /usr /dev/mapper/lvmskynet-var 19G 1.3G 17G 8% /var /dev/mapper/lvmfiles-home 119G 96G 17G 86% /home /dev/mapper/lvmfiles-media 99G 92G 2.3G 98% /export/media /dev/mapper/lvmfiles-storage 99G 20G 75G 21% /export/storage /dev/mapper/lvmfiles-marketing 50G 38G 9.5G 80% /export/marketing /dev/mapper/lvmfiles-publicity 217G 160G 46G 78% /export/publicity /dev/mapper/lvmfiles-dcinema 411G 328G 63G 85% /export/dcinema
This means that currently 734GB of space is currently being used.
Resizing a drive
This process take about 20mins, and requires that the drive be un-mounted. Thus you will want to make sure that people aren't using the drive at the time.
Be aware that you need sudo privileges to do any of this.
The process is made up of five steps:
- Extending the Logical Volume in LVM
- Un-mounting the drive being expanded
- Running a file system check on the drive
- Expanding the file system to match the expanded size of the logical volume
- Re-mounting the drive
Extending the Logical Volume can be done with the drive online using the lvextend
command. The -L+50G
flag tells LVM to expand the drive by 50GB.
lvextend -L+30G /dev/lvmfiles/media Extending logical volume media to 130.00 GiB Logical volume media successfully resized
Un-mounting the drive is required to expand the file system safely (It could potential be done online, but it's risker and Village may or may not have the correct kernel patches).
umount /export/publicity
Now we need to run a filesystem check before expanding the filesystem. If you don't then the filesystem resize command will complain at you.
This step takes the longest, and the time it take will depend on the size of the drive, but pencil in 20mins or so.
e2fsck -f /dev/lvmfiles/publicity
Now we can actually expand filesystem to make use of the additional space in the Logical Volume.
resize2fs /dev/lvmfiles/publicity
Finally re-mount the drive, and check that nothing broke.
mount /export/publicity