how to extend root partition size

You should have live usb os or livecd first.  (if we did not use the lvm system)

1.  delete and re-create the partition with more size of it.

fdisk /dev/sda  
 (if you want to start from 63 sector ,please run fdisk -c=dos /dev/sda instead)

Command (m for help): p

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     9437183     4717568   83  Linux

Command (m for help): d
Selected partition 1

Command (m for help): p

   Device Boot      Start         End      Blocks   Id  System

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4, default 1): 1
First sector (2048-10485759, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-10485759, default 10485759):
Using default value 10485759

Command (m for help): p

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048    10485759     5241856   83  Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.

2.  e2fsck -f /dev/sda1

e2fsck 1.42.9 (4-Feb-2014)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information

/: ***** FILE SYSTEM WAS MODIFIED *****
/: 88246/767232 files (1.1% non-contiguous), 678191/767095 blocks

3. resize2fs /dev/sda1

resize2fs 1.42.9 (4-Feb-2014)
Resizing the filesystem on /dev/sda1 to 7864320 (4k) blocks.

此篇文章已被阅读2186 次

Tags:

Add a Comment

邮箱地址不会被公开。 必填项已用*标注