Maintenance

  • Home
  • Log in
  • « Build of temporary Jinks server
  • Restarting Tomcat on Pear »

Extending a volume in linux

Posted by gregster on 23 Oct 2012 in Servers, Activity log, Documentation

If you need to add a new drive to (and extend) the LVM setup:
1) Make sure the drive is free of partitions. Install the drive and power up.

2) Find out what the machine is calling the new drive. This will be something in the sd[a-z] range, and is not predictable - you'll need to check before moving on. For the purposes of this post, we'll say that it's called 'sdc'.

3) Create a physical volume on the new disk:

sudo pvcreate /dev/sdc

--- if you only need to extend an existing volume you can start here ---

4) We need to know what the existing volume-groupe and volume names are:

sudo vgdisplay

should return something that starts with 'VG Name vgpool', where 'vgpool' is the string we need.

5) To extend the volume group to include our new device:

sudo vgextend vgpool /dev/sdc1

6) Extend the logical volume by adding 20GB to the volume - note that we can access the volume at /dev/mapper/<volume-group-name>/<volume-name>

sudo lvextend -L+20G /dev/mapper/vgpool-lvrepo

** if you don't know how much disk you have left on any physical device, run this:

sudo hdparm -I /dev/sdc | grep GB



7) You also need to extend the filesystem, and you can't do it while the volume is mounted:

sudo umount /dev/mapper/vgpool-lvrepo

8) You need to run fsck before resizing a filesystem:

sudo e2fsck -f /dev/mapper/vgpool-lvrepo

9) Now you can resize the filesystem:

sudo resize2fs /dev/mapper/vgpool-lvrepo

6) And remount:

sudo mount /dev/mapper/vgpool-lvrepo /mountlocation
This entry was posted by Greg and filed under Servers, Activity log, Documentation.

Maintenance

This blog is the location for all work involving software and hardware maintenance, updates, installs, etc., both routine and urgent.
  • Home
  • Recently
  • Archives
  • Categories

Search

Categories

  • All
  • Announcements
  • Hit by a bus
  • Labs
    • Activity log
    • Documentation
  • Notes
  • R & D
    • Activity log
    • Documentation
  • Servers
    • Activity log
    • Documentation
  • Tasks

All blogs

  • Academic
  • AdaptiveDB
  • Admin
  • Announcements
  • CanMys
  • Cascade
  • CGWP
  • ColDesp
  • Depts
  • DVPP
  • Endings
  • HCMC Blogs
  • Landscapes
  • LEMDO
  • Linguistics
  • Maint
  • LondonMap
  • Mariage
  • MoM
  • Moses
  • Pro-D
  • Projects
  • ScanCan
  • HumsSites
  • Wendat

This collection ©2022 by admin • Help • b2evolution