Tuesday, August 7, 2007

Bless You resize2fs

Ever wanted to shrink a hard drive partition? Well I have.

Most of the time messing around with partitions is a scary process. The slightest mistake and *puff* - there goes your whole hard drive (sort of). Well, I had a 160GB ext3 partition I wanted to shrink to 100GB. Believe it or not, these commands accomplished the task:

% resize2fs /dev/sdb1 100GB

then run a file system check (I forget what I put in, resize2fs told me what to do :)

% fdisk /dev/sdb
d (delete a partition)
1 (the first partition)
n (create a new partition)
p (make it primary)
(defaults to the start of the disk)
+107000M (to make it 100GB, plus some fuck-up space)
w (write everything)


I couldn't believe it... I was so excited I had to write about it.

No comments: