LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 01-18-2018, 01:02 PM   #1
tonj
Member
 
Registered: Sep 2008
Posts: 546

Rep: Reputation: 37
read a macbook drive in fedora


I have a macbook ssd taken from a damaged macbook laptop which is connected to a usb adaptor and i need to read the ssd in fedora 26.
/ls /dev/sd* shows the drive as /dev/sdb.
I tried to mount the drive with:
mount -t hfsplus /dev/sdb /mnt
but got error:
mount: /mnt: wrong fs type, bad option, bad superblock on /dev/sdb, missing codepage or helper program, or other error.
is there a way to read the contents of this drive in fedora 26?
 
Old 01-18-2018, 01:48 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,638

Rep: Reputation: 7966Reputation: 7966Reputation: 7966Reputation: 7966Reputation: 7966Reputation: 7966Reputation: 7966Reputation: 7966Reputation: 7966Reputation: 7966Reputation: 7966
Quote:
Originally Posted by tonj View Post
I have a macbook ssd taken from a damaged macbook laptop which is connected to a usb adaptor and i need to read the ssd in fedora 26.
/ls /dev/sd* shows the drive as /dev/sdb.
I tried to mount the drive with:
mount -t hfsplus /dev/sdb /mnt
but got error:
mount: /mnt: wrong fs type, bad option, bad superblock on /dev/sdb, missing codepage or helper program, or other error.
is there a way to read the contents of this drive in fedora 26?
You say it's a damaged Macbook, and the drive is giving you mount errors. Since you obviously have the hfs tools loaded, chances are the drive is damaged/dead
 
Old 01-18-2018, 02:44 PM   #3
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,987

Rep: Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628
Adapters sometimes are goofy.
Doubt you'd mount the drive at /dev/sdb

Think the journaling has to be turned off too.

This is the general ways. Read most of the page. https://askubuntu.com/questions/3323...t-access-to-os

Last edited by jefro; 01-18-2018 at 02:46 PM.
 
Old 01-18-2018, 02:51 PM   #4
Brains
Senior Member
 
Registered: Apr 2009
Distribution: All OS except Apple
Posts: 1,591

Rep: Reputation: 389Reputation: 389Reputation: 389Reputation: 389
Quote:
Originally Posted by tonj View Post
I have a macbook ssd taken from a damaged macbook laptop which is connected to a usb adaptor and i need to read the ssd in fedora 26.
/ls /dev/sd* shows the drive as /dev/sdb.
I tried to mount the drive with:
mount -t hfsplus /dev/sdb /mnt
Typically you don't mount drives, you mount the partitions in the drive. Below are my old notes. They are for a drive image but you should be able to figure it out.
Code:
STEPS FOR MOUNTING PARTITION OF IMAGE.DD FILE FROM IN SAME DIRECTORY AS ROOT OR SUDO:

1: mkdir /mnt/image
2: sfdisk -l -uS image.dd
3: mount -oloop,offset=32256 image.dd /mnt/image

OFFSET = Sectors offset of beginning sector of partition multiplied by 512, in this case the first partition starts at offset 63.

To mount hfs or hfsplus, modprobe them first before mounting. Have hfsplus, 
hfsutils, hfsutils-tcltk installled

Last edited by Brains; 01-18-2018 at 02:52 PM.
 
1 members found this post helpful.
Old 01-19-2018, 09:38 AM   #5
tonj
Member
 
Registered: Sep 2008
Posts: 546

Original Poster
Rep: Reputation: 37
@brains thankyou for your feedback however I'm unable to figure it out. I think I'm supposed to create a backup of the macbook drive to a file called imange.dd but I don't know how to do this. What software does one use? My only experience of disk backups is clonezilla and acronis. Thanks for any further advice.
 
Old 01-19-2018, 09:44 AM   #6
tonj
Member
 
Registered: Sep 2008
Posts: 546

Original Poster
Rep: Reputation: 37
@jefro thanks however the data at the link you gave refers to sdXY but I only have sdX. Plus there's no hfsprogs avalable for fedora 26.
 
Old 01-19-2018, 10:45 AM   #7
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,638

Rep: Reputation: 7966Reputation: 7966Reputation: 7966Reputation: 7966Reputation: 7966Reputation: 7966Reputation: 7966Reputation: 7966Reputation: 7966Reputation: 7966Reputation: 7966
Quote:
Originally Posted by tonj View Post
@jefro thanks however the data at the link you gave refers to sdXY but I only have sdX. Plus there's no hfsprogs avalable for fedora 26.
And you're very welcome for the advice I gave too, tonj. In your first post, you indicated that you DO have the HFS utilities loaded, when you tried to mount it using the hfs filesystem type.

If you looked in the Fedora repos, you'd find the hfsutils package: https://admin.fedoraproject.org/pkgd...rpms/hfsutils/ Install it THEN try to mount it, because until you do, you don't have what you need to mount it. And AGAIN I'll say that if the laptop was damaged to start with (and you're not even seeing any partitions), then chances are the DRIVE IS ALSO DAMAGED and you can't mount it anyway.

And since the backup your supposed to create has a .dd extension, that probably means you should use the "dd" utility.

Last edited by TB0ne; 01-19-2018 at 10:46 AM.
 
Old 01-19-2018, 10:57 AM   #8
jsbjsb001
Senior Member
 
Registered: Mar 2009
Location: Earth, unfortunately...
Distribution: Currently: OpenMandriva. Previously: openSUSE, PCLinuxOS, CentOS, among others over the years.
Posts: 3,881

Rep: Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063
Assuming the drive isn't damaged, you should have a look at this. As, in that case it's core storage, that is most likely the issue here.
 
Old 01-19-2018, 12:57 PM   #9
Brains
Senior Member
 
Registered: Apr 2009
Distribution: All OS except Apple
Posts: 1,591

Rep: Reputation: 389Reputation: 389Reputation: 389Reputation: 389
Quote:
Originally Posted by tonj View Post
@brains thankyou for your feedback however I'm unable to figure it out. I think I'm supposed to create a backup of the macbook drive to a file called imange.dd but I don't know how to do this. What software does one use? My only experience of disk backups is clonezilla and acronis. Thanks for any further advice.
The mount command you posted shows you tried to mount /dev/sdb
This is the entire drive, you cannot mount that way, it has to be a partition in the drive which would be: /dev/sdb1 for the first parition, /dev/sdb2 would be the second partition, there needs to be a number after the letter b.

If the output of command: fdisk -l only shows the drive (/dev/sdb) and no partitions (/dev/sdb1), means there may be some mbr damage, the mbr (Master boot record) contains the partition information, this does not mean it is toast, you can still attempt to mount the partition if you can find the first sector of any partition in the drive, most often the first sector of the first partition was at sector 63.

In the past when I worked on hfs or hfsplus drives, I had to load the appropriate kernel modules, because I was using linux, hfs driver/modules are not loaded by default when you boot up the linux machine, hence the "modprobe them first" in my notes. This could be different today, you need to check if these drivers are being loaded when the drive is plugged in, if not you have to load them manually to access the hfs/hfsplus file systems from linux.
Code:
mkdir /mnt/image
sfdisk -l -uS /dev/sdb
mount -oloop,offset=32256 /dev/sdb /mnt/image
mount -t hfsplus -oloop,offset=32256 /dev/sdb /mnt/image
I modified my notes in the code box above to reflect your drive, these commands may need to be done as root or sudo. The first command makes a directory to mount the drive called image, the second command will show exact first and last sectors of all partitions. The third command mounts the first partition if it is at sector 63, how I derived the offset is explained in my first post. If command number 2 does not return absolute results, means the mbr is corrupt, but the partitions are likely still intact, so I would attempt mounting using the third or forth command anyway as typically this would be where the first sector is for mbr data drives. The forth command specifies the file system type, I don't think this is required if hfsplus module/driver is loaded to the kernel, but if command 3 don't work, it's worth a try.

If command 2 or command fdisk -l does not show partition information, you can install a small utility called sleuthkit and then run the mmls command that has been very successful for me in pulling out that information. Example: mmls -t mac /dev/sdb
Sleuthkit was designed with forensics in mind and has lots of wonderful utilities for digging out what you're after even if you tried to hide information from the law.

In short:
Make sure hfs/hfsplus drivers loaded onto kernel
Mount partitions, not drives
Make an image of the entire drive and do all this stuff on the image, that is the forensically safe method to avoid data loose. That is why my notes refer to image of a drive.
 
Old 01-19-2018, 04:25 PM   #10
Brains
Senior Member
 
Registered: Apr 2009
Distribution: All OS except Apple
Posts: 1,591

Rep: Reputation: 389Reputation: 389Reputation: 389Reputation: 389
If everything is good with the drive, hfs and hfsplus utilities installed, drive plugged in before bootup, it should be spotted and appropriate modules will load, possibly auto mounted by the time FC is finished booting. Mac drive should be efi, not mbr.

Last edited by Brains; 01-19-2018 at 04:26 PM.
 
Old 01-20-2018, 05:04 AM   #11
tonj
Member
 
Registered: Sep 2008
Posts: 546

Original Poster
Rep: Reputation: 37
I think the drive is damaged.
# ls /dev/sd* gives
/dev/sda /dev/sda1 /dev/sda2 /dev/sdb

/dev/sdb is the macbook drive.

fdisk -l only gives info about /dev/sda - the main (internal) hard drive. It doesn't mention /dev/sdb at all.

sfdisk -l -uS /dev/sdb gives
sfdisk: cannot open /dev/sdb: No such file or directory

and yet ls/dev/sd* shows it.
I've rebooted the machine with the macbook drive connected.

update: I've also tried running testdisk and that doesn't even list the drive.

Last edited by tonj; 01-20-2018 at 05:08 AM.
 
Old 01-20-2018, 08:42 AM   #12
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,638

Rep: Reputation: 7966Reputation: 7966Reputation: 7966Reputation: 7966Reputation: 7966Reputation: 7966Reputation: 7966Reputation: 7966Reputation: 7966Reputation: 7966Reputation: 7966
Quote:
Originally Posted by tonj View Post
I think the drive is damaged.
# ls /dev/sd* gives
/dev/sda /dev/sda1 /dev/sda2 /dev/sdb

/dev/sdb is the macbook drive.

fdisk -l only gives info about /dev/sda - the main (internal) hard drive. It doesn't mention /dev/sdb at all.

sfdisk -l -uS /dev/sdb gives
sfdisk: cannot open /dev/sdb: No such file or directory

and yet ls/dev/sd* shows it.
I've rebooted the machine with the macbook drive connected. update: I've also tried running testdisk and that doesn't even list the drive.
...which is exactly what you were told in my first reply, wasn't it? And you're very welcome again for pointing you to toe hfs utilities for F26, too.
 
Old 01-20-2018, 10:43 AM   #13
tonj
Member
 
Registered: Sep 2008
Posts: 546

Original Poster
Rep: Reputation: 37
@TB0ne thankyou for your feedback on this thread.
 
Old 01-20-2018, 01:40 PM   #14
Brains
Senior Member
 
Registered: Apr 2009
Distribution: All OS except Apple
Posts: 1,591

Rep: Reputation: 389Reputation: 389Reputation: 389Reputation: 389
REMEMBER
Just because the linux utilities cannot read the partition information, does not mean the partitions don't exit. It is simply a matter of finding the first sector of the partitions that were there. If you really want to access this drive, it is still possible.
You can always hit some Mac forums and ask someone to post the default drive layout for the exact same make and model of Macbook, then use the mount with offset example I posted, make sure to do the proper calculations. This unit can't be that old because the drive is an ssd, someone out there is running it right now. I have found partitions the hard way, by going sector by sector. I typically don't give up if time is irrelevant.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] mount usb drive read-only fedora 16 Mes9 Fedora 10 08-15-2012 05:06 PM
fedora 12 deos not read CDs from DVD drive novroopaa01 Linux - Software 2 05-06-2010 01:41 PM
Fedora will only mount my USB drive as read-only santiagosilva Linux - Hardware 6 02-17-2010 03:51 PM
Thumb drive is getting read only Fedora core 5. Why?? vmsathar Linux - Software 2 07-19-2006 02:53 AM
Can't read cd drive after Fedora 4 Install wmeades Linux - Hardware 1 02-22-2006 11:25 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 10:02 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration