top of page
  • Writer's pictureblkrishnarao

Add a disk space to Linux Operating System on Virtual box | VM | Linux

Updated: Apr 16

The following opinions expressed in this post are my own and in no way connected to my employer. 

Add disk-space to Virtual box

  1. First close the running VM

  2. Select Storage and then select the Correct Controller and select Add Hard disk

  3. Select new hard disk and add a new hard disk on next windows

  4. Once done start the VM

  5. Login as root

  6. fdisk -l (lists all the available mounts, check the newly added mount which won't have any partition assigned to it yet )

Eg: a partition added with space 10.7 GB
Disk /dev/sdc: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
the above has 1305 cylinders, so we can select our required number of partitions and give them the number of cylinders summing up to 1

7. create the partition, type "fdisk /dev/sdc"

	select n -> 1 -> 1->1305->w

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
Partition number (1-4): 1
First cylinder (1-1305, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-1305, default 1305):
Using default value 1305
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.

8.	Create a filesystem for newly added disk partition "/sbin/mkfs.ext4 /dev/sdc1"

Execute as below:

/sbin/mkfs.ext4 /dev/sdc1
mke2fs 1.43-WIP (20-Jun-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
655360 inodes, 2620595 blocks
131029 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2684354560
80 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

9. Once done with above steps, create the folder to which you would want to mount the filesystem to "/u02"

Eg: mkdir /u02

10. Mount the folder to enable it to be viewed

mount /dev/sdc1 /u02

11. Edit /etc/fstab to include the newly added filesystem so that it picks it up automatically starting next boot/reboot

/dev/sdc1    /u02    ext4    defaults     1 3

12. Finally check the new filesystem to be available 

/dev/sdc1   9.9G  151M  9.2G   2% /u02

1 view0 comments

Recent Posts

See All


bottom of page