Linux - HardwareThis forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices

Welcome to LinuxQuestions.org, a friendly and active Linux Community.

You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!

Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.

If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.

Having a problem logging in? Please visit this page to clear all LQ-related cookies.

Introduction to Linux - A Hands on Guide

This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.

I have a big problem. Last night I took a lot of pictures using my Fujifilm FinePix F30 camera with Olympus xD Picture Card (H 512 MB) -- among them a dozen or so of really great pictures. At home I tried to mount my picture card using hama USB 2.0 Card Reader and my newly installed Slackware 12.1 but I couldn't do it. I'm not familiar with 2.6 series kernels and all those magic devices, so I switched back to Slackware 11.0 with 2.4 series kernel and tried to mount that card as I did it in the past but without success. Then I put it back to the camera and it said: ``CARD NOT INITIALIZED''. Finally I switched to Windows XP. It suggested me to format my picture card. I don't want to format it. I'd like to recover my pictures.

My picture card was good before I removed it from my camera and something wrong happened when I attached it to my machine and tried to mount it in my new system. Now it's useless.

The xD picture card in hama's card reader should be seen in the system as /dev/sdd1 device. When I plugged in to my machine the card reader with the picture card for the first time /var/log/messages registered:

Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xecb40075.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): q

I have two questions:

1. Does Linux can damage the picture card?

2. How can I recover my pictures, and if I can't, is there any service capable to do it?

At the moment the second question is much more important for me than the first.

Yanking the card out without using a safe unmounting procedure can corrupt the filesystem. Linux often uses an asynchronous writing system, which means that the data actually sits in a buffer for a while before physically being written to disk, so you have to make sure the data is synced before removing it. Calling the umount command in cli will automatically run sync before finishing the unmount, and there's also a 'sync' command you can use to do it manually. In gui there's likewise always some kind of 'unmount' or 'safely remove' option.

You can try to run dosfsck on the drive and see if you can get it to repair the filesystem. Failing that there are some recovery tools that can find lost files, such as such as testdisk/photorec.

BTW, when it comes to data recovery it's usually a good idea to use dd or ddrescue to create an disk image to work on instead of working directly on the drive itself.

Well, I very much doubt that Linux did anything to your card unless you typed some incredibly silly commands.

I reckon that you may have better luck with:

mount -t vfat /dev/sdd /mnt/tmp

because it looks like (as in many cameras), the card does not have a real partition table or the card reader "ignores" the partition table, and everything is just stored straight onto the card itself.

If not, an idea would be to do:

dd if=/dev/sdd of=/image-of-my-card

and analyse the image file that you get from that. This will prevent any further damage occuring to your card by things that you try, because you'll have "backed up" an image of it.

You can then make multiple copies of that file and do things like:

fdisk /image-of-my-card

and let it try to "fix" any problems it sees because it will be operating on the image file.

My guess would be that either the resulting file would be mountable if you don't try to look for a particular partition, contain all-zeros or you actually have a card reader not capable of reading the card properly (which can happen with cheap readers, SD cards of > 2Gb and/or SDHC cards in an SD card reader etc.).

Try a friends card reader and NEVER let anything format it, if you are determined to recover the information. You may well be able to recover a lot of things from the card's image file itself if you have a working hardware combination.

I also tend to find that my camera gives this message when it's batteries are dead, no matter what SD card I put in. It's also possible that the camera died while writing to the card which may have corrupted it.

My xD picture card is recognized by Slackware 11.0 as /dev/sdd1 and should be recognized as /dev/sdd1 by Slackware 12.1. I have also other camera -- it uses CompactFash. Both Slackwares -- 11.0 and 12.1 -- recognize it as /dev/sda1.

I tried dd as well as ddrescue, as I wrote above. The results are very poor.

I tried fdisk trick you suggest:

# fdisk xd-dd.img
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x0f623715.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

You must set cylinders.
You can do this from the extra functions menu.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 25: Inappropriate ioctl for device.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.

The photorec utility is the one I think I would start with to recover the pictures. It will recover other filetypes, but it was written particularly for this purpose:http://www.cgsecurity.org/wiki/PhotoRec

It won't write to the device. It recovers files to your home directory.

For w1k0;
It's better not to post so much stuff when describing a problem---people can get lost.

Also, flash memory does go bad. If I did not read anything else here, the part about dd not reading the whole card is suspicious. dd does not care about filesystems or anything else--it just reads raw data.

As I know storage devices can be logical damaged (they require non-invasive procedures of repairing) and physical damaged (they require invasive procedures of repairing). There are companies specialized in data recovering, for example: http://www.ontrackdatarecovery.com/. Invasive recovery procedures are about twice times as expensive as non-invasive ones. Non-invasive ones are about ten times as expensive as 512 MB xD picture card.

After all my tests I'm practically sure that my picture card is not software but hardware damaged. I intend to send it to some company similar to the one mentioned above.

I don't know if I can or cannot reformat my picture card. I didn't try it. I don't want to format it. I want to recover my pictures.

If you can't recover the pictures with tools already discussed, then by all means try a recovery service.

I don't know what "hardware repair" you have in mind for a solid-state device, but I wish you the best of luck. But first, you really should try another card to be sure you don't have some other issue.

...I tried to use /dev/sdd becase there is no /dev/sdd1 in the system...

...dd can read about 32 MB of the entire 256 MB and ends with errors. The image contains almost exclusively the pattern of FFs with a few blocks of 00s inside (to see the image's content I used Midnight Commanders's F3 (View), F4 (Hex) options)...

The picture card mentioned above is logically completely dead. The only hope is in physical methods of restoring data.

As I said in the beginning: ``My picture card was good before I removed it from my camera and something wrong happened when I attached it to my machine and tried to mount it in my new system. Now it's useless''.

Just for your in knowledge I repeated the same set of the commands with some CompactFlash digital memory card (1024 MB) to show you how should look the output of these commands with the unbroken card (that card is inserted in the sda slot of the reader)...

The number of cylinders for this disk is set to 1986.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)

...I used /dev/sda1, because it exists and I'd like to mount the image in the file system...

# mount -o loop /root/cf.img /mnt/tmp/

...now I mounted the image of the card in the system...

# ls -R /mnt/tmp/
/mnt/tmp/:
dcim

/mnt/tmp/dcim:
196olymp

/mnt/tmp/dcim/196olymp:
p6060530.jpg

...and I can see there is one picture on that card...

# umount /mnt/tmp/

Remark: With the valid card the image of the device (for example /dev/sda) should be 32256 bytes greater than the image of the partition (for example /dev/sda1) -- the former contains some additional information at the beginning.