You are not logged in.
Pages: 1
When I try to partition the SD card and format the 2nd partition to ext4 an I/O occurs.
All the other formats just work just the ext ones cause the problem.
But when I make just and make a single partition it works just fine. I need the ext4 partition for my raspberry pi.
when i run the gdisk utility it shows that the backup GPT is corrupted but the primary is intact so it till use that.
Last edited by dezire (2021-06-15 16:50:27)
Offline
Include the error. Also, what is the full list of commands you are running with gdisk?
When I am formatting any sort of drive from scratch, I will usually write zeros to the whole thing first, e.g.:
sudo dd if=/dev/zero of=/dev/sdX bs=4M oflag=sync conv=fdatasync status=progressI know, overkill, but it has worked for me. If it is a massive drive, then I usually let it run for a few minutes, zeroing out the first few GBs. That is usually enough.
Then use gdisk to create a brand new GPT, and then quit and save from gdisk. Then go back into gdisk and create your partitions. Quit and save.
Now, this may be where your error is cropping in. The wiki mentions this somewhere, but the system sometimes caches the partition layout of a drive. So, after re-partitioning and exiting gdisk, eject the drive and re-insert it before attempting to mkfs.fat -F32 and mkfs.ext4 on your two partitions
Just to be safe, I usually eject and re-insert after that step, too.
Does raspberry pi support efi boot now? May be why your GPT is corrupted, I didn't think it supports that. If it is still "legacy boot" it (probably) won't recognize a GPT.
Offline
This is what I do and this is what is happening after doing everything you said.
And this I/O error while formatting occures in MBR too.
sudo gdisk /dev/sdb
GPT fdisk (gdisk) version 1.0.7
Caution: invalid backup GPT header, but valid main header; regenerating
backup header from main header.
Warning! One or more CRCs don't match. You should repair the disk!
Main header: OK
Backup header: ERROR
Main partition table: OK
Backup partition table: OK
Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: damaged
****************************************************************************
Caution: Found protective or hybrid MBR and corrupt GPT. Using GPT, but disk
verification and recovery are STRONGLY recommended.
****************************************************************************
Command (? for help): n
Partition number (1-128, default 1):
First sector (34-125542366, default = 2048) or {+-}size{KMGTP}:
Last sector (2048-125542366, default = 125542366) or {+-}size{KMGTP}: +200M
Current type is 8300 (Linux filesystem)
Hex code or GUID (L to show codes, Enter = 8300): 0700
Changed type of partition to 'Microsoft basic data'
Command (? for help): n
Partition number (2-128, default 2):
First sector (34-125542366, default = 411648) or {+-}size{KMGTP}:
Last sector (411648-125542366, default = 125542366) or {+-}size{KMGTP}:
Current type is 8300 (Linux filesystem)
Hex code or GUID (L to show codes, Enter = 8300):
Changed type of partition to 'Linux filesystem'
Command (? for help): w
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!
Do you want to proceed? (Y/N): y
OK; writing new GUID partition table (GPT) to /dev/sdb.
The operation has completed successfully.
~ took 31s
❯ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 931.5G 0 disk
├─sda1 8:1 0 149.2G 0 part
├─sda2 8:2 0 482.3G 0 part
└─sda3 8:3 0 300G 0 part
sdb 8:16 1 59.9G 0 disk
├─sdb1 8:17 1 200M 0 part
└─sdb2 8:18 1 59.7G 0 part
zram0 254:0 0 2G 0 disk
nvme0n1 259:0 0 465.8G 0 disk
├─nvme0n1p1 259:1 0 500M 0 part /boot
├─nvme0n1p2 259:2 0 80G 0 part /run/timeshift/backup
├─nvme0n1p3 259:3 0 16M 0 part
└─nvme0n1p4 259:4 0 200G 0 part
~
❯ sudo mkfs.ext4 /dev/sdb2
mke2fs 1.46.2 (28-Feb-2021)
Creating filesystem with 15641339 4k blocks and 3915776 inodes
Filesystem UUID: 09c2c932-cf82-48a4-b4be-c81138066259
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424
Allocating group tables: done
Writing inode tables: done
Creating journal (65536 blocks): done
Writing superblocks and filesystem accounting information: mkfs.ext4: Input/output error while writing out and closing file systemLast edited by dezire (2021-06-01 07:50:40)
Offline
Hey, I apologize for the late reply. Yeah, with the broken backup header, after zeroing the (entire) drive with dd, use the menu option "o" in gdisk to create a new guid partition table, then save and quit. Eject and re-insert, and when you pull up the drive in gdisk, it shouldn't complain about anything.
Alternatively, you can use option "z" in the "experts menu" (i.e. first select "x", then "z") and that should clear out your broken gpt structures. Then go back in and use option "o" from the regular menu, to create a new structure. Once your empty GUID Partition Table is created (after a save, quit, and re-enter gdisk) you can use "n" to create your (two) partitions. Use option "p" to verify what you want will happen before saving ang quitting.
Then call mkfs on each partition.
Offline
Pages: 1