Red Hat Enterprise Linux




Chapters     |     Exercises     |     Workshop     |    

Storage


Disks

/dev/sda A hard disk that uses the SCSI driver. Used for SCSI and SATA disk devices. Common on physical servers but also in VMware virtual machines.

/dev/hda The (legacy) IDE disk device type. You will seldom see this device type on modern computers.

/dev/vda A disk in a KVM virtual machine that uses the virtio disk driver. This is the common disk device type for KVM virtual machines.

/dev/xvda A disk in a Xen virtual machine that uses the Xen virtual disk driver. You see this when installing RHEL as a virtual machine in Xen. RHEL 7 cannot be used as a Xen hypervisor, but you might see RHEL 7 virtual machines on top of the Xen hypervisor using these disk types.

/dev/nvme

As you can see, all disk device names end with the letter a. That is because it is the first disk that was found in your server. The second SCSI disk, for instance, would have the name /dev/sdb. If many disks are installed in a server, you can have up to /dev/sdz and even beyond. After /dev/sdz, the kernel continues creating devices with names like /dev/sdaa and /dev/sdab.


Partitions

Partitions Creation

  1. Open disk with fdisk Utility
  2. n command for new partition
  3. Choose the type of partition
  4. Choose The partition number
  5. Define first sector
  6. Define Last Sector
  7. w command to save configuration
Example

Commands

[root@redhat ~]# lsblk list disks details
[root@redhat ~]# lsblk -f list disks details including filesystems


[root@redhat ~]# df show mounted partitions usage
[root@redhat ~]# df -h Human View of df Commmand


[root@redhat ~]# du show disk usage of directories (du /root)
[root@redhat ~]# du -h Human view
[root@redhat ~]# du -h /home/user1 Example

[root@redhat ~]# blkid The blkid command gives an overview of existing partitions with a file system on them and the UUID of the filesystem, as well as the file system used to format the partition.

[root@redhat ~]# blkid partition

Mount an image on a device

[root@redhat ~]# dd if=image.iso of=special_file
[root@redhat ~]# dd if=image.img of=special_file

Removable Storage Devices
/run/media/user/label

Clone Device

[root@lab ~]# cat /dev/sda > /dev/sdb!
[root@lab ~]# dd if=/dev/sda of=/dev/sdb more efficient

gdisk used for operating on GPT Partitions

[root@lab ~]# gdisk /dev/disk Operate on disk
[root@lab ~]# gdisk /dev/partition Operate on partition


Volumes

Volume is a disk partition formated with a filesystem . Before using a disk partition to store files, we must :
  1. format it (filesystem)
  2. mount it in a directory

Format Partition

Syntax
[root@lab ~]# mkfs.filesystem –b blocksize partition format a partition [+]

exple: [root@lab ~]# mkfs.ext2 –b 2048 /dev/sda3

Mount a Volume

[root@redhat ~]# mount show mounted devices
[root@redhat ~]# mount specialfile mountdirectory
[root@redhat ~]# mount –o loop ISOfile mountdirectory
[root@redhat ~]# umount mountdirectory

[root@redhat ~]# mount -av monte tous les volumes specifies dans /etc/fstab

Volume Settings

UUID
LABEL

[root@redhat ~]# e2label partition label : Make label for an EXT Volume



[root@redhat ~]# xfs_admin -L label partition-file : Make label for an XFS Volume



Volumes Automounting

We need to configure /etc/fstab file to automount a Volume (Automatically mount when System boots)

Check Disk Partition

[root@redhat ~]# fsck specialfile brief check of disk
[root@redhat ~]# fsck /dev/sdg1 brief check of disk
[root@redhat ~]# xfs_repair partition brief check of xfs partition
[root@redhat ~]# xfs_repair /dev/sdg1 brief check of xfs partition

Files

/mnt/ : System Default mountpoint directory

Disk Utilities


Files

/etc/fstab Automatic mount points [+]

Eninam BAGNABANA     |         |     bagnadavid@outlook.fr     |