Skip to main content
Put the FS type in the title, even though it's surprising for a disk used with MacOS to have an NTFS partition, not HFS+
Link
Peter Cordes
  • 6.7k
  • 24
  • 42

How to recover “deleted” files in Linux, that originate on an NTFS filesystem (files originally from a macOS hard drive)

Recover "deleted" How to recover “deleted” files in linuxLinux, that originate from MACa macOS hard drive

I'm having a bit of a crisis here.

My girlfriend has a external hard disk with 10 years+ of photos, documents and more. A lot of these files originate from her old iPhone 5 and her macbookMacBook. The hard disk itself is NTFS Format. Since the disk is so old, it turns into a hazard of data loss (what an irony).

As we tried to upload all the files into onedriveOneDrive to store them safely, we got 1000s1,000s of errors because of invalid file names. I realized that many files started with ._, e.g. ./pic/92 win new/iphone/._IMG_1604.JPG. I don't understand macOS and why files should be named like that, but for sure you can never get them into onedriveOneDrive like that. 

So I decided to hook it to my raspberry piRaspberry Pi and rename all files with the wrong characters from the command line. After listing the nearly 10.,000 files, I ran the following over the whole hard disk.

find . -name "._*" | sed -e "p;s/\._//" | xargs -d '\n' -n2 mv 

Furthermore, I removed some leading whitespace in filenames with zmv.

I tried the command in a test environment first and it looked fine. But I didn't check the file size....

After my gfgirlfriend connected the hard disk back onto her Mac, all "renamed"renamed files show a file size of 4KB (empty)! I screwed it up and I don't know how...

I assume the data is still there, but I somehow screwed the filesystem.

Does anybody understand what I did wrong? More importantly, do you see a chance to recover the files? I would appreciate any advice.

Lukas

Recover "deleted" files in linux, originate from MAC

I'm having a bit of a crisis here.

My girlfriend has a external hard disk with 10 years+ of photos, documents and more. A lot of these files originate from her old iPhone 5 and her macbook. The hard disk itself is NTFS Format. Since the disk is so old, it turns into a hazard of data loss (what an irony).

As we tried to upload all the files into onedrive to store them safely, we got 1000s of errors because of invalid file names. I realized that many files started with ._, e.g. ./pic/92 win new/iphone/._IMG_1604.JPG. I don't understand macOS and why files should be named like that, but for sure you can never get them into onedrive like that. So I decided to hook it to my raspberry pi and rename all files with the wrong characters from the command line. After listing the nearly 10.000 files, I ran the following over the whole hard disk.

find . -name "._*" | sed -e "p;s/\._//" | xargs -d '\n' -n2 mv 

Furthermore, I removed some leading whitespace in filenames with zmv.

I tried the command in a test environment first and it looked fine. But I didn't check the file size....

After my gf connected the hard disk back onto her Mac, all "renamed" files show a file size of 4KB (empty)! I screwed it up and I don't know how...

I assume the data is still there, but I somehow screwed the filesystem.

Does anybody understand what I did wrong? More importantly, do you see a chance to recover the files? I would appreciate any advice.

Lukas

How to recover “deleted” files in Linux, that originate from a macOS hard drive

My girlfriend has a external hard disk with 10 years+ of photos, documents and more. A lot of these files originate from her old iPhone 5 and her MacBook. The hard disk itself is NTFS Format. Since the disk is so old, it turns into a hazard of data loss (what an irony).

As we tried to upload all the files into OneDrive to store them safely, we got 1,000s of errors because of invalid file names. I realized that many files started with ._, e.g. ./pic/92 win new/iphone/._IMG_1604.JPG. I don't understand macOS and why files should be named like that, but for sure you can never get them into OneDrive like that. 

So I decided to hook it to my Raspberry Pi and rename all files with the wrong characters from the command line. After listing the nearly 10,000 files, I ran the following over the whole hard disk.

find . -name "._*" | sed -e "p;s/\._//" | xargs -d '\n' -n2 mv 

Furthermore, I removed some leading whitespace in filenames with zmv.

I tried the command in a test environment first and it looked fine. But I didn't check the file size.

After my girlfriend connected the hard disk back onto her Mac, all renamed files show a file size of 4KB (empty)! I screwed it up and I don't know how.

I assume the data is still there, but I somehow screwed the filesystem.

Does anybody understand what I did wrong? More importantly, do you see a chance to recover the files? I would appreciate any advice.

Became Hot Network Question
Minor corrections
Source Link
terdon
  • 252.7k
  • 69
  • 481
  • 719

I'm having a bit of a crysiscrisis here.

My girlfriend has a external harddiskhard disk with 10 years+ of photos, documents and more. A lot of these files originate from her old iphoneiPhone 5 and her macbook. The harddiskhard disk itself is NTFS Format. Since the disk is so old, it turns into a hazard of data loss (what an irony).

As we tried to upload all the files into onedrive to store itthem safely, we got 1000s of errors because of invalid file names. I realized, that many files started with "._"._, e.g. ./pic/92 win new/iphone/._IMG_1604.JPG. I don't understand MACmacOS and why files should be named like that, but for sure you can never get itthem into onedrive like that. So I decided to hook it to my raspberry pi and rename all files with the wrong characters overfrom the command line. After listing the nearly 10.000 files, I ran the following over the whole hard disk.

`findfind . -name "._*" | sed -e "p;s/\._//" | xargs -d '\n' -n2 mv`mv 

Furthermore, I removed some leading whitespaceswhitespace in filenames with zmv.

I tried the command in a test environment first and it looked all fine. But I didn't check the file size....

After my gf connected the harddiskhard disk back ononto her MACMac, all "renamed" files show a file size of 4KB (empty)! I screwed it up and I don't know how...

I assume, the data is still there, but I somehow screwed the filesystem.

Does anybody understand what I did wrong? More importantly, do you see a chance to recover the files? I would appreciate any advice.

Lukas

I'm having a bit of a crysis here.

My girlfriend has a external harddisk with 10 years+ of photos, documents and more. A lot of these files originate from her old iphone 5 and her macbook. The harddisk itself is NTFS Format. Since the disk is so old, it turns into a hazard of data loss (what an irony).

As we tried to upload all the files into onedrive to store it safely, we got 1000s of errors because of invalid file names. I realized, that many files started with "._", e.g. ./pic/92 win new/iphone/._IMG_1604.JPG. I don't understand MAC and why files should be named like that, but for sure you can never get it into onedrive like that. So I decided to hook it to my raspberry pi and rename all files with the wrong characters over command line. After listing the nearly 10.000 files, I ran the following over the whole hard disk.

`find . -name "._*" | sed -e "p;s/\._//" | xargs -d '\n' -n2 mv` 

Furthermore, I removed some leading whitespaces in filenames with zmv.

I tried the command in a test environment first and it looked all fine. But I didn't check the file size....

After my gf connected the harddisk back on her MAC, all "renamed" files show a file size of 4KB (empty)! I screwed it up and I don't know how...

I assume, the data is still there, but I somehow screwed the filesystem.

Does anybody understand what I did wrong? More importantly, do you see a chance to recover the files? I would appreciate any advice.

Lukas

I'm having a bit of a crisis here.

My girlfriend has a external hard disk with 10 years+ of photos, documents and more. A lot of these files originate from her old iPhone 5 and her macbook. The hard disk itself is NTFS Format. Since the disk is so old, it turns into a hazard of data loss (what an irony).

As we tried to upload all the files into onedrive to store them safely, we got 1000s of errors because of invalid file names. I realized that many files started with ._, e.g. ./pic/92 win new/iphone/._IMG_1604.JPG. I don't understand macOS and why files should be named like that, but for sure you can never get them into onedrive like that. So I decided to hook it to my raspberry pi and rename all files with the wrong characters from the command line. After listing the nearly 10.000 files, I ran the following over the whole hard disk.

find . -name "._*" | sed -e "p;s/\._//" | xargs -d '\n' -n2 mv 

Furthermore, I removed some leading whitespace in filenames with zmv.

I tried the command in a test environment first and it looked fine. But I didn't check the file size....

After my gf connected the hard disk back onto her Mac, all "renamed" files show a file size of 4KB (empty)! I screwed it up and I don't know how...

I assume the data is still there, but I somehow screwed the filesystem.

Does anybody understand what I did wrong? More importantly, do you see a chance to recover the files? I would appreciate any advice.

Lukas

Source Link
LukasH
  • 109
  • 1
  • 1
  • 3
Loading