Check the newly added disk partition using fdisk

[root@dgprim01 oracle]# fdisk -l|grep -A9 '12 GiB'
Disk /dev/sdb: 12 GiB, 12884901888 bytes, 25165824 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

Check for permissions

[root@dgprim01 oracle]# ls -lHL /dev/sdb
brw-rw----. 1 root disk 8, 16 Sep  2 20:04 /dev/sdb

Create partition and sector with fdisk

[root@dgprim01 oracle]# fdisk /dev/sdb

Welcome to fdisk (util-linux 2.32.1).
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.
Created a new DOS disklabel with disk identifier 0x289c26ed.

Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-25165823, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-25165823, default 25165823):

Created a new partition 1 of type 'Linux' and of size 12 GiB.

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

Make the filesystem as ext4

[root@dgprim01 /]# mkfs.ext4 /dev/sdb1
mke2fs 1.45.6 (20-Mar-2020)
Creating filesystem with 3145472 4k blocks and 786432 inodes
Filesystem UUID: 3767b617-6a23-447b-9fa7-61c1a36a3529
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208

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

Mount the filesystem on the directory which should be mapped

[root@dgprim01 /]# mkdir /u01
mkdir: cannot create directory ‘/u01’: File exists
[root@dgprim01 /]# mount /dev/sdb1 /u01
[root@dgprim01 /]#

Edit fstab to make permanent changes

[root@dgprim01 /]# cat /etc/fstab |grep /dev/sdb1
/dev/sdb1               /u01                    ext4    defaults        1 2

Leave a Reply