Hi,
I will explain How to Add Hard disk in VirtualBox and Disk format and Mount Steps on Linux.
You can read following article , if you don’t know Oracle Linux 7.6 Step by Step Installation on VirtualBox.
After installing Oracle linux 7.6 operating system, I want to prepare this server for Oracle database installation. To do this, I will install Oracle database software on new disk on the server, so i should add a disk to Virtualbox and Linux .
To add a disk, it is shut down by using shutdown -h now command from within the virtual machine or by turning OFF the Power on Virtualbox. Then, 2 disks are added.
By selecting the disk size to be dynamic , select it as Dynamically allocated.
The size of disk to be added is 50GB.
The second disk to be added is going through the same steps above.
After you create both disks, the disks should look like the following on the Virtualbox Storage tab.
Add two disks and open the server via Virtualbox. When fdisk -l is checked when the server is turned on, you can see that the two newly added disks are /dev/sdb and /dev/sdc.
I will partition /dev/sdc to 2 logic parts with the following steps and mount the first partition as /u01 and use the other partition as Oracle ASM disk.
[root@MehmetSalih ~]# fdisk /dev/sdc Welcome to fdisk (util-linux 2.23.2). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Device does not contain a recognized partition table Building a new DOS disklabel with disk identifier 0x141fd476. Command (m for help): n Partition type: p primary (0 primary, 0 extended, 4 free) e extended Select (default p): p Partition number (1-4, default 1): 1 First sector (2048-104857599, default 2048): Using default value 2048 Last sector, +sectors or +size{K,M,G} (2048-104857599, default 104857599): +30G Partition 1 of type Linux and of size 30 GiB is set Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks. [root@MehmetSalih ~]# [root@MehmetSalih ~]# fdisk /dev/sdc Welcome to fdisk (util-linux 2.23.2). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Command (m for help): n Partition type: p primary (1 primary, 0 extended, 3 free) e extended Select (default p): p Partition number (2-4, default 2): 2 First sector (62916608-104857599, default 62916608): Using default value 62916608 Last sector, +sectors or +size{K,M,G} (62916608-104857599, default 104857599): Using default value 104857599 Partition 2 of type Linux and of size 20 GiB is set Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks. [root@MehmetSalih ~]#
The first disk that we split into 2 logic partition with the Fdisk tool is formatted in ext4 format as follows.
[root@MehmetSalih ~]# mkfs -t ext4 /dev/sdc1 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 983040 inodes, 3932160 blocks 196608 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=2151677952 120 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 Allocating group tables: done Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done [root@MehmetSalih ~]#
Mount the formatted /dev/sdc1 disk in linux with the following steps.
[root@MehmetSalih ~]# mkdir /u01 [root@MehmetSalih ~]# mount -t ext4 /dev/sdc1 /u01 [root@MehmetSalih ~]# df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 851M 0 851M 0% /dev tmpfs 864M 0 864M 0% /dev/shm tmpfs 864M 8.6M 855M 1% /run tmpfs 864M 0 864M 0% /sys/fs/cgroup /dev/mapper/ol_mehmetsalih-root 12G 12G 751M 94% / /dev/sda1 1014M 186M 829M 19% /boot tmpfs 173M 0 173M 0% /run/user/0 /dev/sdc1 30G 41M 29G 1% /u01 [root@MehmetSalih ~]#
[root@MehmetSalih ~]# df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 1.4G 0 1.4G 0% /dev tmpfs 1.4G 472M 884M 35% /dev/shm tmpfs 1.4G 9.0M 1.4G 1% /run tmpfs 1.4G 0 1.4G 0% /sys/fs/cgroup /dev/mapper/ol_mehmetsalih-root 12G 7.1G 4.9G 60% / /dev/sdb1 20G 16G 2.6G 87% /oradata /dev/sdc1 30G 20G 8.4G 71% /u01 /dev/sda1 1014M 242M 773M 24% /boot tmpfs 272M 12K 272M 1% /run/user/42 tmpfs 272M 0 272M 0% /run/user/54321 tmpfs 272M 0 272M 0% /run/user/0
With fdisk, the final state of the disks are as follows.
/u01 and /oradata disks are mounted on the linux server, but they will not automatically mount when the server restarts. To be auto-mount, /etc/fstab is added with vi as follows.
[root@MehmetSalih ~]# vi /etc/fstab # /etc/fstab # Created by anaconda on Mon Feb 18 12:15:13 2019 # # Accessible filesystems, by reference, are maintained under '/dev/disk' # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info # /dev/mapper/ol_mehmetsalih-root / xfs defaults 0 0 UUID=c86fb897-d687-4870-8c02-135b2a9f712d /boot xfs defaults 0 0 /dev/mapper/ol_mehmetsalih-swap swap swap defaults 0 0 /dev/sdc1 /u01 ext4 defaults 0 0 /dev/sdb1 /oradata ext4 defaults 0 0
Do you want to learn Linux System Administration for Beginners, then read the following articles.
https://ittutorial.org/linux-administration-tutorial-for-beginners/