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

TehCheez

Well-Known Member
OP
Newcomer
Joined
Dec 18, 2014
Messages
50
Trophies
0
Age
33
XP
182
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?
 

shadowofdarkness

Well-Known Member
Member
Joined
Apr 17, 2007
Messages
536
Trophies
1
XP
2,261
Country
Canada
Your nand image is encrypted doesn't matter if it is empty and zeroed out. It will not be zeros that you are compressing.
The encryption would be bad of it was as them people world be able to tell where actual data was in the image.
 
  • Like
Reactions: chippy

ghjfdtg

Well-Known Member
Member
Joined
Jul 13, 2014
Messages
1,362
Trophies
1
XP
3,291
Country
Data is not actually deleted but marked as deleted. It remains in the partitions lowering the compression ratio. Only way is to clean it up by zeroing out and reformatting them.
 

gg11

Member
Newcomer
Joined
Jan 7, 2019
Messages
10
Trophies
0
XP
67
Country
Belgium
When you perform a console "reset", it only resets the settings to stock settings, delete some files in the filesystems inside, but like on a computer when you delete a file, the underlying "dirty" block" (eg old data) are not erased. Only a full reformat of the filesystems would really clear the old block. It's not done by the factory reset.
So when you try to compress the dump, you try to compress all the old blocks of the previous owner as well...

Maybe with hactool memloader, you could backup the files, and rebuild a clean empty filesystem ?
 

chippy

Well-Known Member
Member
Joined
Dec 21, 2017
Messages
321
Trophies
0
Age
124
XP
967
Country
Australia
Ok everyone, your all for getting that the nand is encrypted. Meaning all data (blank or not) is random crap so people can't see what's in the data. The blank space is encrypted too so people can't see where in the drive (nand in this case) is the real data for them to focus on decrypting.
It's the luck of the draw on how small your nand will compress using the same tools and same settings.
You have the SAME chance of the nand to compress worse when you delete something (actully 0ing out the space) then putting something onto the nand because it's encrypted
 

wurstpistole

GBAtemp MVP
Member
Joined
Nov 19, 2015
Messages
4,654
Trophies
1
XP
5,419
Country
United Kingdom
whether your nand is full or empty it occupies the same amount of space
No. When nothing is installed, it should be around 2 to 2.5gb or around that ballpark.
Incorrect, the data is still "zero" if it's nothing written. My brand new Switch I managed to get down to 12gb from 32gb with 7zip LMZA2 compression.
I have stuff installed and the backup is around 4gb compressed. You can get way better than 12gb.
Your nand image is encrypted doesn't matter if it is empty and zeroed out. It will not be zeros that you are compressing.
The encryption would be bad of it was as them people world be able to tell where actual data was in the image.
Of course it matters, hence the huge compression that is possible
 

linuxares

The inadequate, autocratic beast!
Global Moderator
Joined
Aug 5, 2007
Messages
13,329
Trophies
2
XP
18,207
Country
Sweden
No. When nothing is installed, it should be around 2 to 2.5gb or around that ballpark.

I have stuff installed and the backup is around 4gb compressed. You can get way better than 12gb.

Of course it matters, hence the huge compression that is possible
I noticed I f-ed up. It wasn't my brand new Switch, it was my original Switch it was from... DERP!
 

shadowofdarkness

Well-Known Member
Member
Joined
Apr 17, 2007
Messages
536
Trophies
1
XP
2,261
Country
Canada
Of course it matters, hence the huge compression that is possible

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.
 
  • Like
Reactions: chippy

hippy dave

BBMB
Member
Joined
Apr 30, 2012
Messages
9,884
Trophies
2
XP
29,290
Country
United Kingdom
Someone posted instructions to zero out the empty portions of a nand image, to make it compress like it was new. I don't remember what thread it was in tho, and not sure what you should search for, but look around if you're particularly keen.
 

TehCheez

Well-Known Member
OP
Newcomer
Joined
Dec 18, 2014
Messages
50
Trophies
0
Age
33
XP
182
Country
United States
When you perform a console "reset", it only resets the settings to stock settings, delete some files in the filesystems inside, but like on a computer when you delete a file, the underlying "dirty" block" (eg old data) are not erased. Only a full reformat of the filesystems would really clear the old block. It's not done by the factory reset.
So when you try to compress the dump, you try to compress all the old blocks of the previous owner as well...

Maybe with hactool memloader, you could backup the files, and rebuild a clean empty filesystem ?

This makes sense, I was thinking that might have something to do with it. I may look into using hactool in the future but that'll have to be when I've got a free weekend or something. Even tho both my backups are taking up roughly 60gb, I've got backups and that's what's important.

Someone posted instructions to zero out the empty portions of a nand image, to make it compress like it was new. I don't remember what thread it was in tho, and not sure what you should search for, but look around if you're particularly keen.

@gg11 mentioned what tool to use for it. I may look into it in the future.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • Xdqwerty @ Xdqwerty:
    good night
  • BakerMan @ BakerMan:
    as to you
  • K3Nv2 @ K3Nv2:
    How do you know if the night will be good when you're asleep
  • BakerMan @ BakerMan:
    because i didn't say i was asleep
  • BakerMan @ BakerMan:
    i said i was sleeping...
  • BakerMan @ BakerMan:
    sleeping with uremum
  • K3Nv2 @ K3Nv2:
    Even my mum slept on that uremum
  • TwoSpikedHands @ TwoSpikedHands:
    yall im torn... ive been hacking away at tales of phantasia GBA (the USA version) and have so many documents of reverse engineering i've done
  • TwoSpikedHands @ TwoSpikedHands:
    I just found out that the EU version is better in literally every way, better sound quality, better lighting, and there's even a patch someone made to make the text look nicer
  • TwoSpikedHands @ TwoSpikedHands:
    Do I restart now using what i've learned on the EU version since it's a better overall experience? or do I continue with the US version since that is what ive been using, and if someone decides to play my hack, it would most likely be that version?
  • Sicklyboy @ Sicklyboy:
    @TwoSpikedHands, I'll preface this with the fact that I know nothing about the game, but, I think it depends on what your goals are. Are you trying to make a definitive version of the game? You may want to refocus your efforts on the EU version then. Or, are you trying to make a better US version? In which case, the only way to make a better US version is to keep on plugging away at that one ;)
  • Sicklyboy @ Sicklyboy:
    I'm not familiar with the technicalities of the differences between the two versions, but I'm wondering if at least some of those differences are things that you could port over to the US version in your patch without having to include copyrighted assets from the EU version
  • TwoSpikedHands @ TwoSpikedHands:
    @Sicklyboy I am wanting to fully change the game and bend it to my will lol. I would like to eventually have the ability to add more characters, enemies, even have a completely different story if i wanted. I already have the ability to change the tilemaps in the US version, so I can basically make my own map and warp to it in game - so I'm pretty far into it!
  • TwoSpikedHands @ TwoSpikedHands:
    I really would like to make a hack that I would enjoy playing, and maybe other people would too. swapping to the EU version would also mean my US friends could not legally play it
  • TwoSpikedHands @ TwoSpikedHands:
    I am definitely considering porting over some of the EU features without using the actual ROM itself, tbh that would probably be the best way to go about it... but i'm sad that the voice acting is so.... not good on the US version. May not be a way around that though
  • TwoSpikedHands @ TwoSpikedHands:
    I appreciate the insight!
  • The Real Jdbye @ The Real Jdbye:
    @TwoSpikedHands just switch, all the knowledge you learned still applies and most of the code and assets should be the same anyway
  • The Real Jdbye @ The Real Jdbye:
    and realistically they wouldn't

    be able to play it legally anyway since they need a ROM and they probably don't have the means to dump it themselves
  • The Real Jdbye @ The Real Jdbye:
    why the shit does the shitbox randomly insert newlines in my messages
  • Veho @ Veho:
    It does that when I edit a post.
  • Veho @ Veho:
    It inserts a newline in a random spot.
  • The Real Jdbye @ The Real Jdbye:
    never had that i don't think
    The Real Jdbye @ The Real Jdbye: never had that i don't think