You are not logged in.

#1 2020-12-30 11:11:49

BitterCelt
Member
Registered: 2017-02-08
Posts: 23

Recovering an accidentally relabelled drive

Hi all,

I did a big silly. I was trying to set up a USB FreeDos environment to update my laptop's BIOS, and the first instruction I found was to relabel it as msdos using parted

sudo parted /dev/sdc mklabel msdos

But i accidentally wrote sdb, relabeling my harddrive (and yes I absentmindedly went through the warnings thinking it was because the usb was mounted)

Is there any way to undo that process and get all my hard drive data back?

Offline

#2 2020-12-30 11:16:26

progandy
Member
Registered: 2012-05-17
Posts: 5,321

Re: Recovering an accidentally relabelled drive

Was this a GPT or MBR disk before that mklabel?


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |

Offline

#3 2020-12-30 11:17:20

BitterCelt
Member
Registered: 2017-02-08
Posts: 23

Re: Recovering an accidentally relabelled drive

I'm fairly certain it was GPT

Offline

#4 2020-12-30 11:40:26

progandy
Member
Registered: 2012-05-17
Posts: 5,321

Re: Recovering an accidentally relabelled drive

I though maybe the backup GPT might be still there, but In my quick tests (with gdisk recovery options and testdisk) that doesn't seem the case.

Did you do a parted "print" and still have the output somewhere?

Last edited by progandy (2020-12-30 11:45:32)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |

Offline

#5 2020-12-30 11:41:16

BitterCelt
Member
Registered: 2017-02-08
Posts: 23

Re: Recovering an accidentally relabelled drive

I did not I'm afraid

Offline

#6 2020-12-30 11:45:36

progandy
Member
Registered: 2012-05-17
Posts: 5,321

Re: Recovering an accidentally relabelled drive

If the partitions are still present in the running system, you should be able to read

/sys/block/sda/sdb1/start
/sys/block/sdb/sdb1/size
/sys/block/sdb/sdb2/start
/sys/block/sdb/sdb2/size
...

DO NOT REBOOT. Note everything down (on paper and maybe on the USB if it is still plugged in) and read this:

https://superuser.com/questions/217248/ … 392#217392
http://realtechtalk.com/Linux_How_To_Re … 2-articles

You should be able to use parted instead of fdisk, use "unit s" to switch to sector mode and create a gpt partition table if you want to use that.

And also note the filesystem types from e.g. lsblk so you can enter them again.

lsblk -o +PARTTYPE,PARTTYPENAME,PTTYPE,PARTUUID,PARTLABEL

Last edited by progandy (2020-12-30 12:34:01)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |

Offline

#7 2020-12-30 12:46:16

BitterCelt
Member
Registered: 2017-02-08
Posts: 23

Re: Recovering an accidentally relabelled drive

Unfortunately ended up rebooting before I realised the mistake. Is there anything I can do from the install media, or am I scuppered?

I'm fine with having to reinstall, it's just inconvenient

Offline

#8 2020-12-30 12:58:32

Bevan
Member
Registered: 2009-09-08
Posts: 104

Re: Recovering an accidentally relabelled drive

You can give TestDisk a try. It may be able to locate the partitions and recreate the partition table. It is included on LiveCDs such as grml or the GParted LiveCD. You maybe also can install it via pacman after booting the Arch installation CD.

Last edited by Bevan (2020-12-30 13:00:03)

Offline

#9 2020-12-30 13:12:53

BitterCelt
Member
Registered: 2017-02-08
Posts: 23

Re: Recovering an accidentally relabelled drive

I'll give it a go. If it doesn't work then I'll probably go for a full reinstall.

Want to set up a dual boot with windows anyway because some games that I wanna play arent playing nice and I think it's a driver issue

Offline

Board footer

Powered by FluxBB