SUSE Support

Here When You Need Us

Adding a New Disk Into an Existing Logical Volume

This document (7012431) is provided subject to the disclaimer at the end of this document.

Environment

SUSE Linux Enterprise Server 11 All Service Packs
SUSE Linux Enterprise Server 10 All Service Packs

Situation

A volume that is managed by LVM has filled up.  It is not possible to free up any additional space.  New space is needed in order to keep the server stable and running.

Resolution

It will be assumed in this case that a logical volume 'data' is full and needs to be expanded.  The device mapper path to the volume is /dev/serverdata/data.  It will also be assumed that the new disk is detected by device mapper as /dev/sdb.  Also, it is assumed that an ext2 or ext3 filesystem is used.  If another filesystem type is used, the below should be pertinent up until the fsck and file system resize command.
 
As with any filesystem change, back up any pertinent data first.  If the machine is a VM, a full snapshot is recommended.

1. Power down server and add new hard disk to server.

2. Power on server and log in

3. Unmount data logical volume
     umount /dev/serverdata/data
4. Add new disk to a physical volume
     pvcreate /dev/sdb
5. Add the new physical volume to the volume group
     vgextend serverdata /dev/sdb
6. Extend the logcial volume to use the new space allocated
     lvextend -l +100%FREE /dev/serverdata/data
NOTE: The lvextend command is a very versatile command.  The above syntax will expand data to use all free space in it volume group.  It is possible to merely add a set amount of space, or set the logical volume to a specific size.  If further information is needed on the above command, please refer to the man page for lvextend.
7. Check the file system integrity
e2fsck -f /dev/serverdata/data
8. Extend the partition to use the full space
     resize2fs /dev/serverdata/data
NOTE: Once again with the resize2fs command, this is a very versatile command.  Without using any switches, resize2fs will extend the partition to the size of the underlying logical volume.  It is possible to grow or shrink the partition to whatever size is needed, but for this information please look at the man page for resize2fs.
9. This last step is not specifically needed, and my be omitted if desired, but is considered best practice to ensure data and file system integrity.  File system check the file system again.
     e2fsck -f /dev/serverdata/data

Additional Information

In order to manage logical volumes and partitions, the volume must be unmounted.  If the root partition is full, the only way to do this is to boot off of the SLES media and enter into rescue mode.
 
When in rescue mode, it will be necessary to activate LVM first before you can manage logical volumes.  To activate LVM in rescue mode:
 
1) pvscan
2) vgscan
3) lvscan
 
These command will activate and display all physical volumes, volume groups, and logical volumes.  Paths for working volumes will be printed out to the screen.

Disclaimer

This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.

  • Document ID:7012431
  • Creation Date: 17-May-2013
  • Modified Date:03-Mar-2020
    • SUSE Linux Enterprise Server

< Back to Support Search

For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com

tick icon

SUSE Support Forums

Get your questions answered by experienced Sys Ops or interact with other SUSE community experts.

tick icon

Support Resources

Learn how to get the most from the technical support you receive with your SUSE Subscription, Premium Support, Academic Program, or Partner Program.

tick icon

Open an Incident

Open an incident with SUSE Technical Support, manage your subscriptions, download patches, or manage user access.