Adding Disk Space to a Full Root Filesystem

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

Environment

SUSE Linux Enterprise Server 11
SUSE Linux Enterprise Server 10
SUSE Linux Enterprise Server 9
SUSE Linux Enterprise Desktop 11
SUSE Linux Enterprise Desktop 10

Situation

The root disk or partition is full. You need to add space to the root filesystem. After installation, the space on the root filesystem was not sufficient. How do you extend the size of the root partition when Logical Volume Management (LVM) was not in use?

Resolution

When you install the server, you should consider the dynamic nature of the data on your filesystem. If you expect the disk space requirements to expand over time, you should install the server using LVM to more easily meet the needs of this type of environment.

The easiest way to free up space on the filesystem do the following:
1. Remove any unnecessary files. /tmp and /var are good places to start.
2. Add another disk to the server, and mount it in place of a directory that is heavily used on the full filesystem. This is a post-installation repartitioning method.

Scenario:
/dev/sda1 swap
/dev/sda2 / (root) - This is the filesystem that is full.
In this case the /var directory is taking up too much space. We want to move /var to a new disk and free up the space on root so the system will function properly.

# cat /etc/fstab
/dev/sda1  swap  swap  defaults        0 0
/dev/sda2  /     ext3  acl,user_xattr  1 1

# df -h
Filesystem  Size  Used Avail Use% Mounted on
/dev/sda2    19G   19G     0 100% /


Post-Installation Repartitioning Procedure
1. Add a disk to the server
2. Boot into rescue mode.
3. Partition the new disk and format a filesystem on the partition. For example, mke2fs -j /dev/sdb1
3. mount /dev/sda1 /mnt (The location of the existing /var)
4. mount /dev/sdb1 /media (The location of the new /var)
5. cp -a /mnt/var/* /media/ (Copies all files from the old /var to the new /var on /dev/sdb1)
6. rm -rf /mnt/var/* (Frees up the space on root, converting /var to an empty mount point)
7. You now need to edit the /mnt/etc/fstab file and add an entry for /dev/sdb1 /var so it gets mounted on boot.

# cat /mnt/etc/fstab
/dev/sda1  swap  swap  defaults        0 0
/dev/sda2  /     ext3  acl,user_xattr  1 1
/dev/sdb1  /var  ext3  acl,user_xattr  1 2

8. Reboot normally.

# df -h
Filesystem  Size  Used Avail Use% Mounted on
/dev/sda2    19G  3.3G   15G  19% /
/dev/sdb1    20G   16G  3.2G  84% /var
 

Additional Information

This process does not require you to extend any filesystems. You are simply moving the contents of a directory to a new disk.

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:7009620
  • Creation Date: 24-Oct-2011
  • Modified Date:20-Sep-2022
    • SUSE Linux Enterprise Desktop
    • SUSE Linux Enterprise Server

< Back to Support Search

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

SUSE Support Forums

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

Join Our Community

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.


SUSE Customer Support Quick Reference Guide SUSE Technical Support Handbook Update Advisories
Support FAQ

Open an Incident

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

Go to Customer Center