I need to repartition my 2012 Nexus 7 (grouper) to create a bigger system partition so that I can install Lineage OS.
Here is the current partition table.
Unfortunately parted can't print the partition table because
unrecognized disk label
C:\Android\Nexus7_grouper>adb.exe shell
~ # ./parted /dev/block/mmcblk0
GNU Parted 1.8.8.1.179-aef3
Using /dev/block/mmcblk0
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p
p
Error: /dev/block/mmcblk0: unrecognised disk label
(parted) q
q
~ # ./parted /dev/block/mmcblk0p1
GNU Parted 1.8.8.1.179-aef3
Using /dev/block/mmcblk0p1
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p
p
Error: /dev/block/mmcblk0p1: unrecognised disk label
(parted) q
q
~ # ./parted /dev/block/mmcblk0p2
GNU Parted 1.8.8.1.179-aef3
Using /dev/block/mmcblk0p2
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p
p
Error: /dev/block/mmcblk0p2: unrecognised disk label
(parted) q
q
~ # ./parted /dev/block/mmcblk0p3
GNU Parted 1.8.8.1.179-aef3
Using /dev/block/mmcblk0p3
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p
p
Model: Unknown (unknown)
Disk /dev/block/mmcblk0p3: 682MB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Number Start End Size File system Flags
1 0.00B 682MB 682MB ext4
(parted) q
q
~ # ./parted /dev/block/mmcblk0p4
GNU Parted 1.8.8.1.179-aef3
Using /dev/block/mmcblk0p4
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p
p
Model: Unknown (unknown)
Disk /dev/block/mmcblk0p4: 465MB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Number Start End Size File system Flags
1 0.00B 465MB 465MB ext4
(parted) q
q
~ # ./parted /dev/block/mmcblk0p5
GNU Parted 1.8.8.1.179-aef3
Using /dev/block/mmcblk0p5
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p
p
Error: /dev/block/mmcblk0p5: unrecognised disk label
(parted) q
q
~ # ./parted /dev/block/mmcblk0p6
GNU Parted 1.8.8.1.179-aef3
Using /dev/block/mmcblk0p6
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p
p
Error: /dev/block/mmcblk0p6: unrecognised disk label
(parted) q
q
~ # ./parted /dev/block/mmcblk0p7
GNU Parted 1.8.8.1.179-aef3
Using /dev/block/mmcblk0p7
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p
p
Model: Unknown (unknown)
Disk /dev/block/mmcblk0p7: 5243kB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
(parted) q
q
~ # ./parted /dev/block/mmcblk0p8
GNU Parted 1.8.8.1.179-aef3
Using /dev/block/mmcblk0p8
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p
p
Error: /dev/block/mmcblk0p8: unrecognised disk label
(parted) q
q
~ # ./parted /dev/block/mmcblk0p9
GNU Parted 1.8.8.1.179-aef3
Using /dev/block/mmcblk0p9
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p
p
Model: Unknown (unknown)
Disk /dev/block/mmcblk0p9: 30.1GB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Number Start End Size File system Flags
1 0.00B 30.1GB 30.1GB ext4
(parted) q
q
~ #
No success with fdisk either:
~ # /sbin/fdisk /dev/block/mmcblk0
Device contains neither a valid DOS partition table, nor Sun, SGI, OSF or GPT disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that the previous content
won't be recoverable.
The number of cylinders for this disk is set to 954368.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
- software that runs at boot time (e.g., old versions of LILO)
- booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): p
Disk /dev/block/mmcblk0: 31.2 GB, 31272730624 bytes
4 heads, 16 sectors/track, 954368 cylinders
Units = cylinders of 64 * 512 = 32768 bytes
Device Boot Start End Blocks Id System
Command (m for help):
So: what can I do?! Is this a known problem? Is there a solution? Or is there a workaround?
Update
Found some more disc tools: https://github.com/wangdaning/Static-Disk-Tools
~ # ./fdisk /dev/block/mmcblk0
Welcome to fdisk (util-linux 2.22).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
WARNING: GPT (GUID Partition Table) detected on '/dev/block/mmcblk0'! The util fdisk doesn't support GPT. Use GNU Parted.
Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0xa27bac20.
Command (m for help): q
~ # ./gdisk /dev/block/mmcblk0
GPT fdisk (gdisk) version 0.8.4
Unsupported GPT version in backup header; read 0x00000000, should be
0x00010000
Partition table scan:
MBR: not present
BSD: not present
APM: not present
GPT: not present
Creating new GPT entries.
Command (? for help): q
~ # ./sfdisk /dev/block/mmcblk0
Checking that no-one is using this disk right now ...
BLKRRPART: Device or resource busy
sfdisk:
This disk is currently in use - repartitioning is probably a bad idea.
Umount all file systems, and swapoff all swap partitions on this disk.
Use the --no-reread flag to suppress this check.
sfdisk: Use the --force flag to overrule all checks.
~ # ./sfdisk -l /dev/block/mmcblk0
WARNING: GPT (GUID Partition Table) detected on '/dev/block/mmcblk0'! The util sfdisk doesn't support GPT. Use GNU Parted.
Disk /dev/block/mmcblk0: 954368 cylinders, 4 heads, 16 sectors/track
~ # ./gdisk -l /dev/block/mmcblk0
GPT fdisk (gdisk) version 0.8.4
Unsupported GPT version in backup header; read 0x00000000, should be
0x00010000
Partition table scan:
MBR: not present
BSD: not present
APM: not present
GPT: not present
Creating new GPT entries.
Disk /dev/block/mmcblk0: 61079552 sectors, 29.1 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 5DF0FD01-EBB2-48B7-A362-76A6CD811B21
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 61079518
Partitions will be aligned on 2048-sector boundaries
Total free space is 61079485 sectors (29.1 GiB)
Number Start (sector) End (sector) Size Code Name
~ #
And this seems relevant, but I don't understand it. https://github.com/Lanchon/REPIT/issues/79
Update: newer parted
From Irfan Latif's suggestion
~ # ./parted
GNU Parted 3.3
Using /dev/block/mmcblk0
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p
Error: /dev/block/mmcblk0: unrecognised disk label
Model: MMC HBG4e (sd/mmc)
Disk /dev/block/mmcblk0: 31.3GB
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags:
(parted) q
~ # ./partprobe -s
Error: Partition(s) 4, 9 on /dev/block/mmcblk0 have been written, but we have been unable to inform the kernel of the change, probably because it/they are in use. As a result, the old partition(s) will remain in use. You should reboot now before making further changes.
/dev/block/mmcblk0boot1: msdos partitions
/dev/block/mmcblk0boot0: msdos partitions
~ #


partedbinary: https://forum.xda-developers.com/showpost.php?p=82737939&postcount=233 orgdisk: https://forum.xda-developers.com/android/help/how-to-boot-sd-card-qmobile-z8-bricked-t3712171 – Irfan Latif Jun 26 '20 at 09:27