Storage:
types of storages:
• Local Storage.
• SAN (storage area network)
• NAS (network attached storage)
***************************************
Commands for disk partitions:
• df: lists the filesystems and its info
• fdisk: lists the disks and the partitions on the disks
***************************************
Adding the disk and creating the partitions and creating filesystem from partition and mounting it on the directory:
fdisk /dev/sdb: It will open the fdisk program.
n: create new partition
pick the partition number: 1 first sector: default 2048
Last sector: +1G (creating the partition of 1G)
partition 1 of type Linux of size 1Gb is set.
w: write the table to disk and exit.
fdisk -l: it will now show the /dev/sdb1 partition created on the /dev/sdb disk,
mkfs.xfs /dev/sdb1: make the xfs filsystem for /dev/sdb1 partition
mkdir /data: create data directory
mount /dev/sdb1 /data: mount filesystem /dev/sdb1 on data directory.
df -h: outputs the filesystems where we can see /dev/sdb1 filesystem mounted on /data.
write the below line to /etc/fstab so that /dev/sdb1 should mount automatically on /data after the reboot.
/dev/sdb1 /data xfs defaults 0 0
umount /data: unmount /data
mount -a: mount all the filesystems mentioned in fstab file
*************************************
LVM:
fdisk /dev/sdc: It will open the fdisk program.
n: create new partition
pick the partition number: 1 first sector: default 2048
Last sector: +1G (creating the partition of 1G)
partition 1 of type Linux of size 1Gb is set.
t: change partition type
8e: change partition type to linux lvm
w: write the table to disk and exit.
fdisk -l: it will now show the /dev/sdc1 partition created on the /dev/sdc disk.
pvcreate /dev/sdc1: physical volume create.
pvs :shows the physical volumes info.
vgcreate oraclevg /dev/sdc1: creating volume group named oraclevg from physical volume /dev/sdc1.
vgs: gives the list of the volume groups.
lvcreate -n oraclelv --size 1G oraclevg: creating oraclelv logical volume of 1gb from oraclevg volume group
lvs :gives the list of the logical volumes
lvdisplay: display the logical volume info also displays the Ivpath info
mkfs.xfs /dev/oraclevg/oraclelv : creates the xfs filesystem where /dev/oraclevg/oraclelv is the Ivpath
mkdir /oracle: create oracle directory
mount /dev/oraclevg/oraclelv /oracle: mount filesystem on the oracle directory
*********************************
Adding and extending the disk using the LVM:
lets add the new disk /dev/sdd of 1GB and lets extend /oracle filesystem which is created above.
fdisk /dev/sdd: It will open the fdisk program.
n: create new partition
p: primary partition
pick the partition number: 1
first sector: default 2048
Last sector: +1G (creating the partition of 16)
partition 1 of type Linux of size 1Gb is set.
t: change partition type
8e: change partition type to linux ivm
w: write the table to disk and exit
fdisk -l : it will now show the /dev/sdd1 partition created on the /dev/sdd disk
pvcreate /dev/sdd1: physical volume create
pvs: shows the physical volumes info
vgextend oraclevg /dev/sdd1: extending the oraclevg volume group by the size of /dev/sdd1 physical volume.
Ivextend -L +1G /dev/oraclevg/oraclelv : extends the oraclelv logical volume because oraclevg volume group was extended
xfs_growfs /dev/oraclevg/oraclelv : grow your filesystem
************************************
Implementing advance storage features:
Redhat 8 introduces the next generation volume management solution called Stratis.It uses thin
provisioning by default. It combines the process of creating logical volume management (LVM) and creation of filesystems into one management.
In LVM if the filesystem gets full you will have to extend it manually whereas stratis extends the filesystem automatically if it has available space in its pool.
•Install the stratis
yum/dnf install stratis-cli stratisd
• Enable and start stratis service.
systemctl enable/start stratisd
• Add 2 5gb disks and verfiy from OS level:
lsblk (sdb and sdc)
•creating the pool:
stratis pool create pool1 /dev/sdb
•verify the pool has been created:
stratis pool list
•create a new filesystem using stratis:
stratis filesystem create pool1 fs1
• verify fs1 filesystem created:
stratis filesystem list
•create the directory:
mkdir /bigdata
•mount the fs1 filesystem on bigdata directory: mount /dev/stratis/pool1/fs1 /bigdata
• check if the filesystem has been created :
lsblk and df -hT
•take the snapshot of your filesystem:
stratis filesystem snapshot pool1 fs1 fs1-snap
•list the stratis filesystem:
stratis filesystem list : it will list 2 filesystems. fs1 and fs1-snap.
•Add the entry to /etc/fstab to mount at boot:
UUID="asf-0887afgdja-" /bigdata xfs defaults, x-systemd.requires=stratisd.service 0 0
Comments
Post a Comment