Converter MBR para GPT sem perder dados.

Hoje irei demonstrar de forma simples como converter uma partição MBR para GPT, antes de qualquer mudança em produção façam testes de homologação e backups por segurança.

1 – Verificando os discos do servidor.

[root@lab11g ~]# fdisk -l | grep "/dev/s"
Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
/dev/sdb1            2048    20971519    10484736   83  Linux
Disk /dev/sda: 107.4 GB, 107374182400 bytes, 209715200 sectors
/dev/sda1   *        2048     2099199     1048576   83  Linux
/dev/sda2         2099200   209715199   103808000   8e  Linux LVM
[root@lab11g ~]# df -Th | grep "^/dev"
/dev/mapper/ol-root xfs        95G   27G   69G  28% /
/dev/sda1           xfs      1014M  217M  798M  22% /boot
/dev/sdb1           xfs        10G   33M   10G   1% /backup
ShellScript

2 – Disco que iremos converter.

[root@lab11g ~]# df -Th | grep "^/dev"
/dev/mapper/ol-root xfs        95G   27G   69G  28% /
/dev/sda1           xfs      1014M  217M  798M  22% /boot
/dev/sdb1           xfs        10G   33M   10G   1% /backup <=======
 
root@lab11g ~]# ls -lat /backup/
total 24
-rw-r--r--   1 root root   64 Oct  1 07:48 file5.txt
-rw-r--r--   1 root root  131 Oct  1 07:48 file4.txt
-rw-r--r--   1 root root   97 Oct  1 07:47 file3.txt
-rw-r--r--   1 root root   78 Oct  1 07:47 file2.txt
drwxr-xr-x   2 root root   91 Oct  1 07:47 .
-rw-r--r--   1 root root    5 Oct  1 07:47 file1.txt
dr-xr-xr-x. 24 root root 4096 Sep 30 07:27 ..
ShellScript

3 – Como todos sabemos, partições do tipo MBR possuem o limite de 2TB, desta forma necessitamos que o nosso disco possa ter expansão acima de 2TB, antes de qualquer mudança façam backups e testes antes de aplicar em produção.

3.1 – Antes de realizar o processo para converter MBR em GPT, devemos validar se existe espaço livre ou redimensionar o disco para que possamos ter espaço livre para esta operação.

[root@lab11g ~]#  umount /backup
[root@lab11g ~]# gdisk /dev/sdb
GPT fdisk (gdisk) version 0.8.6
 
Partition table scan:
  MBR: MBR only     <================== Disk is using MBR.
  BSD: not present
  APM: not present
  GPT: not present
 
 
***************************************************************
Found invalid GPT and valid MBR; converting MBR to GPT format.
THIS OPERATION IS POTENTIALLY DESTRUCTIVE! Exit by typing 'q' if
you don't want to convert your MBR partitions to GPT format!
***************************************************************
 
 
Command (? for help): w  <============ Options used for conversion
 
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!
 
Do you want to proceed? (Y/N): y <========== YES
Options used for conversion
OK; writing new GUID partition table (GPT) to /dev/sdb.
The operation has completed successfully.
ShellScript

3.2 – Montar disco /dev/sdb1.

[root@lab11g ~]# mount /dev/sdb1 /backup/
[root@lab11g ~]# ls -lat /backup/
total 24
-rw-r--r--   1 root root   64 Oct  1 07:48 file5.txt
-rw-r--r--   1 root root  131 Oct  1 07:48 file4.txt
-rw-r--r--   1 root root   97 Oct  1 07:47 file3.txt
-rw-r--r--   1 root root   78 Oct  1 07:47 file2.txt
drwxr-xr-x   2 root root   91 Oct  1 07:47 .
-rw-r--r--   1 root root    5 Oct  1 07:47 file1.txt
dr-xr-xr-x. 24 root root 4096 Sep 30 07:27 ..
ShellScript

3.3 – Confirmando o novo tipo GPT.

[root@lab11g ~]# fdisk -l /dev/sdb
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
 
Disk /dev/sdb: 11.8 GB, 11811160064 bytes, 23068672 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: gpt  <================== New GPT type. =====
Disk identifier: B7B0EB3A-08CA-4E04-AF4E-85EECA62E9B7
 
 
#         Start          End    Size  Type            Name
 1         2048     20971519     10G  Linux filesyste Linux filesystem
ShellScript

Leave a Reply

Your email address will not be published. Required fields are marked *

search previous next tag category expand menu location phone mail time cart zoom edit close