0

we've added a new disk to VMware fusion VM. Below fdisk -l output:

Disk /dev/loop1: 91.4 MiB, 95805440 bytes, 187120 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 /dev/loop2: 93.8 MiB, 98336768 bytes, 192064 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


GPT PMBR size mismatch (41943039 != 104857599) will be corrected by w(rite).
Disk /dev/sda: 50 GiB, 53687091200 bytes, 104857600 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
Disklabel type: gpt
Disk identifier: FE4C7C3C-6CA1-4416-B62E-5E6A50867C2A

Device     Start      End  Sectors Size Type
/dev/sda1   2048     4095     2048   1M BIOS boot
/dev/sda2   4096 41940991 41936896  20G Linux filesystem


biot@biot:~$ sudo parted -l
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sda: 53.7GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system  Name  Flags
 1      1049kB  2097kB  1049kB                     bios_grub
 2      2097kB  21.5GB  21.5GB  ext4


Warning: Unable to open /dev/sr0 read-write (Read-only file system).  /dev/sr0
has been opened read-only.
Model: NECVMWar VMware SATA CD01 (scsi)                                   
Disk /dev/sr0: 875MB
Sector size (logical/physical): 2048B/2048B
Partition Table: mac
Disk Flags: 

Number  Start  End    Size    File system  Name   Flags
 1      2048B  6143B  4096B                Apple
 2      659MB  662MB  2523kB               EFI


biot@biot:~$ 


biot@biot:~$ sudo parted /dev/sda unit s print
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sda: 104857600s
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start  End        Size       File system  Name  Flags
 1      2048s  4095s      2048s                         bios_grub
 2      4096s  41940991s  41936896s  ext4

biot@biot:~$ sudo gdisk -l /dev/sda
GPT fdisk (gdisk) version 1.0.3

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.
Disk /dev/sda: 104857600 sectors, 50.0 GiB
Model: VMware Virtual S
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): FE4C7C3C-6CA1-4416-B62E-5E6A50867C2A
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 104857566
Partitions will be aligned on 2048-sector boundaries
Total free space is 62918589 sectors (30.0 GiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048            4095   1024.0 KiB  EF02  
   2            4096        41940991   20.0 GiB    8300  

How we could resolve the issue without lost existing data? Thanks in advance BR

3 Answers 3

1

Run fdisk on it and use w to save the existing partition table without any changes.

All GPT disks have a "protective MBR" which contains a dummy partition covering the entire disk (or as much of the disk as possible). If you grow the disk, this partition will still indicate the old disk size until fdisk adjusts it.

This has no effect on data stored on the disk; it is there only to guard against old MBR-only disk partitioning tools.

1
  • We've done and the issue disappear. The mount point /dev/sda is 20G as before. How we could expand it? Thanks in advance
    – brunillopu
    Apr 2, 2020 at 5:38
0

We've done. But the /dev/sda2 mount point is 20G (as before) and not 50G. What we can do?

biot@biot:~$ sudo fdisk /dev/sda

Welcome to fdisk (util-linux 2.31.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

GPT PMBR size mismatch (41943039 != 104857599) will be corrected by w(rite).
GPT PMBR size mismatch (41943039 != 104857599) will be corrected by w(rite).

Command (m for help): w
GPT PMBR size mismatch (41943039 != 104857599) will be corrected by w(rite).

The partition table has been altered.
Syncing disks.

biot@biot:~$ sudo fdisk -l
Disk /dev/loop0: 93.8 MiB, 98336768 bytes, 192064 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 /dev/loop1: 91.4 MiB, 95805440 bytes, 187120 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 /dev/sda: 50 GiB, 53687091200 bytes, 104857600 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
Disklabel type: gpt
Disk identifier: FE4C7C3C-6CA1-4416-B62E-5E6A50867C2A

Device     Start      End  Sectors Size Type
/dev/sda1   2048     4095     2048   1M BIOS boot
/dev/sda2   4096 41940991 41936896  20G Linux filesystem
biot@biot:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            955M     0  955M   0% /dev
tmpfs           198M  1.4M  196M   1% /run
/dev/sda2        20G   11G  8.0G  58% /
tmpfs           986M     0  986M   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           986M     0  986M   0% /sys/fs/cgroup
/dev/loop0       94M   94M     0 100% /snap/core/8935
/dev/loop1       92M   92M     0 100% /snap/core/8689
tmpfs           198M     0  198M   0% /run/user/1000
0

You need to recreate the sda2 partition via fdisk. So first delete it then recreate it, so it will cover whole free space that you added via VMWare. Remember that you can't change start sector else you will loose your data (fdisk should cover start and end sectors by default). Then of course you need to resize the fs.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .