working around PARTED bug 90894 using fdisk and resize2fs
I need to shrink my root partition-- I let anaconda partition my disk because I was tired and thought it would be harmless. Turns out, due to bug 90894 (bugzilla.redhat.com/bugzilla/show_bug.cgi?id=90894)
I am hosed. Here is an exerpt from bugzilla:
" Any ext2/ext3 filesystems created during the installation procedure
of recent RedHat/Fedora Linux versions, which use the e2fsprogs for
this task, cannot be resized, moved or copied anymore using parted.
In other words: Parted can basically not be appplied to those
partitions/filesystems anymore at all. Unfortunately, the utilities
fdisk, resize2fs, etc. are not really alternatives (i.e. inconvenient
to use) when you have to resize and move partitions and filesystems
on a densely packed hard drive."
In summary, I cannot use parted to shrink my root partition so I need to use fdisk and resize2fs to do it, but I need some help.
This is my df -h output:
Filesystem Size Used Avail Use% Mounted on
/dev/hda2 18G 2.2G 15G 14% /
/dev/hda1 99M 9.0M 85M 10% /boot
none 251M 0 251M 0% /dev/shm
and fdisk -l:
Disk /dev/hda: 20.0 GB, 20003880960 bytes
255 heads, 63 sectors/track, 2432 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 13 104391 83 Linux
/dev/hda2 14 2302 18386392+ 83 Linux
/dev/hda3 2303 2432 1044225 83 Linux
So I have a lot of unused space on root, a /boot partition, and swap. I only have one disk and no tape backup mechanism available. My online research has led me to believe that if I delete the root partition with fdisk I will no longer be able to access the data, but I will not lose it. What is the difference and why does the man page of resize2fs say:
If you wish to shrink an ext2 partition, first use resize2fs to shrink
the size of filesystem. Then you may use fdisk(8) to shrink the size
of the partition. When shrinking the size of the partition, make sure
you do not make it smaller than the new size of the ext2 filesystem!
as if there is no loss of data is about to occur.
I don't seem to have anywhere to store anything as virtually the whole disk is on /root so I cannot backup with dump/restore.
I have a shaky plan, but I need help with where I am wrong or missing a step. So please refer to the following:
1) log out and boot into rescue mode; become root
2)turn off swap, delete swap partition with fdisk
3) revert root filesystem to ext2
4) resize the root filesystem with resize2fs **how can I figure out how small I can make it?
?5)create a small partition where swap was and dump/restore there? with 251M it seems unlikely that this would work.
6)delete the root partition and recreate it with the exact same starting position, to include the new resized root fs
7) make new partitions as desired with free space
7) change fstab to reflect changes to table
?will I be able to reboot?