Preparação dos discos
Certifique-se de que os discos que serão utilizados foram apresentados ao Host com o comando fdisk:
Bloco de código |
---|
theme | RDark |
---|
title | Comando para listagem dos discos |
---|
|
[root@vmappserver01 ~]# fdisk -l |
Bloco de código |
---|
|
[root@vmappserver01 ~]# fdisk -l
Disk /dev/sdb: 512 GiB, 549755813888 bytes, 1073741824 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 1048576 bytes
Disk /dev/sdc: 512 GiB, 549755813888 bytes, 1073741824 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 1048576 bytes
Disk /dev/sdd: 512 GiB, 549755813888 bytes, 1073741824 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 1048576 bytes
Disk /dev/sde: 512 GiB, 549755813888 bytes, 1073741824 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 1048576 bytes |
Note que os discos acima relacionados não possuem nenhuma partição ativa.
Criação dos Physical Volumes
Bloco de código |
---|
theme | RDark |
---|
title | Comando para criação dos volumes físicos |
---|
|
[root@vmappserver01 ~]# pvcreate /dev/sd[b-c-d-e] -v |
Bloco de códigoexpand |
---|
|
Bloco de código |
---|
[root@vmappserver01 ~]# pvcreate /dev/sd[b-c-d-e] -v
Wiping signatures on new PV /dev/sdb.
Wiping | Wiping signatures on new PV /dev/sdb.
Wiping signatures on new PV /dev/sdc.
Wiping signatures on new PV /dev/sdd.
Wiping signatures on new PV /dev/sde.
Set up physical volume for "/dev/sdb" with 1073741824 available sectors.
Zeroing start of device /dev/sdb.
Writing physical volume data to disk "/dev/sdb".
Physical volume "/dev/sdb" successfully created.
Set up physical volume for "/dev/sdc" with 1073741824 available sectors.
Zeroing start of device /dev/sdc.
Writing physical volume data to disk "/dev/sdc".
Physical volume "/dev/sdc" successfully created.
Set up physical volume for "/dev/sdd" with 1073741824 available sectors.
Zeroing start of device /dev/sdd.
Writing physical volume data to disk "/dev/sdd".
Physical volume "/dev/sdd" successfully created.
Set up physical volume for "/dev/sde" with 1073741824 available sectors.
Zeroing start of device /dev/sde.
Writing physical volume data to disk "/dev/sde".
Physical volume "/dev/sde" successfully created. |
|
Para validar os volumes criados, execute o comando “pvs” que deverá retornar a saída abaixo:
Bloco de código |
---|
theme | RDark |
---|
title | Comando para validação dos volumes criados |
---|
|
[root@vmappserver01 ~]# pvs |
Expandir |
---|
|
Bloco de código |
---|
| [root@vmappserver01 ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sda3 ocivolume lvm2 a-- 45.47g 0 (Volume do Sistema Operacional)
/dev/sdb lvm2 --- 512.00g 512.00g
/dev/sdc lvm2 --- 512.00g 512.00g
/dev/sdd lvm2 --- 512.00g 512.00g
/dev/sde lvm2 --- 512.00g 512.00g |
|
...
Criação do Volume Group (VG)
Bloco de código |
---|
theme | RDark |
---|
title | Comando para criação do Volume Group |
---|
|
vgcreate -[root@vmappserver01 ~]# vgcreate -s 8M totvs /dev/sd[b-c-d-e] -v |
Bloco de códigoexpand |
---|
|
Bloco de código |
---|
[root@vmappserver01 ~]# vgcreate -s 8M totvs /dev/sd[b-c-d-e] -v
Wiping signatures on new PV /dev/sdb
Wiping signatures on new PV /dev/sdc.
Wiping signatures on new PV /dev/sdd.
Wiping signatures on new PV /dev/sde.
Adding physical volume '/dev/sdb' to volume group 'totvs'
Adding physical volume '/dev/sdc' to volume group 'totvs'
Adding physical volume '/dev/sdd' to volume group 'totvs'
Adding physical volume '/dev/sde' to volume group 'totvs'
Archiving volume group "totvs" metadata (seqno 0).
Creating volume group backup "/etc/lvm/backup/totvs" (seqno 1).
Volume group "totvs" successfully created |
|
Bloco de código |
---|
theme | RDark |
---|
title | Comando para ativar o Volume Group |
---|
|
[root@vmappserver01 ~]# vgchange -a y /dev/totvs/lv_stripe |
Bloco de códigoexpand |
---|
|
Bloco de código |
---|
[root@vmappserver01 ~]# vgchange -a y /dev/totvs/lv_stripe
0 | 0 logical volume(s) in volume group "totvs" now active |
|
Criação do Logical Volume
Bloco de código |
---|
theme | RDark |
---|
title | Comando para ciação do Logical Volume |
---|
|
[root@vmappserver01 ~]# lvcreate -L 2000G -n lv_stripe totvs |
Bloco de códigoexpand |
---|
|
Bloco de código |
---|
[root@vmappserver01 ~]# lvcreate -L 2000G -n lv_stripe totvs
WARNING: ext4 signature detected on /dev/ | WARNING: ext4 signature detected on /dev/totvs/lv_stripe at offset 1080. Wipe it? [y/n]: y
Wiping ext4 signature on /dev/totvs/lv_stripe.
Logical volume "lv_stripe" created. |
|
...
Verificando o Logical Volume
Bloco de código |
---|
theme | RDark |
---|
title | Comando para visualizar o volume criado |
---|
|
[root@vmappserver01 ~]# lvdisplay totvs/lv_stripe -m |
Bloco de códigoexpand |
---|
|
Bloco de código |
---|
[root@vmappserver01 ~]# lvdisplay totvs/lv_stripe -m
--- Logical volume ---
LV Path /dev/totvs/lv_stripe
LV Name lv_stripe
VG Name totvs
LV UUID s2q3rr-flaD-5Ahx-i4OJ-RYR7-mCse-7ijSMV
LV Write Access read/write
LV Creation host, time prodvmprim, 2021-08-03 19:07:51 +0000
LV Status available
# open 0
LV Size 1.95 TiB
Current LE 256000
Segments 4
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:2
--- Segments ---
Logical extents 0 to 65534:
Type linear
Physical volume /dev/sdb
Physical extents 0 to 65534
Logical extents 65535 to 131069:
Type linear
Physical volume /dev/sdc
Physical extents 0 to 65534
Logical extents 131070 to 196604:
Type linear
Physical volume /dev/sdd
Physical extents 0 to 65534
Logical extents 196605 to 255999:
Type linear
Physical volume /dev/sde
Physical extents 0 to 59394 |
|
...
Formatando o LVM
Qualquer sistema de arquivos pode ser usado para formatar o volume lógico; neste caso, no nosso caso o método utilizado formato de sistema de arquivos utilizado é o ext4 que até o momento está homologado.É importante tomar cuidado com esse comando pois não (atualmente homologado).
Aviso |
---|
|
Não é possível desfazer a formatação depois que concluída. Caso haja dados no volume, efetue o backup antes de formatar. |
, caso tenha dados favor efetuar backup.
Bloco de código |
---|
theme | RDark |
---|
title | Comando para formatar o LVM |
---|
|
[root@vmappserver01 ~]# mkfs.ext4 /dev/totvs/lv_stripe |
...
Criação do Diretório
...
e montagem do LVM
Bloco de código |
---|
theme | RDark |
---|
title | Comando para criação do diretório |
---|
|
[root@vmappserver01 ~]# mkdir /totvs |
Bloco de código |
---|
theme | RDark |
---|
title | Comando para a montagem do diretório |
---|
|
[root@vmappserver01 ~]# mount /dev/totvs/lv_stripe /totvs |
Bloco de código |
---|
theme | RDark |
---|
title | Comando para visualizar os volumes montados |
---|
|
[root@vmappserver01 ~]# df -lh |
Bloco de códigoexpand |
---|
title | Retorno do comando df -lh |
---|
|
Bloco de código |
---|
[root@vmappserver01 ~]# df -lh
Filesystem Size Used Avail Use% Mounted on
devtmpfs 32G 0 32G 0% /dev
tmpfs 32G 0 32G 0% /dev/shm
tmpfs 32G 17M 32G 1% /run
tmpfs 32G 0 32G 0% /sys/fs/cgroup
/dev/mapper/ocivolume-root 36G 12G 25G 33% /
/dev/mapper/ocivolume-oled 10G 109M 9.9G 2% /var/oled
/dev/sda2 1014M 277M 738M 28% /boot
/dev/sda1 100M 5.1M 95M 6% /boot/efi
tmpfs 6.3G 0 6.3G 0% /run/user/989
tmpfs 6.3G 0 6.3G 0% /run/user/1000
/dev/mapper/totvs-lv_stripe 2.0T 81M 1.9T 1% /totvs |
|
Configuração para mapear e utilizar o volume no boot
Esta configuração é importante para que não seja necessário mapear e montar o novo volume, todas as vezes que a máquina for reiniciada. ETAPA 7 : Iniciando automaticamente o volume criado para o uso dos dados na máquina primária.
Bloco de código |
---|
theme | RDark |
---|
title | Inserindo o comando no arquivo fstab |
---|
|
[root@vmappserver01 ~]# echo '/dev/mapper/totvs-lv_stripe /totvs ext4 defaults,_netdev,nofail 0 2' | tee -a /etc/fstab |
Bloco de código |
---|
theme | RDark |
---|
title | Visualizando o arquivo fstab |
---|
|
[root@vmappserver01 ~]# cat /etc/fstab |
Bloco de código |
---|
language | powershell |
---|
title | Arquivo fstab |
---|
|
#
# /etc/fstab
# Created by anaconda on Tue Jun 15 16:59:24 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/ocivolume-root / xfs defaults 0 0
UUID=6408a2f9-7367-4952-8e0b-4bf42e8e041c /boot xfs defaults 0 0
UUID=C675-9E96 /boot/efi vfat defaults,uid=0,gid=0,umask=077,shortname=winnt 0 2
/dev/mapper/ocivolume-oled /var/oled xfs defaults 0 0
tmpfs /dev/shm tmpfs defaults,nodev,nosuid,noexec 0 0
######################################
## ORACLE CLOUD INFRASTRUCTURE CUSTOMERS
##
## If you are adding an iSCSI remote block volume to this file you MUST
## include the '_netdev' mount option or your instance will become
## unavailable after the next reboot.
## SCSI device names are not stable across reboots; please use the device UUID instead of /dev path.
##
## Example:
## UUID="94c5aade-8bb1-4d55-ad0c-388bb8aa716a" /data1 xfs defaults,noatime,_netdev 0 2
##
## More information:
## https://docs.us-phoenix-1.oraclecloud.com/Content/Block/Tasks/connectingtoavolume.htm
/.swapfile none swap sw,comment=cloudconfig 0 0
/dev/mapper/totvs-lv_stripe /totvs ext4 defaults,_netdev,nofail 0 2 |
...