0

Through some series of commands, I managed to end up with a disk that is supposed to contain one ext4 partition, but fdisk, parted, and blkid all insist it contains an Apple RAID slice, which it used to do. I can still mount the ext4 partition using an offset, but I can't get Linux to create a block device for it. How do I redefine the partitions in the GPT?

1 Answer 1

0

Welcome to unix.se!

You know where your ext4 partition starts. Lets say, it is $offset in bytes. Divide by 512 (assuming standard 512 byte sectors). Now you have the partition start as sector. Let's call this $start.
I further assume that your single ext4 partition does not extend into the very last 34 sectors of the disk (this is where the secondary GPT is located).
As long as these assumptions are correct, you can safely overwrite the GPT with proper data.

You can use gdisk and input
o to create a new empty GUID partition table,
n to add a new partition,
1 the first (and only) partition,
$start the previously calculated start (in sectors, 2048 is the default by the way),
(an empty line) for setting the end of the partition to the end of the disk (adjust as needed),
to accept file-system type 0x8300 "Linux",
w to write and exit.

Good luck.

You must log in to answer this question.

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