Format And Mount local2

From DISI
Jump to navigation Jump to search

Format Disk

Do these commands as root:

  • fdisk -l
    • Find disks/RAID disks to format
  • parted
  • print
  • mklabel gpt
  • mkpart logical 0GB 9995GB. (based on what we read in result of print above)
  • print. (to confirm)
  • quit


Mount storage disks using LVM

Reference guide: https://www.thegeekdiary.com/redhat-centos-a-beginners-guide-to-lvm-logical-volume-manager/

Scan devices to be used as physical volumes (PV)

  • lvmdiskscan

Initialize the block devices

  • pvcreate <drive1> <drive2> <...> ...
    • Example: pvcreate /dev/sdb /dev/sdc /dev/sdd

To double check PV

  • pvdisplay
  • pvscan
  • pvs

After PV, create a Volume Group (VG)

  • vgcreate <name of volume> <drive1> <drive2> <...> ...
    • Example: vgcreate soft2 /dev/sdb /dev/sdc /dev/sdd

To double check VG

  • vgs <VG name>
  • vgdisplay <VG name>

After VG, create a Logical Volume (LV)

  • lvcreate <options> <name of LV> <VG Name>
    • Example: lvcreate -l 100%FREE -n soft_lv soft2
      • -l is for storage space in percent, 100%FREE means use all space in VG
      • -n is for name of LV

Double Check LV

  • lvs /dev/<VG NAME>/<LV NAME>
  • lvdisplay /dev/<VG NAME>/<LV NAME>
  • lvscan

Last step, create a File System

  • mkfs.ext4 <options> /dev/<VG NAME>/<LV NAME>
  • Example: mkfs.ext4 /dev/soft2/soft_lv

It's time to mount Make the directory first:

  • mkdir <somewhere>
    • Example: mkdir /export/soft2
  • mount /dev/<VG NAME>/<LV NAME> <somewhere>
    • Example: mount /dev/soft2/soft_lv /export/soft2/

Make it permanent by editing fstab:

  • vim /etc/fstab
/dev/<VG NAME>/<LV NAME>      <somewhere>       <type of file system>      <mount options>      <dump>         <fsck>
example:
/dev/soft2/soft_lv	/export/soft2	ext4	defaults	1	2

Partition Disk