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,308
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
    Psionic Roshambo @ Psionic Roshambo: Trans Former, women and men who used to be the other sex! Autoerotic asphyxiation bdsm is fun at...