Wednesday, December 4, 2013

Extending a ext4 partition without losing data

umount /boot
parted /dev/sdb
(parted) print
Model: ATA Patriot Torqx 2 (scsi)
Disk /dev/sdb: 32.0GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 1049kB 12.9GB 12.9GB primary type=83
2 12.9GB 13.0GB 107MB primary ext4 type=83
(parted) rm 2
(parted) mkpart
Partition type? primary/extended? primary
File system type? [ext2]?
Start? 12.9GB
End? 13.4GB
(parted) quit
resize2fs /dev/sdb2
resize2fs 1.42.6 (21-Sep-2012)
Filesystem at /dev/sdb2 is mounted on /boot; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 2
The filesystem on /dev/sdb2 is now 498688 blocks long