Differences

This shows you the differences between two versions of the page.

Link to this comparison view

tech:linux:resize_partition [2017/01/31 06:25] (current)
Line 1: Line 1:
 +====== Resize Partition (with preserving data) ======
 +Steps to resizing partition without losing data
 +<code bash>
 +PARTNUM=1
 +MPNAME=/​dev/​sda
 +#
 +MPNAME1=${MPNAME}${PARTNUM}
 +#
 +# Unmount partition
 +umount $MPNAME1
 +# Check file system
 +fsck -n $MPNAME1
 +#
 +fdisk -l $MPNAME1
 +fdisk $MPNAME
 +# Inside fdisk, do the below
 +# p - print partition table
 +# d - delete said partition
 +# n - create new partition
 +# w - to write changes back
 +#
 +# Check file system
 +e2fsck -f $MPNAME1
 +# To resize to full partition size
 +resize2fs $MPNAME1
 +# Get size
 +fdisk -l $MPNAME1
 +# Remount (assuming this has entry in fstab)
 +mount -a
 +</​code>​
 +
 +Ref: http://​www.htmlgraphic.com/​how-to-resize-partition-without-data-loss-part-2-of-3/​
  

QR Code
QR Code tech:linux:resize_partition (generated for current page)