Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Recover HFS (mac) partitions
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
falko
Apprentice
Apprentice


Joined: 03 Dec 2004
Posts: 242
Location: Rovereto (TN) Italy

PostPosted: Thu Jan 28, 2021 9:08 pm    Post subject: Recover HFS (mac) partitions Reply with quote

Hi,
I have to try to recover a disk where the partitions are lost or damage (without any delete or other operations).
The disk had no physical damage.

I found
Code:
app-admin/testdisk
sys-fs/hfsutils
sys-fs/hfsplusutils


The disc isn't mine, so before I do anything I'd like to be sure, I don't want to lose data!.
Which is the best tool that I could use to restore the partitions.

Thanks in advance
_________________
Io non sarò mai nessuno ma... nessuno sarà mai come me. (Jim Morrison)

A ciacere no se sgonfa done

Gentoo on: Lenovo R500
Back to top
View user's profile Send private message
Buffoon
Veteran
Veteran


Joined: 17 Jun 2015
Posts: 1369
Location: EU or US

PostPosted: Thu Jan 28, 2021 9:33 pm    Post subject: Reply with quote

You do not want to lose data. Then take a full image of disk before you do anything else, yes you need a larger disk for that. You can work on that image instead of real disk. However, you talk about restoring partitions and then mention HFS tools ... HFS is filesystem, not partition ... There is some basic knowledge required. You sure you know what you are doing?
Back to top
View user's profile Send private message
falko
Apprentice
Apprentice


Joined: 03 Dec 2004
Posts: 242
Location: Rovereto (TN) Italy

PostPosted: Thu Jan 28, 2021 9:47 pm    Post subject: Reply with quote

Buffoon wrote:
You do not want to lose data. Then take a full image of disk before you do anything else, yes you need a larger disk for that. You can work on that image instead of real disk. However, you talk about restoring partitions and then mention HFS tools ... HFS is filesystem, not partition ... There is some basic knowledge required. You sure you know what you are doing?


Ok.. thanks for your reply I use a wrong word. :?

When I use fdisk, it doesn't find the partitions.
When I analize with testdisk it found two hfs
When I analize with hfsutils it ask me if i would fix it
_________________
Io non sarò mai nessuno ma... nessuno sarà mai come me. (Jim Morrison)

A ciacere no se sgonfa done

Gentoo on: Lenovo R500
Back to top
View user's profile Send private message
Buffoon
Veteran
Veteran


Joined: 17 Jun 2015
Posts: 1369
Location: EU or US

PostPosted: Thu Jan 28, 2021 9:58 pm    Post subject: Reply with quote

If the partition table was destroyed then gdisk or some other partitioning tool may be able to restore it using backup, the partition table macOS is using is GPT and older versions of fdisk cannot handle it. If there are no valid backups of GPT then testdisk can make very intelligent guesses about it. I doubt hfsutils can restore lost partition table. But then again, was the partition table lost or the damage was done only to the filesystem? You need to know what is broken before you start fixing it ...
Back to top
View user's profile Send private message
falko
Apprentice
Apprentice


Joined: 03 Dec 2004
Posts: 242
Location: Rovereto (TN) Italy

PostPosted: Thu Jan 28, 2021 10:15 pm    Post subject: Reply with quote

Ok thanks,
I underestand. I found the disk with no partitions, I guess the problem is the partition table.
I could try with gdisk?
_________________
Io non sarò mai nessuno ma... nessuno sarà mai come me. (Jim Morrison)

A ciacere no se sgonfa done

Gentoo on: Lenovo R500
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54317
Location: 56N 3W

PostPosted: Thu Jan 28, 2021 10:56 pm    Post subject: Reply with quote

falko,

First of all, make a disk image with ddrescue. The image can be in a file.
Never work with your only copy.

Testdisk will have given you a partition table that it would write, if you let it. Do not do that. It can make a bad situation worse.
Never write to the only copy.
Make a note of the start of all the partitions that testdisk finds. There are often a number of false positives.

The partion table is not required to mount the filesystems in the partitions that it used to contain. Its just a set of pointers.
Read man mount, you need to use
Code:
-o ro,offset=<bytes> /dev/sd<whole_drive>
where offset= the the count of the number of bytes to the partition start.
You get to calculate offset= from the start sector that testdisk gave you.

You can do all this with your disk image in a file, as a file can be treated as a block device with loopback support in the kernel.

Practice on a USB stick, where you can use fdisk to see the partition table, in sectors. You cannot afford off by 1 errors, so you need to know your method is correct before you start.

Oh, before you do anything else, make a backup, or two if you are paranoid.

Once you are sure that the filesystems are OK you can recreate the partition table.

If the filesystem is journaled, even a ro mount can trigger a journal replay. If the filesysem is damaged, a journal replay can make a bad situation worse.
You will need a backup to be able to test that, or recover from it, when the journal replay trashes what's left of the filesystem.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
falko
Apprentice
Apprentice


Joined: 03 Dec 2004
Posts: 242
Location: Rovereto (TN) Italy

PostPosted: Fri Jan 29, 2021 7:32 am    Post subject: Reply with quote

NeddySeagoon wrote:

The partion table is not required to mount the filesystems in the partitions that it used to contain. Its just a set of pointers.
Read man mount, you need to use
Code:
-o ro,offset=<bytes> /dev/sd<whole_drive>
where offset= the the count of the number of bytes to the partition start.
You get to calculate offset= from the start sector that testdisk gave you.

Thanks, I didn't know that!

NeddySeagoon wrote:

If the filesystem is journaled, even a ro mount can trigger a journal replay. If the filesysem is damaged, a journal replay can make a bad situation worse.
You will need a backup to be able to test that, or recover from it, when the journal replay trashes what's left of the filesystem.

This is very interesting, I never would have thought that
_________________
Io non sarò mai nessuno ma... nessuno sarà mai come me. (Jim Morrison)

A ciacere no se sgonfa done

Gentoo on: Lenovo R500
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum