mac - Corrupted files, hard drive test?

06
2013-08
  • allaire

    I'm currently on a macbook with a 1TB external hard drive connected trough a USB hub wich is connected on my macbook. The problem is, my disk, wich is partitioned in 2 (one HFS+ and one NTFS) keeps getting corrupted, recently it was my HFS+ partition, I could not repair it using the Apple's Disk utility, but was able to backup my files.

    Is it synonym that my hard drive is failing? Is it because of my USB hub?

    I also keep all my iTunes library on my external HD (HFS+ partition), and did a lot of transfer lately, adding files, removing etc. the last time, my partition got corrupted after a lot of deleted items.

    If anybody has an idea of what to check first, what could cause the problem, I would appreciate it :)

    Thanks!

  • Answers
  • soandos

    A checklist of things to check:

    1. Swap out the hub, cables
    2. See if getting one of the USB cables that goes into two ports on your computer makes a difference (will give the drive more power)
    3. Check the S.M.A.R.T. statistics for the drive (you can use the instructions here to do that)
    4. If you have another drive, see if the same type of corruption occurs with that drive.
    5. Use that drive with a different computer, and see if that makes a difference.

  • Related Question

    multi boot - Hibernating and booting into another OS: will my filesystems be corrupted?
  • Ryan Thompson

    IMPORTANT

    If you came here looking for an answer to this question, please read all the answers below. There are some testimonials from people who have lost data doing this. If you plan to do this regularly, I highly recommend that you test for yourself.


    Original Question

    Suppose I have Windows and Linux installed on the same computer. If I hibernate Windows, can I boot into Linux without corrupting the Windows filesystem when I resume Windows? What about the other way around? What if I hibernate one, boot into the other, and mount the hibernated filesystem read/write? Read-only? If this is unsafe, is there any way to detect the hibernated state of the other OS and prevent mounting its filesystem?

    Basically, how far can I push this before it breaks, and how dangerous is it near the edge? I think I know the answers to some of the above questions, but for other ones, I have no idea, and for obvious reasons I have not tested this on my own computer. If someone has tested these, please enlighten the rest of us. I'm not necessarily looking for a specific answer to every question; I'll accept any response that answers a reasonable portion.


    EDIT

    Let me clarify that when I say "hibernate," I mean the process of writing the contents of RAM to the hard disk and completely powering down the computer. In this state, powering the computer back on brings you through the BIOS and bootloader again, and you could theoretically select another operating system on a multi-boot system. Anyway, on with the original question:


    My Results

    Ok, after everyone's assurances that this would work, I tested it for myself. I set up Ubuntu to remount all ntfs filesystems and external drives read-only before hibernating. There was no need for a similar Windows setup because Windows does not read Linux filesystems. Then, I tried alternately hibernating one operating system and resuming the other, back and forth a few times. I even tried mounting the Windows filesystem from Ubuntu read-write, and creating a few files. Windows didn't complain when I resumed. So, in conclusion, you can more or less freely hibernate in a dual-boot Windows/Linux scenario.

    Note that I did not test a dual Linux/Linux co-hibernation situation. If you have two or more Linux installs and you hibernate one of them, you might be able to corrupt the filesystem by mounting it from another.


  • Related Answers
  • Chema

    Booting Windows over an hibernated Linux is not a good idea. I just lost 20 GiB of data in a shared NTFS partition...

    I hibernated Ubuntu Lucid one day, and the next I fired up my computer. Some update messed up the saved option in Grub, so instead of booting Ubuntu again as it should, it started Windows 7. When I came back with my coffee, I just went on using it without recalling Ubuntu was in bear mode. I probably accessed music, Firefox profile, documents, downloads and games from the shared partition.

    The next time I switched to Ubuntu, I saw the "waking up from hibernation" message. Dang. But I expected it to fail at waking, and soft reboot instead, as happened the previous time I "tried" this (in my Karmic times). But no, it woke up alright. Cool. Or not. I quickly realized a directory in the root of the shared partition was now empty. I think the only programs accessing the shared partition on resuming were Quod Libet (music player) and Transmission (bittorrent client).

    I went back to Windows, where I couldn't even open the directory. Trying to "dir" it in shell produced "file not found". Corrupted. Still, the partition's free space had not increased, so my 20 GiB where probably still there, safe from being overwritten. Maybe. But how to get to them?

    A little research provided little help, and made my hopes even more bleak.

    I ran Scandisk ("Check for Errors") without auto repair, since I don't wanted to risk it fixing things by further destroying my data. The result was not very informative: "Errors found. Run with auto repair." Unknown to me, seemingly it also marked the partition to be automatically checked on next boot. I powered off and went away, and came back with EasyRecovery later.

    The computer started with me not paying attention, as usual, and when I looked, chkdsk was already spewing errors in full swing, which it did for some ten minutes. Oh well, here goes nothing.

    Fortunately I did lit a candle for Santa Tecla recently, and after Windows started, my data was back, all of it as far as I can tell, though some files ended up in found.000.

    So yes, this had a happy ending. You'll forgive the dramatic suspense, but that's to drive a point across: backup your data! And (in my case) keep the backup up to date! And of course, be extra careful with hibernation and shared partitions...

  • vava

    I always hibernate Windows before booting in anything else, Windows is just too slow to start from scratch. But it is dangerous to write to the partition of hibernated OS, because some of the FS tables are still in memory (well, in hibernation file but not in the FS), applications still have handles to some files and generally file system state is kind of unstable.

    But you can mount that partition read-only, this way it will stay exactly the same as before hibernation and Windows won't notice a thing.

    As for a suggestion about mounting it normally and just stay away from system files, it is not a good idea. Relocation of a file content might happen, MFT might be changed, access time attributes will be changed, all those things might seriously corrupt a file system. It is not so dangerous with FAT but it is really really dangerous with NTFS, as it is far more complicated and have far more state in the memory.

  • nik

    I regularly hibernate my Windows XP and boot over USB into Ubuntu.
    Works flawlessly.

    There is a difference between 'Standby' mode and 'Hibernate' mode.
    The OS state is completely flushed to the disk and your hardware is powered off.
    If you power up the machine and boot into some other OS, it has no impact on the hibernated OS.
    You can keep as many OS'es hibernated as you want.

    As an example,
    You could have multiple Ubuntu installations (say, one per USB flash drive),
    And, hibernate each, unplug the drive, and boot into another one.
    There is no edge here because there is no stacking/chaining effect.
    The hibernated USB sticks in this examples are all independent of each other
    (across a power-cycled machine).

    One small downside of a hibernated "C:\" drive and booting into another OS is,
    you would not be able to mount the hibernated boot partition in the new OS.
    The partition is locked with hibernation.
    It will be corrupted if edited in that state.

  • CtC

    I can confirm the loss of data issue with a shared NTFS partition. I dual-boot between Lucid Lynx Ubuntu and Windows 7. After hibernating Windows 7 and booting into Ubuntu, I proceeded to build three VirtualBox virtual machines (over the course of 7 days) and installed a variety of software packages into those machines. Upon restarting into Windows 7, the files disappeared. Gone. ntfsundelete and foremost were not able to find them.

    So, I ran a series of tests to see if this was in fact what caused the loss of data. When shutting Windows 7 down, starting Ubuntu, writing some files, restarting back into Windows 7, the files are always retained. When hibernating Windows 7, restarting in Ubuntu, writing some files, restarting into Windows 7, the new files are gone.

    I don't know about CHANGES written to a file, whether they are retained or lost, but new files and folders added to a shared NTFS partition are most likely going to be lost in this situation.

  • Breakthrough

    There is nothing wrong with what you mentioned. Even if you mounted the hibernated filesystem, the contents of the hibernation are saved to a large file on the disc - as long as you don't touch this file, or any important system files (obviously), then nothing will happen.

    If you change the contents of a partition from another OS after you turn the system off, the original partition will still boot with no problems. It's the same thing in hibernation.

    Just be sure that when mounting/unmounting the partition, you don't damage any system files or drive header information (e.g. MBR, file journals) - although this point has nothing to do with hibernation, and more just a common warning we all need to know.

  • Daniel

    I ran into problems with hibernate and multi-booting. Situation: Ubuntu and WinxP Multboot but the data partition visible for both OS. I did some testing... back and forth... So I was editing a Wordfile with Word... Saved the file and closed Word. Hibernated... started Ubuntu... edited the same file with OpenOffice... hibernated.

    Rebbooted to the hibernated WinXP. Word did NOT 'see' the changes... It simply loooked like another file...

    I also did this testing the other way around... Second time file was corrupted... I could not open the file or delete the file Chkdsk 'solved' the problem but the file was lost... In another test Ubuntu did not even see the edited file.

    SO when using hibernation and the same partitions (does NOT need to be the partition where the OS boots from...) ist is very dangerous... Files can and will corrupt in my tests and I can repeat it... BTW: In my tests I ALWAYS saved the file and closed the application (Word and OpenOffice) befre going into hibernate...!! I thought mounting the partition was the culprit but now I think the problem must be something about file-caching or whatever... Anyhow: Be careful with multi-OS-hibernation...!! Regards, ArnoR

  • Nathan Osman

    DON'T DO IT!

    On my computer (Vista/Ubuntu 10.04) this caused a huge fiasco.

    I hibernated Windows and booted to Ubuntu. Then I accessed some files on the Windows partition (NTFS). When I switched back to Windows, I got the 'One or more of your disks has errors...' message.

    Not fun.

  • Finn

    DANGER! I can also confirm this is a dire issue for both FAT32 and NTFS volumes & only when Windows (I have windows 7) is hibernated. I think this is tied to caching and have considered setting the drive up for quick removal. That may fix it, but I haven't tried it yet because I really only want to set one partition up this way which Windows does not seem to support. Even my OSX ntfs driver supports per partition cache control, but not windows. Also, my OSX ntfs driver seems to recognize that the drive should not be mounted. Seems to be tied to this issue. Hope that helps.

  • 8088

    Don't do it (again!)

    I hibernated my Vista/NTFS and booted up Lucid, worked 3 days on the shared ntfs partition, and started having files and directories disappearing or locked with nasty error messages (within lucid). When I booted back to windows it was a true mess, desktop gone havoc etc.. Hopefully chkdsk was able to fix most of it and I fished out from found.000 about 98% of what I had before.
    So it's definitely not a good thing to do.
    I sort of remember that this was not possible before: 'hibernated' ntfs partitions were not mountable in linux for some (apparently good) reason. I'd like to come back to this old behavior

  • David Pearce

    I just don't think this is possible.

    When you hibernate, the computer is 'locked in' (for lack of a better term) to that OS. You aren't hibernating the OS, you are hibernating the whole computer. When to resume from hibernation, you don't go through the BIOS and the POST time again.