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
  • BakerMan @ BakerMan:
    Update: Turns out he's epileptic
  • K3Nv2 @ K3Nv2:
    Get a 2nd opinion run mris etc they told me that also
  • Psionic Roshambo @ Psionic Roshambo:
    Also a food allergy study would be a good idea
  • K3Nv2 @ K3Nv2:
    Turns out you can't sprinkle methamphetamine on McDonald's French fries
    +1
  • ZeroT21 @ ZeroT21:
    they wouldn't be called french fries at that point
    +1
  • ZeroT21 @ ZeroT21:
    Probably just meth fries
    +1
  • K3Nv2 @ K3Nv2:
    White fries hold up
    +1
  • The Real Jdbye @ The Real Jdbye:
    @K3Nv2 sure you can
  • BakerMan @ BakerMan:
    why tf do people hate android users? is it the video quality? just because "AnDrOiD = pOoR" bc they don't cost an arm and a leg like iphones do?
    +1
  • BakerMan @ BakerMan:
    i won't be turned off by an iphone, but don't pick on me for having an android, that's just how this shit should work
  • ZeroT21 @ ZeroT21:
    Should say more what these kind of android users say bout nokia 3310 users
  • BigOnYa @ BigOnYa:
    I've owned both iPhone and Androids over the years. Both are just as good, other than Apples higher price. I'm currently on Android, Samsung S21 I think, and very happy with it.
  • K3Nv2 @ K3Nv2:
    Got my 60 minute steps in whew
    +2
  • BigOnYa @ BigOnYa:
    I get mine in everyday, going back n forth to the fridge for a beer.
    +1
  • K3Nv2 @ K3Nv2:
    6,000 steps in so far legs almost broke getting off
    +1
  • K3Nv2 @ K3Nv2:
    Your mind gets in a werid pattern of just finishing then when you're done you're like I need a soda
  • BigOnYa @ BigOnYa:
    You get a "walkers" high?
  • K3Nv2 @ K3Nv2:
    Not really I just use to love building up a sweat
  • BigOnYa @ BigOnYa:
    Funny, that's what uremum always says
  • K3Nv2 @ K3Nv2:
    Yeah and people that take viagra think they have a big dick
  • K3Nv2 @ K3Nv2:
    You cant fix one insult edit for another edit you pog
  • BigOnYa @ BigOnYa:
    Nuh I'm on my tablet n it always auto corrects me
  • K3Nv2 @ K3Nv2:
    Heorin and uremum do have close quarters
    K3Nv2 @ K3Nv2: Heorin and uremum do have close quarters