You may need to add disk to your server. Adding a disk to Oracle Linux involves several steps, including identifying the disk, partitioning it if necessary, formatting it with a filesystem, and then mounting it to make it accessible to the operating system.
Here’s a general outline of the process:
Devamını oku: How to add new disk at Oracle Linux?- Identify the Disk: When you add a disk to your system (whether it’s a physical disk or a virtual disk), you need to identify its device name.
You can use utilities likelsblk
,fdisk -l
, orlshw
to list all available disks and their partitions.
[root@oraclevm ~]# fdisk -l
Disk /dev/sdc: 536.9 GB, 536870912000 bytes, 1048576000 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
or you can use below syntax
fdisk -l |egrep ‘^Disk’ |egrep -v ‘dm-‘
[root@oraclevm ~]# ls -l /dev/sd*
brw-rw—-. 1 root disk 8, 0 May 18 14:10 /dev/sda
brw-rw—-. 1 root disk 8, 1 May 18 14:10 /dev/sda1
brw-rw—-. 1 root disk 8, 2 May 18 14:10 /dev/sda2
brw-rw—-. 1 root disk 8, 16 May 18 14:13 /dev/sdb
brw-rw—-. 1 root disk 8, 17 May 18 14:24 /dev/sdb1
brw-rw—-. 1 root disk 8, 32 Sep 1 10:52 /dev/sdc <<< this is our disk
We are going to add Disk /dev/sdc: 536.9 GB disk to our server. Let us check first our disk paths
[root@oraclevm ~]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 16G 0 16G 0% /dev
tmpfs 16G 1000K 16G 1% /dev/shm
tmpfs 16G 41M 16G 1% /run
tmpfs 16G 0 16G 0% /sys/fs/cgroup
/dev/mapper/centos_oraclevm-root 46G 1.8G 42G 5% /
/dev/sda1 477M 157M 291M 35% /boot
/dev/mapper/VG_DATA-LV_DATA 493G 5.9G 462G 2% /apps
tmpfs 3.2G 0 3.2G 0% /run/user/0
- Partition the Disk (if necessary): If the disk is not already partitioned, you may need to create a partition on it using a partitioning tool like
fdisk
,parted
, orgparted
.
root@oraclevm ~]# fdisk /dev/sdc << DO NOT CHOOSE WRONG DISK!!
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 0xa70a78b6.
Command (m for help): p
Disk /dev/sdc: 536.9 GB, 536870912000 bytes, 1048576000 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 label type: dos
Disk identifier: 0xa70a78b6
Device Boot Start End Blocks Id System
Command (m for help): p
Disk /dev/sdc: 536.9 GB, 536870912000 bytes, 1048576000 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 label type: dos
Disk identifier: 0xa70a78b6
Device Boot Start End Blocks Id System
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-1048575999, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-1048575999, default 1048575999):
Using default value 1048575999
Partition 1 of type Linux and of size 500 GiB is set
Command (m for help): p
Disk /dev/sdc: 536.9 GB, 536870912000 bytes, 1048576000 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 label type: dos
Disk identifier: 0xa70a78b6
Device Boot Start End Blocks Id System
/dev/sdc1 2048 1048575999 524286976 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
- Let us check disk is listed or not
[root@oraclevm ~]# ls -l /dev/sd*
brw-rw—-. 1 root disk 8, 0 May 18 14:10 /dev/sda
brw-rw—-. 1 root disk 8, 1 May 18 14:10 /dev/sda1
brw-rw—-. 1 root disk 8, 2 May 18 14:10 /dev/sda2
brw-rw—-. 1 root disk 8, 16 May 18 14:13 /dev/sdb
brw-rw—-. 1 root disk 8, 17 May 18 14:24 /dev/sdb1
brw-rw—-. 1 root disk 8, 32 Sep 1 13:46 /dev/sdc
brw-rw—-. 1 root disk 8, 33 Sep 1 13:46 /dev/sdc1 –> here is our disk
- Format the Partition: Once the disk (or partition) is created, you need to format it with a filesystem. Common filesystems on Linux include ext4, XFS, and Btrfs. Use the mkfs command to create the filesystem.
Let us do it for our disk
[root@oraclevm ~]# mkfs -t ext3 /dev/sdc1
Discarding device blocks: done
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
32768000 inodes, 131071744 blocks
6553587 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
4000 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, 71663616, 78675968,
102400000
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information:
done
- Create folder and mount it
[root@oraclevm ]# mkdir /backup
[root@oraclevm ]# chown -R oracle:oinstall /backup
[root@oraclevm ]# mount -t ext3 /dev/sdc1 /backup
[root@oraclevm ]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 16G 0 16G 0% /dev
tmpfs 16G 608K 16G 1% /dev/shm
tmpfs 16G 41M 16G 1% /run
tmpfs 16G 0 16G 0% /sys/fs/cgroup
/dev/mapper/centos_oraclevm-root 46G 1.8G 42G 5% /
/dev/sda1 477M 157M 291M 35% /boot
/dev/mapper/VG_DATA-LV_DATA 493G 5.9G 462G 2% /apps
tmpfs 3.2G 0 3.2G 0% /run/user/0
/dev/sr0 4.3G 4.3G 0 100% /mnt
/dev/sdc1 493G 70M 467G 1% /backup
- Do not forget to add disk details at Fstap
[root@oraclevm ~]# vi /etc/fstab
#/etc/fstab
Created by anaconda on Tue Nov 6 14:31:29 2018##
/dev/mapper/vg_oraclevm-lv_root / ext4 defaults 1 1
UUID=825b01fc-7f9c-4d4d-8d3a-25ed14df9d65 /boot ext4 defaults 1 2
/dev/mapper/vg_oraclevm-lv_home /home ext4 defaults 1 2
/dev/mapper/vg_oraclevm-lv_swap swap swap defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
/dev/sdc1 /backup ext3 defaults 0 0 <<<Our disk
~
Yorum bırakın