Add disk in virtual box vm
In this post, we will check how to add disks in Virtual Box VM.
1. First add the disk from VM console as a new HDD as shown below:
We have recently added oel76_db1.vdi disk.
2. Once the disk is added, it will be visible in fdisk -l command output. 3. create the partion using below command
fdisk /dev/sdb
for new partion : type n,
to list partition : type p
to write the partion : type w
4. Format the partition by below command:
Now format the disk with mkfs command.
# mkfs.ext4 /dev/sdb1
[root@oel76 etc]# mkfs.ext4 /dev/sdb1
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
15032320 inodes, 60108800 blocks
3005440 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2208301056
1835 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, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
[root@oel76 etc]#
5. mount the disk using below command:
mount /dev/sdb1 /u02
6. Add entry in /etc/fstab file to automatically mount the disk during startup
/dev/sdb1 /u02 ext4 defaults 0 0