reference: https://www.tecmint.com/add-new-disk-to-an-existing-linux/
[root@database-rhel79 ~]# df -k
Filesystem 1K-blocks Used Available Use% Mounted on
devtmpfs 16372740 0 16372740 0% /dev
tmpfs 16389744 0 16389744 0% /dev/shm
tmpfs 16389744 25812 16363932 1% /run
tmpfs 16389744 0 16389744 0% /sys/fs/cgroup
/dev/mapper/rhel_database--rhel79-root 46110724 40634232 5476492 89% /
/dev/sda1 1038336 228548 809788 23% /boot
tmpfs 3270168 12 3270156 1% /run/user/42
tmpfs 3270168 0 3270168 0% /run/user/0
[root@database-rhel79 ~]# fdisk -l
Disk /dev/sda: 53.7 GB, 53687091200 bytes, 104857600 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: 0x000bbcfa
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 2099199 1048576 83 Linux
/dev/sda2 2099200 104857599 51379200 8e Linux LVM
Disk /dev/mapper/rhel_database--rhel79-root: 47.2 GB, 47240445952 bytes, 92266496 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/rhel_database--rhel79-swap: 5368 MB, 5368709120 bytes, 10485760 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/sdb: 53.7 GB, 53687091200 bytes, 104857600 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@database-rhel79 ~]# fdisk /dev/sdb
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 0x2551332d.
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): +50G
Value out of range.
Last sector, +sectors or +size{K,M,G} (2048-104857599, default 104857599): +52G
Value out of range.
Last sector, +sectors or +size{K,M,G} (2048-104857599, default 104857599): +49G
Partition 1 of type Linux and of size 49 GiB is set
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@database-rhel79 ~]#
[root@database-rhel79 ~]# mkfs.ext4 /dev/sdb1
mke2fs 1.42.9 (28-Dec-2013)
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
3211264 inodes, 12845056 blocks
642252 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2162163712
392 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
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
[root@database-rhel79 ~]# mount /dev/sdb1 '^C
[root@database-rhel79 ~]# mkdir /data
[root@database-rhel79 ~]# mount /dev/sdb1 /data
[root@database-rhel79 ~]# df -k
Filesystem 1K-blocks Used Available Use% Mounted on
devtmpfs 16372740 0 16372740 0% /dev
tmpfs 16389744 0 16389744 0% /dev/shm
tmpfs 16389744 26032 16363712 1% /run
tmpfs 16389744 0 16389744 0% /sys/fs/cgroup
/dev/mapper/rhel_database--rhel79-root 46110724 40600652 5510072 89% /
/dev/sda1 1038336 228548 809788 23% /boot
tmpfs 3270168 32 3270136 1% /run/user/0
/dev/sr0 4420474 4420474 0 100% /run/media/root/RHEL-7.9 Server.x86_64
/dev/sdb1 50442784 53272 47804120 1% /data
[root@database-rhel79 ~]# chmod 777 /data
Make an entry in /etc/fstab file for permanent mount at boot time.
No comments:
Post a Comment