SLES/SLED resize a reiser or ext3 file system

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

Environment

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

Situation

The file-system on a server has consumed all free space. Space has been added to the disk and now the partition and file-system needs to be expanded.
In the following situation we have a partition of roughly 1GB. We need to use an additional 1GB that is free for the file-system. This situation also assumes that the partition is not mounted. See the additional information section for the commands to run a re-size while the file-system is mounted.

Please note: that you will want to make a backup of your data. Even though this process can be run without problem you will still want to plan as if you are going to loose the data in this process.

Resolution

This assumes the partition is not mounted

Disk /dev/sdb: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1         131     1052226   83  Linux

Note: The start and end sector. When we delete the partition we will use the same start but the end sector will change to consume the extra space.Your data should not be affected.

linux-tleg:~ # fdisk /dev/sdb

Command (m for help): d
Selected partition 1

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-261, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-261, default 261):
Using default value 261

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.

linux-tleg:~ # partprobe     *This command will rescan the partitions and attempt to update the kernel*

*NOTE* Generally at this point you need to reboot before you can re-size the file-system!

linux-tleg:~ # fdisk -l /dev/sdb      *This shows that the new end sector is 261*


Disk /dev/sdb: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1         261     2096451   83  Linux




linux-tleg:/ # resize_reiserfs /dev/sdb1
resize_reiserfs 3.6.19 (2003 www.namesys.com)

ReiserFS report:
blocksize             4096
block count           524112 (263056)
free blocks           515885 (254836)
bitmap block count    16 (9)

Syncing..done


resize_reiserfs: Resizing finished successfully.


If you are using ext3 you will need to first fsck the file-system and then re-size:

linux-tleg:/ #  fsck.ext3 /dev/sdb1

Then re-size

linux-tleg:/ #  resize2fs /dev/sdb1

Additional Information

In SLES/SLES 10 you have a ext2online command to resize a file-system that is currently mounted. In SLES/SLED 11 this on-line functionality has been as been implemented in resize2fs. Executing ext2online in SLE 11 will result in a command not found.

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:7006860
  • Creation Date: 16-Sep-2010
  • Modified Date:28-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