Skip to content

Instantly share code, notes, and snippets.

@unakatsuo
Last active December 18, 2015 15:19
Show Gist options
  • Save unakatsuo/5803831 to your computer and use it in GitHub Desktop.
Save unakatsuo/5803831 to your computer and use it in GitHub Desktop.
Resizing partition and ext4 filesystem without breaking existing MBR.
# parted /dev/sda
GNU Parted 2.3
Using /var/tmp/5m
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p
Model:  (file)
Disk /var/tmp/5m: 10.5MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start  End     Size    Type     File system  Flags
 1      512B   5243kB  5242kB  primary

(parted) rm 1
(parted) mkpart
Partition type?  primary/extended? p
File system type?  [ext2]? ext4
Start? 512B
End? 100%
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel? i
(parted) p
Model:  (file)
Disk /var/tmp/5m: 10.5MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start  End     Size    Type     File system  Flags
 1      512B   10.5MB  10.5MB  primary

(parted)
# resize2fs /dev/sda1
resize2fs 1.42 (29-Nov-2011)
Resizing the filesystem on /dev/mapper/loop0p1 to 10236 (1k) blocks.
The filesystem on /dev/mapper/loop0p1 is now 10236 blocks long.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment