how to increase the partition /dev/sda2 partition.

df -h :

Filesystem      Size  Used Avail Use% Mounted on
/dev/sda2       7.0G  3.7G  3.0G  56% /
devtmpfs        432M  172K  432M   1% /dev
tmpfs           432M     0  432M   0% /dev/shm
IOInterceptor   7.0G  3.7G  3.0G  56% /primary/iointerceptor/mountdir

fdisk -l :

Disk /dev/sda: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 cylinders, total 83886080 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0007c01d

Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048     2056191     1027072   82  Linux swap / Solaris
/dev/sda2   *     2056192    16777215     7360512   83  Linux

I've also edited the virtual machine settings to make hard disk size from 8GB(initially allocated) to 40GB, now how should i increase above mentioned partition? searched over Google but didn't get how to do this?

EDIT:

Created new partition /dev/sda3. fdisk -l after creating new partition

/dev/sda1            2048     2056191     1027072   82  Linux swap / Solaris
/dev/sda2   *     2056192    16777215     7360512   83  Linux
/dev/sda3        16777216    41943039    12582912   83  Linux

But when used resize2fs /dev/sda3. It showed below error

resize2fs 1.41.9 (22-Aug-2009)
resize2fs: Bad magic number in super-block while trying to open /dev/sda3
Couldn't find valid filesystem superblock.

Pradi

Make sure that you have parted version 3.2, then run parted /dev/sda and use the resizepart command to resize sda2, moving the end of the partition to the end of the disk. Then run resize2fs /dev/sda2 to enlarge the filesystem to use the additional space. Reboot not required.

  • You saved me a ton of time, thank you. By the way, this works for Arch Linux for any Arch users wondering. – Henry F May 20 '17 at 6:55

1) Boot this virtual machine from livecd.iso of any distr (example ubuntu)

2) find disk what you want resize (probably /dev/sda)

3) fdisk /dev/sda d - remove partition 2 - number partition n - create new p - type primary 2 - number 2056192 - start on same block, that started deleted partition <press enter to save default value> - max avaible size w - write changes and exit

4) after that resize you filesystem with resize2fs /dev/sda2 or other utils (depends your filesystem. resize2fs - for ext2/3/4)

  • Hi, I've created new partition /dev/sda3. But when used resize2fs command, it showing error "resize2fs: Bad magic number in super-block while trying to open /dev/sda3 Couldn't find valid filesystem superblock." – prad Jun 27 '14 at 11:04
  • Please let me know whats going wrong here? – prad Jun 27 '14 at 11:05
  • You have created new partition /dev/sda3 without filesystems. But i don`t understand why. You had to create partition with same number that deleted and same offset for first block but large. – mr_tron Jun 27 '14 at 11:27
  • Reed your update. Just mkfs.ext4 /dev/sda3 – mr_tron Jun 27 '14 at 11:29
  • I'm new to Linux and dont know these partition and physical volume concepts. I just want increase size /dev/sda2. – prad Jun 27 '14 at 11:38

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.