LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Laptop and Netbook
User Name
Password
Linux - Laptop and Netbook Having a problem installing or configuring Linux on your laptop? Need help running Linux on your netbook? This forum is for you. This forum is for any topics relating to Linux and either traditional laptops or netbooks (such as the Asus EEE PC, Everex CloudBook or MSI Wind).

Notices


Reply
  Search this Thread
Old 09-19-2013, 10:43 AM   #1
fredbird67
LQ Newbie
 
Registered: Mar 2003
Location: Ballwin, MO
Posts: 14

Rep: Reputation: 0
Failing external hard drive


This one's for a friend of a friend of mine who posted the following to a group I'm a part of on Facebook, and he posted the following, since it is kind of Unix/Linux related, in a roundabout way, since it involves a Mac:

Quote:
Can I ask for a little Linux/Unix Bash help?

I am using the terminal on a Mac OS 10.4 laptop to salvage MP3 files from a failing ext. HDD; the failing drive is in NTFS format, read-only. Neither Win7 nor the OS X UI will read the ext. HDD, but the Mac terminal, Darwin, will. Darwin is just a version of Unix.
It is going okay, except for this one snag:
It will not copy files beginning with a period.
I am trying to copy the files while renaming them-
Source: ._01_Only_Time_Will_Tell_320.mp3
Renamed Destination: 01_Only_Time_Will_Tell_320.mp3

I cannot mv to rename within the same directory as the drive is read-only.

I suspect that the solution lies within the use of either mv or cp, with some particular options selected, but have been unsuccessful so far.

Are there any *Nix Gods in this group that can give me a little help? I have a very rudimentary-level knowledge of Linux commands/Bash- probably just enough to be a danger to myself.

Basically, I am trying to copy/rename
/Volumes/BlackMaxtor/MyDocuments/MyMusic/CaptainsDead.com/Glossary/The Better Angels of Our Nature/._01_Only_Time_Will_Tell_320.mp3

to

/bm/gloss/01_Only_Time_Will_Tell_320.mp3

Any help would be appreciated. Thanks.
 
Old 09-19-2013, 11:34 AM   #2
peter2012
LQ Newbie
 
Registered: Dec 2012
Distribution: Kubuntu, LUbuntu, Mint, Debian
Posts: 16

Rep: Reputation: Disabled
Rescuing files on broken drive

Regards failing Harddrives, there's one important rule - don't work too much with the original drive, but work on a copy of it. The way I deal with broken drives is:

1. use dd to make a binary equivalent copy of the original harddrive to a file on a good harddrive.
2. loop mount the file I just dd'd
3. do all the manipulations on the loop mounted copy.

1. DD

DD is a program to read a storage device sector by sector and to write the information onto another device / file. To dd a drive I would do something like:

Code:
dd if=<orig device node> of=/path/to/my/copy

Where <orig device node> is the specifier of the original storage device and /path/to/my/copy would be the file name of the binary equivalent copy on my known good storage device. For example, to copy the first partition of my first harddrive (/dev/sda1) to the file /home/user/dumps/myharddrive.img I would issue:

Code:
dd if=/dev/sda1 of=/home/user/dumps/myharddrive.img
where /home/user/dumps is located on the known good hardware. This would read the first partition of the drive sda sector by sector and write the data to the file myharddrive.img

The resulting file myharddrive.img would contain the entire partition sda1. Note that the original partition has to be unmounted before doing the dd copy. dd will run a while - maybe an hour or so (depending on the size of the original partition). Once finished, I would disconnect the original bad drive so it won't incur further damage.

2. Once the bad drive is copied with dd we can loop mount the copy. I would create a directory first:

Code:
mkdir /home/user/mymountpoint
And then I'd loop mount the copied image in read only mode:

Code:
mount -o loop,ro /home/user/dumps/myharddrive.img /home/user/mymountpoint
Now the entire partition will be accessible in /home/user/mymountpoint, i.e. I'd be able to read the files just as if I used the original bad harddrive.

Hope this helps! Sorry for any mistakes, I wrote this in a bit of a haste. Corrections welcome!
 
Old 09-19-2013, 12:18 PM   #3
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,137
Blog Entries: 1

Rep: Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874
mv and cp are only some of the utils available. There's rename that's part of the perl package in debian (prename).

Make a dd copy and work your magic there. If you don't have the wiggle room for a copy and recovering the data isn't time sensitive, you might set the disk aside and ignore it until you have the wiggle room.

I guess it depends on what you mean by failing. Sometimes the drive is fine, but the filesystem got corrupted. You still want to minimize the modifications to the original until you have what you need from it. You can use the testdisk package and the photorec utility if the filesystem is really bad. But I'd still try to do that on a dd copy of the partition. Unless you trust the drive to "NOT" fail while extracting the data from it. And even then you might want to use a copy. The utility might improve later and recover more of the data if run against it again at a later date.
 
Old 09-19-2013, 05:09 PM   #4
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
When it is a failing drive you better use ddrescue instead of dd to minimize stress on the disk and read as many sectors as possible.
Then work from that copy as described above.
 
  


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] transfer data from a SATA external hard drive to a IDE internal hard drive Cabtech Linux - Newbie 7 04-22-2012 02:55 PM
Booting Linux on an external USB hard drive (not a memory stick, a hard drive) comcastuser Linux - Hardware 4 01-13-2010 06:59 PM
ubuntu installed on external hard drive, can't startup without external hard drive. Vanostaajen Linux - Software 23 01-20-2009 09:59 AM
Ubuntu: Installed to external hard drive; boot to primary hard drive gives error 22 dcorb62 Linux - General 7 09-04-2007 11:28 PM
external enclosure for an internal hard drive vs external USB hard drive powah Linux - Hardware 1 03-10-2006 09:03 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Laptop and Netbook

All times are GMT -5. The time now is 11:58 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