http://qa.mandrakesoft.com/show_bug.cgi?id=3600
Product: mkinitrd Component: mkinitrd Summary: RFE: expand root ext3 filesystem upon reboot Version: 3.1.6-37mdk Platform: PC OS/Version: All Status: UNCONFIRMED Severity: normal Priority: P2 AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] Until online resizing of ext3 comes along in 2.6 (we can hope), we have the problem that to resize the root filesystem (assuming it's on an underlying resizable device, like LVM for instance), we have to unmount it. But how to do that? One way is to boot via CD-ROM or floppy or some other clumsy method. But much better, is to have the initrd resize the filesystem before mounting it! And the best part is that it's braindead simple to do. The following patch to mkinitrd adds ext2resize to the initrd and modifies the linuxrc to always try to expand the root filesystem to the size of it's underlying device. If it's already as big as the device, nothing happens. If the device is bigger, the filesystem is expanded to it's size. So to increase the size of the root filesystem, one simply expands the device it's on ("lvextend -L+20M /dev/rootvol/root" for example) and then reboots! This technique could be used in the initscripts to resize other "difficult to unmount" filesystems like /var, although that can be done relatively simply by switching to single user mode. But I digress. The patch to mkinitrd: --- /sbin/mkinitrd 2003-02-18 09:26:23.000000000 -0500 +++ /tmp/mkinitrd 2003-03-29 12:49:19.000000000 -0500 @@ -503,6 +503,7 @@ INITRDFILES="/sbin/vgchange /sbin/vgscan" cp -aL /sbin/vgchange $MNTIMAGE/sbin cp -aL /sbin/vgscan $MNTIMAGE/sbin + cp -aL /sbin/ext2resize $MNTIMAGE/sbin cp -aL /lib/libc.so.6 $MNTIMAGE/lib cp -aL /lib/ld-linux.so.2 $MNTIMAGE/lib fi @@ -583,11 +584,13 @@ if [ -n "$lvmroot" ]; then echo "echo Configuring LVM" >> $RCFILE echo "/sbin/vgscan" >> $RCFILE - echo "/sbin/vgchange -a y" >> $RCFILE + echo "/sbin/vgchange -A n -a y" >> $RCFILE IMAGESIZE=$[IMAGESIZE + 5000] fi echo "umount /proc" >> $RCFILE +echo "echo Growing root filesystem (if needed)" >> $RCFILE +echo "/sbin/ext2resize $rootdev" >> $RCFILE [ -n "$rootfsopts" ] && rootfsopts_msg="with flags $rootfsopts" echo "echo Mounting root filesystem $rootfsopts_msg" >> $RCFILE echo "mount --ro -t $rootfs $rootdev /sysroot $rootfsopts" >> $RCFILE Before this is really useful, ext2resize needs to be updated to the latest release (CVS). I have prodded the maintainer to cut a new "official" (1.1.18) release, so hopefully that happens soon. I preferred to use ext2resize because resize2fs requires libext2 as well as fsck which starts to make the initrd get large. ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.