Hacking Question Attempting to compress NAND backup; only saving ~2gb on an empty NAND

DSpider

Well-Known Member
Member
Joined
Mar 14, 2015
Messages
566
Trophies
0
XP
1,307
Country
Romania
I compressed my 2.2.0 backup to 644 MB using 7-Zip (LZMA2, Ultra). WinRAR says it's 2% of the original filesize. I only finished Zelda: BotW on the thing (played from the cartridge) and reached the 1000 screenshot limit once. That's it. If you backed up a newer firmware, Nintendo may have added extra files and stuff, but definitely not something that would break 1 GB, imo. And the save game files can't be that big.

The backups initially take up 29.1 GB space because that's the size of the internal memory (the NAND chip). It's encrypted, so it backs up the whole thing because if/when you decide to restore that backup it will put the data blocks in their original order. And even though they are encrypted, the blocks of memory containing free space are compressed better, because each free space block is similar to the next. The compression software looks at the data and says "yeah, 98% of these blocks are similar, so I might as well keep one intact and duplicate it 97 more times when it's decompressed".

If your backup takes up 12 GB AFTER compression, that means it had a shit ton of stuff on it.

But I suppose you could mount the internal memory as a mass storage device with TegraRcmGUI and use something like CCleaner's "Drive Wiper" (Free Space Only - 1 Pass) to zero out the free space prior to making the NAND backup.
 
Last edited by DSpider,

shchmue

Developer
Developer
Joined
Dec 23, 2013
Messages
791
Trophies
1
XP
2,367
Country
United States
you also don't really need a full backup, just prodinfo and boot0 and bis keys, and system if you don't want to get firmware files
 
Last edited by shchmue,

SirNapkin1334

Renound Aritst
Member
Joined
Aug 20, 2017
Messages
1,665
Trophies
1
XP
975
Country
United States
So I've tried multiple compression types with 7zip and WinRAR and I'm only saving roughly 2gb on both my SX OS and Hekate NAND backups.

I purchased the Switch used (couldn't find a new exploitable one at any local stores) and it came with FW 6.0.1 installed. The second I got the Switch out of the store I did a factory reset and cleared everything, turned airplane mode on, and did a NAND backup with both SX OS and Hekate in that order. My NAND should be basically empty but I'm still not getting the same compression that most others are getting. I've followed the guides on the forums and did some research on different types of compression with no luck. Since I bought it used and content was on it previously does that screw my NAND backup or am I just missing something while compressing it?
This is because NAND backups are encrypted files. Encrypted stuff compresses terribly because of it's nature - the data is completely random, and data compression relies on patterns in the data. Compressing anything that is (well) encrypted will give minimal gains, and is probably not worth the hassle since it often takes a long time.
 

gg11

Member
Newcomer
Joined
Jan 7, 2019
Messages
10
Trophies
0
XP
67
Country
Belgium
Zeros compress well, encrypted zeros do not compress the same. Since they are no longer zeros.

A nand image is encrypted data even the empty space is encrypted. You will never get that good of compression in this case. Some variation is possible on compressed size depending on the encrypted data but it will never be all zeros.

All allocated block in the fat32 filesystem need to be encrypted, but all the other blocks could be 0 (written non encrypted).
That's probably what they N* do on the nand for stock consoles.

My stock console with fw 2.3 nand dump compress very well to a 260MB 7z file.

A good way to restore to that state could be to mount the decrypted filesystem, copy the files to a PC directory, wipe to all 0 the partition (not crypted), then create a new fat32 filesystem crypted, and copy back the files.

Not tested yet, my current compressed size is around 2GB, so no need to...
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
  • SylverReZ @ SylverReZ:
    @mthrnite, Cheetah Girls, the sequel to Action 52's Cheetah Men.
    +2
  • Psionic Roshambo @ Psionic Roshambo:
    Pokemon Black I played that one a lot
  • K3Nv2 @ K3Nv2:
    Honestly never messed with Pokémon on ds much
  • mthrnite @ mthrnite:
    I played pokemon once, was bored, never tried again
  • Psionic Roshambo @ Psionic Roshambo:
    Oh Dragon Quest IX
  • K3Nv2 @ K3Nv2:
    Spent like 5 hours on switch one never touched it again
  • Psionic Roshambo @ Psionic Roshambo:
    Sentinel of the stary skies
  • K3Nv2 @ K3Nv2:
    Ds is 20 years old this year
  • Psionic Roshambo @ Psionic Roshambo:
    So MJ no longer wants to play with it?
  • K3Nv2 @ K3Nv2:
    He put it down when the 3ds came out
  • SylverReZ @ SylverReZ:
    @K3Nv2, RIP Felix does great videos on the PS3 yellow-light-of-death.
  • Jayro @ Jayro:
    Eventhough the New 3DS XL is more powerful, I still feel like the DS Lite was a more polished system. It's a real shame that it never got an XL variant keeping the GBA slot. You'd have to go on AliExpress and buy an ML shell to give a DS phat the unofficial "DS Lite" treatment, and that's the best we'll ever get I'm afraid.
    +1
  • Jayro @ Jayro:
    The phat model had amazingly loud speakers tho.
    +1
  • SylverReZ @ SylverReZ:
    @Jayro, I don't see whats so special about the DS ML, its just a DS lite in a phat shell. At least the phat model had louder speakers, whereas the lite has a much better screen.
    +1
  • SylverReZ @ SylverReZ:
    They probably said "Hey, why not we combine the two together and make a 'new' DS to sell".
  • Veho @ Veho:
    It's a DS Lite in a slightly bigger DS Lite shell.
    +1
  • Veho @ Veho:
    It's not a Nintendo / iQue official product, it's a 3rd party custom.
    +1
  • Veho @ Veho:
    Nothing special about it other than it's more comfortable than the Lite
    for people with beefy hands.
    +1
  • Jayro @ Jayro:
    I have yaoi anime hands, very lorge but slender.
  • Jayro @ Jayro:
    I'm Slenderman.
  • Veho @ Veho:
    I have hands.
    Veho @ Veho: +1