Operating System - Linux
1751949 Members
4702 Online
108783 Solutions
New Discussion юеВ

Re: Extend ext3 filesystem RHEL 5

 
Yanick Quirion
Regular Advisor

Extend ext3 filesystem RHEL 5

Dear all,

I would like to resize a sile system in linux. My system is a HP DL380G5 with SmartArray P400 (SAS) controller.

I'm going to HP System Management Homepage and start Array Configuration Utility to extend my LUN. I resize it from 100GB to 150GB. Until then, everything is working fine.

Once the controller has finished its resising operation, I can see that the LUN is now 150GB, but Linux RHEL 5 doesn't see it. I still the old (original) size of it. Why?

To see the correct disk size, I have to reboot the system. Why? I would like to be able to resize filesystem online without having to reboot.

After rebooting, the size is now fine:
Disk /dev/cciss/c0d3: 157.2 GB

At this time, I'm unable to resize the filesystem. When I try resize2fs I have this message:

# resize2fs /dev/cciss/c0d3p1
resize2fs 1.39 (29-May-2006)
The filesystem is already 25599956 blocks long. Nothing to do!

Even I I try ext2online I have this:

# ext2online /dev/cciss/c0d3p1
ext2online v1.1.18 - 2001/03/18 for EXT2FS 0.5b
ext2online: new size is same as current (25599956)

When I use parted, I can see the free space at the end of the disk:

Model: Compaq Smart Array (cpqarray)
Disk /dev/cciss/c0d3: 157GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File
system
1 16.4kB 105GB 105GB primary ext3
105GB 157GB 52.4GB Free
Space

So my question is simple: is it possible to extend a filesystem in Redhat Enterprise 5 without having to restart the system like major OS are supporting? If yes, could you kindly let me know how?

Best regards,
Yanick Quirion
9 REPLIES 9
freebird (-.-)
Regular Advisor

Re: Extend ext3 filesystem RHEL 5

You can do with in Single User mode, by typing init 1.

-- Rich
Ivan Ferreira
Honored Contributor

Re: Extend ext3 filesystem RHEL 5

AFAIK, you can do it online only with LVM.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Yanick Quirion
Regular Advisor

Re: Extend ext3 filesystem RHEL 5

Hi,

Is there any way to extend an ext3 partition that is not using LVM?

Thanks
Yanick
Steven E. Protter
Exalted Contributor

Re: Extend ext3 filesystem RHEL 5

Shalom,

Probably not.

This is not a function of the OS as much as its a function of what the hardware supports.

HP-UX and Solaris are plagued by similar issues.

You might get the space recognized by partprobe, otherwise its boot time.

BTW, did you like the way RH moved ext2online functionality to resize2fs without so much as a note or modified man page?

Fun.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Yanick Quirion
Regular Advisor

Re: Extend ext3 filesystem RHEL 5

Hi Steven,

Thank for your answer. I also notice the RHEL 5 is no longer provide ext2online. I was able to install from a RPM package.

I'm just wondering why we absolutely need an LVM to be able to increase a partition. Using GParted boot disk, I was able to increase it (http://gparted.sourceforge.net/screenshots.php), but I need to boot using that boot disk. I was unable to install their software under RHEL5 bacause there is to many package missing (unable to find them in .RPM). Even trying to compile from the .tar.gz, I was getting several error of compilation or missing component.

Windows is now providing a tool re resize NTFS file system. Why Linux (which should be lot better than windows) can't provide a good way to increase partion while they are mounted?

Regards :)
Yanick
Heironimus
Honored Contributor

Re: Extend ext3 filesystem RHEL 5

Changing the size of a LUN underneath a running OS is unsupported or poorly supported on most platforms I've worked with. As far as I know there is currently no way to tell Linux the size of an active disk has changed without rebooting.

You can extend the filesystem online, but you have to extend the device it sits on first. Your filesystem isn't on c0d3, it's on c0d3p1 (a partition on the LUN). After you expand the LUN you need to modify c0d3p1 to contain the new space, and then extend the filesystem. As long as you're careful and keep the start the same you should be able to grow the partition without LVM, but it is a potentially dangerous operation.

LVM exists to solve this kind of problem, though I don't know how good the Linux SmartArray driver is at scanning for newly-created LUNs.
Yanick Quirion
Regular Advisor

Re: Extend ext3 filesystem RHEL 5

Dear Heironimus,

Thank you your answer.

I working with Solaris system, and the growfs command works well. However I don't know if I add space into a LUN on my RAID controller if the system will see it without rebooting. I just remember that growfs tool was working like a charm.

Back to Linux, the only way I see using LVM is to create a partition (c0d3p1), changing it to Linux LVM and create everyting from LVM program (vg01 - testing). That's fine. But, when you want to add space I'm doing it that way (if you have another one that may be better please let me know):

I'm going to my RAID controller to extend the LUN. I have to reboot for the system see the change. After that, I'm doing an fdisk on it (I may have to reboot again before being able to use the new partition), add another partition Linux LVM (c0d3p2) then extend my logical volume (vg01 - testing) created earlier, then use ext2online or extend2fs to extend the ext3 filesystem.

What will happened if I have more then 4 extention? I can't have more than 4 primary partition on a disk. I'm not sure that way (LVM) is a good way to extend a filesystem on linux... I'm wondering what's happen on a large system that is using a SAN and need to add space to a partiton; I'm not sure they will acces to reboot all the time to make this working.

Once again, if you have another idea how doing it, please let me know!

Regards :)
Yanick
Rick Beldin
HPE Pro

Re: Extend ext3 filesystem RHEL 5

Looks like RHEL5 provides resize2fs. From the man page:

The resize2fs program will resize ext2 or ext3 file systems. It can be
used to enlarge or shrink an unmounted file system located on device.
If the filesystem is mounted, it can be used to expand the size of the
mounted filesystem, assuming the kernel supports on-line resizing. (As
of this writing, the Linux 2.6 kernel supports on-line resize for
filesystems mounted using ext3 only.).

Haven't tried it... only echoing what the man page shows...
Necessary questions: Why? What? How? When?
Heironimus
Honored Contributor

Re: Extend ext3 filesystem RHEL 5

The way you would avoid reboots is to stop trying to change the size of an existing LUN. A LUN looks like a drive, and Linux doesn't expect to see the size of a drive change on the fly.

You have to either use the LUN as a whole disk, which is generally considered a bad practice, or put a DOS-style partition map on it. If you lay down physical partitions you can only have 4 primary partitions, but one of those can be an "extended partition" to allow more physical partitions. It's silly, but we're stuck with the shortsighted design of DOS on this one.

For an internal array you could create the whole array as one or two big devices when you first set it up. Then you can create and modify partitions as needed without touching the underlying array configuration, it just looks like one big, fast disk to Linux (or any other OS. This is how almost every PC server I've seen over the past couple years has been configured. You can use partprobe to tell Linux about changes in the partition table. LVM isn't necessary, but it makes life easier because partitions have to be contiguous but logical volumes don't.

The other approach is to create the initial LUN(s) as whatever size you need and add a volume group. When you need additional storage you provision a new LUN and rescan the bus to pick up the new device. fdisk the new device to create a partition, pvcreate it, vgextend on to it, lvextend and ext2online/resize2fs as needed. This is how you have to do it with SAN storage, but personally I think it's unnecessary and overly complicated for the little internal arrays in PC servers.