Reading/writing NAND using dd under Mac OS X / Linux

Discussion in '3DS - Console, Accessories and Hardware' started by mashers, Jan 19, 2016.

  1. mashers
    OP

    mashers Stubborn ape

    Member
    3,837
    5,156
    Jun 10, 2015
    Kongo Jungle
    My n3ds is on its way back from being hardmodded and I've got a card reader which should be compatible. I'm a Mac user and don't have a Windows machine I can use. Windows isn't cooperating with my Mac so I can't use win32diskimager for reading/writing the NAND. I can use Linux on my RPi. Do any Mac or Linux users have experience of reading and writing the NAND from a hard modded 3ds? I'm comfortable with the command line and have used dd to write RPi Linux images to SD, but want to make sure I use the correct syntax and block size. I basically want to make sure the image I take is valid before potentially writing it back...
     
  2. CrispyYoshi

    CrispyYoshi GBAtemp Advanced Maniac

    Member
    1,516
    502
    Mar 20, 2010
    United States
  3. mashers
    OP

    mashers Stubborn ape

    Member
    3,837
    5,156
    Jun 10, 2015
    Kongo Jungle
    Yeah I know, as I said I have used that command before but want to make sure I get the block size etc correct. However, @gamesquest1 has taken and verified some NAND dumps so I should be safe to experiment with reading and writing images. I'll have a play with dd and once I find something that works I'll post up a tutorial.
     
    CrispyYoshi likes this.
  4. Tjessx

    Tjessx GBAtemp Maniac

    Member
    1,157
    508
    Dec 3, 2014
    Belgium
    I have done it before using dd, give me a few minutes, i'll find the command
     
  5. CrispyYoshi

    CrispyYoshi GBAtemp Advanced Maniac

    Member
    1,516
    502
    Mar 20, 2010
    United States
    Glad it's sorted out then. Good luck!
     
  6. Tjessx

    Tjessx GBAtemp Maniac

    Member
    1,157
    508
    Dec 3, 2014
    Belgium
  7. mashers
    OP

    mashers Stubborn ape

    Member
    3,837
    5,156
    Jun 10, 2015
    Kongo Jungle
    @Tjessx
    Ahh wicked, thanks. Looks like a basic dd command is all that's needed :)
     
  8. Tjessx

    Tjessx GBAtemp Maniac

    Member
    1,157
    508
    Dec 3, 2014
    Belgium
    i remember using bs=1m in my command aswell, however it can be used without apparently
     
  9. mashers
    OP

    mashers Stubborn ape

    Member
    3,837
    5,156
    Jun 10, 2015
    Kongo Jungle
    I also use bs=1m when reading/writing raspberry pi images. I'll take one image with this and one without and compare the md5sums to see if it actually makes a difference.
     
  10. mashers
    OP

    mashers Stubborn ape

    Member
    3,837
    5,156
    Jun 10, 2015
    Kongo Jungle
    Just reporting back now I've got my 3DS back :) I was feeling brave so I made a NAND backup using EmuNAND9, and then used my hard mod to restore my 9.2 and 10.3 backups. The following commands worked on my Mac:

    Code:
    # read
    $ sudo dd if=/dev/rdisk3 of=~/Desktop/9.2NAND.bin bs=1m
    
    # write
    $ sudo dd if=~/Desktop/9.2NAND.bin of=/dev/rdisk3 bs=1m
    I actually read four images: two using bs=1m, and two without. The md5sums for all four were identical, meaning there was no difference in the NAND dumps. However, using bs=1m significantly reduced the time taken to read the NAND. The same applied when writing - copying the NAND dump back to the 3DS took over an hour without bs=1m, but when I added bs=1m it took significantly less time. They both worked fine once written, one was just much faster than the other.

    Edit - you obviously need to change the device from /dev/rdisk3 to the actual device the 3DS shows up as on your system. On a Mac you can find this by typing "diskutil list" into the terminal and looking for the 2GB disk.
     
    Last edited by mashers, Jan 21, 2016
    Tjessx likes this.
  11. reeso3000

    reeso3000 Newbie

    Newcomer
    6
    0
    Mar 2, 2016
    Mashers - can you confirm that it as just the built in sd card reader on the mac and out of curiously the version of mac? im using a late 2013 macbook pro and looking to read and write using the commands you have posted. Thanks in advance!
     
  12. mashers
    OP

    mashers Stubborn ape

    Member
    3,837
    5,156
    Jun 10, 2015
    Kongo Jungle
  13. reeso3000

    reeso3000 Newbie

    Newcomer
    6
    0
    Mar 2, 2016
    Thanks for the quick reply! Just wondering if you have attempted it at all? I have written images to my orange pi (raspberry pi wannabe) which I believe is writing raw with the built in reader. I am assuming there would be no harm in trying to read the nand with it if no one has tried it?
     
  14. mashers
    OP

    mashers Stubborn ape

    Member
    3,837
    5,156
    Jun 10, 2015
    Kongo Jungle
    I've just tried it on my mid-2011 iMac and it didn't work :( The 3DS just booted up as though the hardmod cable wasn't attached. When I used my USB card reader subsequently it worked, so I think the chipset of the iMac is simply not compatible with the 3DS NAND. Other Macs are probably the same. It's likely just a coincidence that your OPi just happens to have a compatible chipset.

    There should be no harm in testing it on your Mac just in case it has a different USB chipset, but it's highly unlikely - I think all Macs use Intel integrated stuff for the built-in USB, graphics, audio etc. Your best bet is the Plugable USB adapter I linked above.
     
  15. reeso3000

    reeso3000 Newbie

    Newcomer
    6
    0
    Mar 2, 2016
    Thanks again for your prompt response and for the detailed info!
     
  16. mashers
    OP

    mashers Stubborn ape

    Member
    3,837
    5,156
    Jun 10, 2015
    Kongo Jungle
    You're welcome buddy :)
     
  17. Tjessx

    Tjessx GBAtemp Maniac

    Member
    1,157
    508
    Dec 3, 2014
    Belgium
    I attempted it, and it doesn't work.
    Edit: retina macbook pro 13" 2014
     
  18. reeso3000

    reeso3000 Newbie

    Newcomer
    6
    0
    Mar 2, 2016
    Thanks for the info!! I have tried a few readers I managed to get hold of but they won't recognise the "sd card" once plugged into windows/osx but I get the correct blue screen (from pics I have seen and the numbers match).So im guessing its just the readers rather than my soldering. Have ordered one for delivery on monday which seems so far away right now with my 3ds in pieces on my desk!! ;p
     
  19. reeso3000

    reeso3000 Newbie

    Newcomer
    6
    0
    Mar 2, 2016
    Sorry for the double post but just wanted to say thanks again for the info guys - Managed to use a cheap micro sd card reader I had lying around, ended up using windows as my mac wouldn't recognise even a micro sd card let alone read the nand.
     
  20. mashers
    OP

    mashers Stubborn ape

    Member
    3,837
    5,156
    Jun 10, 2015
    Kongo Jungle
    Glad you got it working mate :) make sure you take a few NAND dumps one after the other and compare the md5sums to make sure you got a valid dump :D