[TriLUG] Resizing partition with ext3 file system

Rick DeNatale rick.denatale at gmail.com
Sun Jan 23 10:13:50 EST 2005


Ok, I'm back once more to this fount of linux wisdom.

About a month ago I set up an rsync backup system, and was somewhat
silly in how much space I allocated for the backups.  All was well
until I decided to actually start using more space on my other hard
drive for data. Now my backup partitition is about 93% full and the
new data partitions have lots of free space, so I'm trying to
forestall overflowing the backup partition.

Now the backup partition is the second and last partition on it's
device /dev/hdc2 so there's lots of free space to expand into. 
/dev/hdc1 is a small partition which I made just in case I ever wanted
to have this drive bootable.

I think that I can resize /dev/hdc2 by:

1. take proper steps to temporarily stop further backups, just in case
I can't get all this done before the next backup is scheduled (every 4
hours).
2. unmount the snapshot device (both the r/w mounting to
/root/snapshot for root only access, and the r/o nfs mount to
/snapshot for others).
3. edit /etc/fstab to change the entry for /root/snapshot from ext3 to ext2
4. remount /root/snapshot to change the filesystem type and get rid of
the journal
5. unmount /root/snapshot again.
6. run fdisk and delete the partition and recreate it at the same
first cylinder but larger.  I understand that this WILL leave the
existing data in place.
7. execute (sudo?) resize2fs /dev/hdc2 to grow the file system in place.
8. execute (sudo?) tune2fs -j /dev/hdc2 to create a new journal file.
9. change /etc/fstab to change /root/snapshot back to ext3
10. remount /root/snapshot and /snapshot
11. let loose the backup cron job.
12. bob's yer uncle 

Or is he?  Does this sound right?  Are all of steps 3-5, and 8-9
necessary, or can I resize the file system without converting it back
and forth from ext2 to ext3?



More information about the TriLUG mailing list