Menambah Hardisk baru di Server CentOS

Menambah Hardisk baru di Server CentOS

Cara Menambah Disk Baru Di Centos, dengan Harddisk Baru kapasitas yang lebih besar,

bisa menyimpan data lebih banyak. Namun di CentOS ada beberapa konfigurasi partisi dan lainnya, agar Harddisk yang baru dapat digunakan. Apa saja yang di konfigurasi, bisa mengikuti langkah-langkah berikut

[root@localhost ~]#  df -h
Filesystem           Size  Used Avail Use% Mounted on
devtmpfs             889M     0  889M   0% /dev
tmpfs                908M     0  908M   0% /dev/shm
tmpfs                908M  8.7M  900M   1% /run
tmpfs                908M     0  908M   0% /sys/fs/cgroup
/dev/mapper/cs-root   38G  1.8G   37G   5% /
/dev/mapper/cs-home   19G  165M   19G   1% /home
/dev/sda2           1014M  192M  823M  19% /boot
/dev/sda1            599M  7.3M  592M   2% /boot/efi
tmpfs                182M     0  182M   0% /run/user/0
[root@localhost ~]#  fdisk -l
Disk /dev/sda: 60 GiB, 64424509440 bytes, 125829120 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
Disklabel type: gpt
Disk identifier: A3C92809-F586-41C8-AEA0-9DA77DE4A2F4

Device       Start       End   Sectors  Size Type
/dev/sda1     2048   1230847   1228800  600M EFI System
/dev/sda2  1230848   3327999   2097152    1G Linux filesystem
/dev/sda3  3328000 125827071 122499072 58.4G Linux LVM


Disk /dev/sdb: 900 GiB, 966367641600 bytes, 1887436800 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 /dev/mapper/cs-root: 37.9 GiB, 40659582976 bytes, 79413248 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 /dev/mapper/cs-swap: 2.1 GiB, 2206203904 bytes, 4308992 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 /dev/mapper/cs-home: 18.5 GiB, 19851640832 bytes, 38772736 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
[root@localhost ~]#  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 0x4e6d4cd4.

Command (m for help):  m  

Help:

  DOS (MBR)
   a   toggle a bootable flag
   b   edit nested BSD disklabel
   c   toggle the dos compatibility flag

  Generic
   d   delete a partition
   F   list free unpartitioned space
   l   list known partition types
   n   add a new partition
   p   print the partition table
   t   change a partition type
   v   verify the partition table
   i   print information about a partition

  Misc
   m   print this menu
   u   change display/entry units
   x   extra functionality (experts only)

  Script
   I   load disk layout from sfdisk script file
   O   dump disk layout to sfdisk script file

  Save & Exit
   w   write table to disk and exit
   q   quit without saving changes

  Create a new label
   g   create a new empty GPT partition table
   G   create a new empty SGI (IRIX) partition table
   o   create a new empty DOS partition table
   s   create a new empty Sun partition table
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-1887436799, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-1887436799, default 1887436799):

Created a new partition 1 of type 'Linux' and of size 900 GiB.
Command (m for help):  p 
Disk /dev/sdb: 900 GiB, 966367641600 bytes, 1887436800 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
Disklabel type: dos
Disk identifier: 0x4e6d4cd4

Device     Boot Start        End    Sectors  Size Id Type
/dev/sdb1        2048 1887436799 1887434752  900G 83 Linux
Command (m for help):  t 
Selected partition 1
Hex code (type L to list all codes):  L 

 0  Empty           24  NEC DOS         81  Minix / old Lin bf  Solaris
 1  FAT12           27  Hidden NTFS Win 82  Linux swap / So c1  DRDOS/sec (FAT-
 2  XENIX root      39  Plan 9          83  Linux           c4  DRDOS/sec (FAT-
 3  XENIX usr       3c  PartitionMagic  84  OS/2 hidden or  c6  DRDOS/sec (FAT-
 4  FAT16 <32M      40  Venix 80286     85  Linux extended  c7  Syrinx
 5  Extended        41  PPC PReP Boot   86  NTFS volume set da  Non-FS data
 6  FAT16           42  SFS             87  NTFS volume set db  CP/M / CTOS / .
 7  HPFS/NTFS/exFAT 4d  QNX4.x          88  Linux plaintext de  Dell Utility
 8  AIX             4e  QNX4.x 2nd part 8e  Linux LVM       df  BootIt
 9  AIX bootable    4f  QNX4.x 3rd part 93  Amoeba          e1  DOS access
 a  OS/2 Boot Manag 50  OnTrack DM      94  Amoeba BBT      e3  DOS R/O
 b  W95 FAT32       51  OnTrack DM6 Aux 9f  BSD/OS          e4  SpeedStor
 c  W95 FAT32 (LBA) 52  CP/M            a0  IBM Thinkpad hi ea  Rufus alignment
 e  W95 FAT16 (LBA) 53  OnTrack DM6 Aux a5  FreeBSD         eb  BeOS fs
 f  W95 Ext'd (LBA) 54  OnTrackDM6      a6  OpenBSD         ee  GPT
10  OPUS            55  EZ-Drive        a7  NeXTSTEP        ef  EFI (FAT-12/16/
11  Hidden FAT12    56  Golden Bow      a8  Darwin UFS      f0  Linux/PA-RISC b
12  Compaq diagnost 5c  Priam Edisk     a9  NetBSD          f1  SpeedStor
14  Hidden FAT16 <3 61  SpeedStor       ab  Darwin boot     f4  SpeedStor
16  Hidden FAT16    63  GNU HURD or Sys af  HFS / HFS+      f2  DOS secondary
17  Hidden HPFS/NTF 64  Novell Netware  b7  BSDI fs         fb  VMware VMFS
18  AST SmartSleep  65  Novell Netware  b8  BSDI swap       fc  VMware VMKCORE
1b  Hidden W95 FAT3 70  DiskSecure Mult bb  Boot Wizard hid fd  Linux raid auto
1c  Hidden W95 FAT3 75  PC/IX           bc  Acronis FAT32 L fe  LANstep
1e  Hidden W95 FAT1 80  Old Minix       be  Solaris boot    ff  BBT
Hex code (type L to list all codes): 83
Changed type of partition 'Linux' to 'Linux'.

Command (m for help):  w 
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
[root@localhost ~]#  fdisk -l
Disk /dev/sda: 60 GiB, 64424509440 bytes, 125829120 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
Disklabel type: gpt
Disk identifier: A3C92809-F586-41C8-AEA0-9DA77DE4A2F4

Device       Start       End   Sectors  Size Type
/dev/sda1     2048   1230847   1228800  600M EFI System
/dev/sda2  1230848   3327999   2097152    1G Linux filesystem
/dev/sda3  3328000 125827071 122499072 58.4G Linux LVM


Disk /dev/sdb: 900 GiB, 966367641600 bytes, 1887436800 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
Disklabel type: dos
Disk identifier: 0x4e6d4cd4

Device     Boot Start        End    Sectors  Size Id Type
/dev/sdb1        2048 1887436799 1887434752  900G 83 Linux


Disk /dev/mapper/cs-root: 37.9 GiB, 40659582976 bytes, 79413248 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 /dev/mapper/cs-swap: 2.1 GiB, 2206203904 bytes, 4308992 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 /dev/mapper/cs-home: 18.5 GiB, 19851640832 bytes, 38772736 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
[root@localhost ~]#  mkfs.ext4 /dev/sdb1
mke2fs 1.45.6 (20-Mar-2020)
Creating filesystem with 235929344 4k blocks and 58982400 inodes
Filesystem UUID: 101225e0-f6f9-492b-9469-7fd52a50d4cd
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
        102400000, 214990848

Allocating group tables: done
Writing inode tables: done
Creating journal (262144 blocks): [Tekan Enter]
done
Writing superblocks and filesystem accounting information: done
[root@localhost ~]#  nano /etc/fstab
-bash: nano: command not found

[root@localhost ~]#  dnf -y install nano
Last metadata expiration check: 1:11:02 ago on Sat 13 Feb 2021 07:58:51 PM WIB.
Dependencies resolved.
===============================================================================================
 Package            Architecture         Version                    Repository            Size
===============================================================================================
Installing:
 nano               x86_64               2.9.8-1.el8                baseos               581 k

Transaction Summary
===============================================================================================
Install  1 Package

Total download size: 581 k
Installed size: 2.2 M
Downloading Packages:
nano-2.9.8-1.el8.x86_64.rpm                                    3.1 MB/s | 581 kB     00:00
-----------------------------------------------------------------------------------------------
Total                                                          776 kB/s | 581 kB     00:00
warning: /var/cache/dnf/baseos-055ffcb2ec25a27f/packages/nano-2.9.8-1.el8.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 8483c65d: NOKEY
CentOS Stream 8 - BaseOS                                       860 kB/s | 1.6 kB     00:00
Importing GPG key 0x8483C65D:
 Userid     : "CentOS (CentOS Official Signing Key) <This email address is being protected from spambots. You need JavaScript enabled to view it.>"
 Fingerprint: 99DB 70FA E1D7 CE22 7FB6 4882 05B5 55B3 8483 C65D
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                       1/1
  Installing       : nano-2.9.8-1.el8.x86_64                                               1/1
  Running scriptlet: nano-2.9.8-1.el8.x86_64                                               1/1
  Verifying        : nano-2.9.8-1.el8.x86_64                                               1/1

Installed:
  nano-2.9.8-1.el8.x86_64

Complete!
[root@localhost ~]#  nano /etc/fstab
#
# /etc/fstab
# Created by anaconda on Sat Feb 13 00:51:54 2021
#
# 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.
#
# After editing this file, run 'systemctl daemon-reload' to update systemd
# units generated from this file.
#
/dev/mapper/cs-root     /                       xfs     defaults        0 0
UUID=9ed785ee-9fee-426b-9838-c29ea613aa56 /boot                   xfs     defaults        0 0
UUID=2A5D-18E7          /boot/efi               vfat    umask=0077,shortname=winnt 0 2
/dev/mapper/cs-home     /home                   xfs     defaults        0 0
/dev/mapper/cs-swap     none                    swap    defaults        0 0
/dev/sdb1               /hdd1                   ext4    defaults        0 0
[root@localhost ~]#  mkdir /hdd1
[root@localhost ~]#  reboot
[root@localhost ~]#  fdisk -l
Disk /dev/sdb: 900 GiB, 966367641600 bytes, 1887436800 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
Disklabel type: dos
Disk identifier: 0x4e6d4cd4

Device     Boot Start        End    Sectors  Size Id Type
/dev/sdb1        2048 1887436799 1887434752  900G 83 Linux


Disk /dev/sda: 60 GiB, 64424509440 bytes, 125829120 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
Disklabel type: gpt
Disk identifier: A3C92809-F586-41C8-AEA0-9DA77DE4A2F4

Device       Start       End   Sectors  Size Type
/dev/sda1     2048   1230847   1228800  600M EFI System
/dev/sda2  1230848   3327999   2097152    1G Linux filesystem
/dev/sda3  3328000 125827071 122499072 58.4G Linux LVM


Disk /dev/mapper/cs-root: 37.9 GiB, 40659582976 bytes, 79413248 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 /dev/mapper/cs-swap: 2.1 GiB, 2206203904 bytes, 4308992 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 /dev/mapper/cs-home: 18.5 GiB, 19851640832 bytes, 38772736 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
[root@localhost ~]#  df -h
Filesystem           Size  Used Avail Use% Mounted on
devtmpfs             889M     0  889M   0% /dev
tmpfs                908M     0  908M   0% /dev/shm
tmpfs                908M  8.7M  900M   1% /run
tmpfs                908M     0  908M   0% /sys/fs/cgroup
/dev/mapper/cs-root   38G  1.8G   37G   5% /
/dev/sda2           1014M  192M  823M  19% /boot
/dev/mapper/cs-home   19G  165M   19G   1% /home
/dev/sda1            599M  7.3M  592M   2% /boot/efi
/dev/sdb1            885G   77M  840G   1% /hdd1
tmpfs                182M     0  182M   0% /run/user/0