PS3 [TUTORIAL] Unlock up to 8% extra total space on the PS3 internal hard drive

Update: picard (a.k.a. 3141card) has released a homebrew app (available here) that changes the reserved space from 8% to 1% automatically. Running the app again will revert the changes.

https://mega.nz/file/zdk1lKqZ#aj4WFdOeosH_ncIB5flNtUxPs341PSYaXdLF2DdA45A

PS3 Unlock HDD Space by picard (aka 3141card)
All credits to einsteinx2 on psx-place.com for his great tutorial:
https://www.psx-place.com/threads/t...l-space-on-the-ps3-internal-hard-drive.20773/

HOWTO:
  • Install the package on your custom firmware PS3 and run it. It finds the active superblock of the gameOS partition and do the necessary patches. Usually 8 percent of the memory is reserved, the app sets this value to 1 percent.
  • The optimization value is set to 1, for minimize disk fragmentation.
  • The changes are permanent. The changed active superblock is written to the HDD with the system fs umount of the gameOS partition.
  • Running the app again restores the original values, if desired.

You use this app at your own risk! I am not responsible for any damage caused to your PS3 system!​

If my PS3 app was useful to you, I would be very happy about a donation :)
https://www.paypal.com/paypalme/3141card

picard (aka 3141card)

-- (Original Post Continued Below) --

Need some extra space on your internal PS3 HDD, if so then perhaps @einsteinx2 may have a genius method for unlocking upto 8% of space on your Internal HDD, while the space is more then likely allocated for performance reasons by Sony (use this guide at your own risk), some of this saved space could be considered overkill, as the creator of this method makes a valid point that some of this saved space on larger HDDs is more then some of the early model PS3 complete HDD size, so its likely some of that space allocation is a bit overkill on the part of Sony. einsteinx21 has provided a great tutorial found below explaining in detail about this recent discovery

-STLcardsWS


depositphotos_10075144-stock-photo-protected-hdd-chain-and-lock.jpg

Unlock up to 8% extra total space on the PS3 internal hard drive


  • The What

    By default, even on custom firmware, the PS3 reserves 8% of your total internal hard drive space. From my searching online, I don't believe anyone has ever successfully unlocked that wasted space, so I decided to give it a shot. Turns out not only is it possible, but it's relatively easy thanks to some existing tools created by the community. This guide will explain how to reclaim that wasted space by manually modifying the metadata of the UFS2 formatted GameOS partition using Linux, as well as the potential cons (primarily performance, though I haven't experienced any performance issues yet myself).

    I believe the pros outweigh the cons though, and have been using this now without issue on my personal PS3 with a 1.5TB drive for a few days now, installing tons of games without a hitch.

    The Why


    While external drives used with the PS3 are all FAT32 formatted (or NTFS if you have CFW), the GameOS partition on the internal hard drive is formatted using the UFS2 filesystem with a layer of encryption on top.

    Like other *nix file systems such as Ext2/3/4, UFS2 can reserve part of the drive's space to only be used by the system or the root user. This is to reduce fragmentation and also prevent the drive from completely filling up, possibly freezing the computer.

    By default, UFS2 reserves 8% of any drive's free space, in this case meaning it can't be used by the PS3 for installing games. This is why when you first install that shiny new 1.5TB hard drive you will see that not only is it only actually 1.36 TB because hard drive manufacturers really love counting in base 10, but you also lose another 111.4 GB.

    Now generally having this reserved space is not a bad thing, however the problem is that as drives grow larger, the amount of wasted space becomes larger than some of the smaller PS3's entire hard drives! Clearly that much isn't needed to prevent fragmentation.

    The tunefs documentation mentions that "the file system's ability to avoid fragmentation will be reduced when the total free space, including the reserve, drops below 15%. As free space approaches zero, throughput can degrade by up to a factor of three over the performance obtained at a 10% threshold." Note that these numbers are already higher than the 8% default that all UFS tools as well as Sony use. Also note that it says as free space drops to 0%, performance may be up to 3 times slower than normal. However, it's unclear whether that only affects newly written--presumably more fragmented files--or all files. It seems like this is a worthy tradeoff, especially since if you do notice any performance issues you can simply delete some games or other data to free up the space. By changing the minimum free space, performance is not changed at all unless you choose to fill the drive completely...but at least you can now make that choice.

    UFS2 supports two write optimization modes: time and space. Time optimization is the default--and is used by the PS3--and allows for faster writes at the expense of potentially higher fragmentation (though generally only as the drive reaches capacity). Since we're allowing ourselves to fill almost the entire drive, these instructions also change the optimization mode to space. That means that the filesystem will spend more time during writes to ensure the files are less fragmented, insinuating that it will shuffle blocks around to make contiguous space.

    The tunefs documentation says that "the file system can either try to minimize the time spent allocating blocks, or it can attempt to minimize the space fragmentation on the disk. Optimization for space has much higher overhead for file writes. The kernel normally changes the preference automatically as the percent fragmentation changes on the filesystem." However, since the PS3 uses a custom operating system and this documentation is from FreeBSD, I think it's best to manually set the space option anyway. I have not noticed any performance degradation so far since making this change, though I still have plenty of free space on my drive at the moment.

    Photos
    Here are the before and after photos. They were taken immediately before removing the drives and immediately after reinserting them.
    BEFORE
    160GB_drive_before.jpg
    AFTER
    160GB_drive_after.jpg
    BEFORE
    1.5TB_drive_before.jpg
    AFTER
    1.5TB_drive_after.jpg


  • The How

    While it's possible to mount a PS3 hard drive in Linux and view its decrypted partitions, unfortunately the tunefs.ufs tool doesn't appear to work. It always complains that it can't find the superblock. However, the file command does work fine to show the UFS2 filesystem info when tested on a dump of the start of the partition.

    So instead of using the tunefs utility to change the minimum free space and optimization type, I wrote a script to manually scan and test single byte changes to a dump of the partition's superblock using the file command until I found the correct locations to change.

    I tested this on 2 hard drives of vastly different sizes: 160 GB and 1.5 TB. On both drives, I found that the superblock was located in the same location--the standard 128 block aka 65,536 byte offset. I also found that the locations to set the minimum free space percentage and optimization type were in the same place on both drives--byte 65,599 and 65,667 respectively. However, I highly recommend running the find_ps3_ufs2_byte_locations script anyway just to confirm before making any changes to your drive.

    Once you know the correct offsets, changing the values is simple. To adjust the minimum free space, simply write the percent in hex to byte 65,599--e.g. for 1% free space write 0x01 or for the default 8% write 0x08. To change the optimization type, write a hex 0x01 to byte 65,667--the default is 0x00 for time optimization.

    I think this should be possible to do as a PS3 homebrew app so that it can just be done directly on the device without even removing the drive. Unfortunately I have zero experience with writing PS3 homebrew, but maybe someone else with more experience can use this information to do it. I'd love to see this as an option in the REBUG custom firmware settings.

    Instructions

    1. Dump your eid root key using IrisMan/MultiMan/etc
    2. Setup a computer or virtual machine with Ubuntu 16.04. The rest of these steps are done on that machine. I tested using Parallels on a MacBook Pro, but it should work on just about anything as well as other distros.
    3. Clone my repository: git clone https://github.com/einsteinx2/PS3-Reclaim-HDD-Space.git
    4. Change to the new directory as we'll do all of the work there: cd PS3-Reclaim-HDD-Space
    5. Rename your eid root key file to eid_root_key.bin and place it in the PS3-Reclaim-HDD-Space directory
    6. Generate your hdd keys: ./ps3hdd_keygen.sh
    7. Become root since most of this requires it: sudo -s
    8. Find the device name: fdisk -l (In my case, using an external USB enclosure, it was /dev/sdb)
    9. Make virtual byte swapped encrypted device
      1. If you have a drive 1TB or less (not confirmed the exact limit): ./makedev bswap16.512 /dev/sdb
      2. If you have a drive larger than 1TB (or maybe it's 1TB and larger, I don't have a 1TB drive to test): ./makedev bswap16.1024 /dev/sdb
    10. Create decrypted device: cryptsetup create -c aes-xts-plain64 -d ./hdd_key.bin -s 256 ps3hdd_crypt /dev/nbd0
    11. Map decrypted partitions: ./kpartx -a /dev/mapper/ps3hdd_crypt
    12. View decrypted partitions (ps3hdd_crypt2 is the UFS2 GameOS partition): ls -la /dev/mapper/
    13. View current free space: [ -d /mnt/PS3GameOS ] || mkdir /mnt/PS3GameOS && mount -t ufs -o ufstype=ufs2,ro /dev/mapper/ps3hdd_crypt2 /mnt/PS3GameOS && df -h | grep "Avail\|ps3hdd_crypt2" && umount /mnt/PS3GameOS
    14. Dump the superblock of the GameOS partition: dd if=/dev/mapper/ps3hdd_crypt2 bs=512 count=256 of=GameOS_superblock.img
    15. Confirm the seek values for the next 2 commands: ./find_ps3_ufs2_byte_locations GameOS_superblock.img
    16. Set minimum free space to 1%: printf '\x01' | dd of=/dev/mapper/ps3hdd_crypt2 bs=1 seek=65599 count=1 conv=notrunc
    17. Set optimization type to "space": printf '\x01' | dd of=/dev/mapper/ps3hdd_crypt2 bs=1 seek=65667 count=1 conv=notrunc
    18. View the now larger free space: mount -t ufs -o ufstype=ufs2,ro /dev/mapper/ps3hdd_crypt2 /mnt/PS3GameOS && df -h | grep "Avail\|ps3hdd_crypt2 && umount /mnt/PS3GameOS
    19. Disconnect device: kpartx -d /dev/mapper/ps3hdd_crypt && cryptsetup remove ps3hdd_crypt && ./stop-nbd0
    20. Pop the drive back in your PS3 and enjoy the extra space! Note that I left 1% reserved space rather than going all the way to 0% to ensure that the drive never completely fills up, as I'm unsure what problems that would cause for the PS3's operating system.

  • Source code

    For ease of use, this repo contains precompiled binaries for Ubuntu 16.04 64bit. If you need or prefer to compile yourself, here are the tools used:

    bswap16: https://github.com/sguerrini97/nbdcpp (note that for >1TB drives you must change <unsigned BS=512> to <unsigned BS=1024>)

    kpartx: https://git.opensvc.com/multipath-tools/.git/

    ps3hdd_keygen.sh: http://www.psx-place.com/threads/hdd-keys-generating-scripts.10610/page-2#post-125197


  • Credits

    I would never have figured this out if it weren't for others' hard work.

    Huge thanks to Berion at PSX-Place for the hdd key generation script as well as pointing me to the information on mounting a PS3 HDD in Linux. His post here contains the script and the link: http://www.psx-place.com/threads/hdd-keys-generating-scripts.10610/page-2#post-125197

    Huge thanks to sguerrini97 at Playstation Hax for implemnenting PS3 hard drive mounting support for modern Linux kernels. Here's the post about it: https://playstationhax.xyz/forums/topic/4671-mounting-ps3-hdd-on-newer-linux-kernels and the GitHub repo: https://github.com/sguerrini97/nbdcpp.

    Thanks to dsroche for writing the original nbdcpp implementation that sguerrini97 forked, and thanks to Glevand for the original work on mounting the PS3 hard drive in OtherOS and for the great information here on the PS3 dev wiki: http://www.psdevwiki.com/ps3/Mounting_HDD_on_PC. Also thanks to anyone else that worked on PS3 hard drive mounting or anything else I'm not aware of.

 
Last edited by a moderator:
I wasn't trying to create a new thread, just replying on this one. It seems that the problem is that I linked the nbdcpp's github and I am not allowed to post links.

you are a new user and your post are moderated for you first several post.

There is no restriction on posting links.
 
I've finally been able to run this. I used to get the "Requested offset is beyond real size of device /dev/nbd0", but not this time.

I used Ubuntu 16.04 installed in the same HDD than Windows. Didn't try any other device.
I updated the packages lists, but did not upgrade. I declined the updates Ubuntu notified me about and never ran apt-get upgrade. Note that this is a fresh install.

And finally, I compiled bswap16.512 myself. I think that is the key.
For anyone wishing to do so,
-First, open a new terminal window.
-Second, clone the nbdcpp github:
"git clone https://github.com/sguerrini97/nbdcpp" (without the apostrophes)
- Third, enter the nbdcpp directory:
"cd ./nbdcpp"

Note that for >1TB drives you must change <unsigned BS=512> to <unsigned BS=1024> in bswap16.cpp, which is inside the nbdcpp folder we just cloned.

-Fourth, compile the code with:
"sudo make -f Makefile"
-Fifth, move bswap16 (not the .cpp, the plain one) from the nbdcpp folder to the PS3-Reclaim-HDD-Space one.

-Sixth, rename it to bswap16.512 or bswap16.1024, depending on your drive size ( .1024 if >1tb HDD

-Seventh, profit :).
 
And finally, I compiled bswap16.512 myself. I think that is the key.

I thinking that the key is proper nbd-client version. Newest no longer works with bswap16 standalone.

Note that for >1TB drives you must change <unsigned BS=512> to <unsigned BS=1024> in bswap16.cpp, which is inside the nbdcpp folder we just cloned.

In nbd documentation there is recommendation to always using 1024.

rename it to bswap16.512 or bswap16.1024, depending on your drive size ( .1024 if >1tb HDD

I have fetish for file names so i prefer "bswap16 (64bit, 1024b, Mint 18.2).elf" (in my case). ;p
Really, filename doesn't matter. It is important only to properly invoke it in terminal (i.e with spaces, whole path must be closed in " symbols).
 
I thinking that the key is proper nbd-client version. Newest no longer works with bswap16 standalone.



In nbd documentation there is recommendation to always using 1024.



I have fetish for file names so i prefer "bswap16 (64bit, 1024b, Mint 18.2).elf" (in my case). ;p
Really, filename doesn't matter. It is important only to properly invoke it in terminal (i.e with spaces, whole path must be closed in " symbols).

As for the first two points, you are very likely to be right, since I didn't do much research beyond trying to compile it myself while I hadn't updated anything. As for the file name, I wanted my instructions to still be compatible with the original tutorial. You can really put anything if you then invoke the file correctly in the terminal
 
Petitboot is OtherOS "bootloader". I don't remember now, but probably must be installed first, and console boot mode must be set to OtherOS.
 
I have no idea how to install OtherOS stuff past fw v3.21/3.55 with OOS+.

Petitboot is not an application for GameOS, but binary blob written to "dev_flash4" (which have not any file system).
 
Sorry if someone mentioned it before
After doing this reduction of the free/wasted space from the factory 8% to 1%.... the firmware installations works normally ?... and the "restore filesystem" is completed normally too ?
 
Sorry if someone mentioned it before
After doing this reduction of the free/wasted space from the factory 8% to 1%.... the firmware installations works normally ?... and the "restore filesystem" is completed normally too ?
Everything works fine since it is related to the disk tables in a level above the OS layer. For the PS3 it is like nothing has changed.
 
That's question have sense because answer it is not so obvious. Depend if emerinit using fs which found or always create new if something is not standard. Lower free space preserve is definitely not standard for PS3. ;)
 
Everything works fine since it is related to the disk tables in a level above the OS layer. For the PS3 it is like nothing has changed.

Thats not so true pal. I got a problem with a seagate 1TB hdd that i modded with einys method. When i tried to update with rebug lite 4.86 CFW console freezes at 68 % (it freezes in secure mode too without any "waiting message" ) .
I apologyze if my english its not so fluent . its not my mother language and i seldom practice it
 
Thats not so true pal. I got a problem with a seagate 1TB hdd that i modded with einys method. When i tried to update with rebug lite 4.86 CFW console freezes at 68 % (it freezes in secure mode too without any "waiting message" ) .
I apologyze if my english its not so fluent . its not my mother language and i seldom practice it

I use a 2 TB HDD in my PS2 which I resized to 1.86 TB using this guide:

https://www.psx-place.com/threads/p...upgrade-formatting-utility.11989/#post-100471

The issue is the Restore File System doesn't work anymore so these kind of "hacks" or "workarounds" are not without any problems.
 
Last edited:
I use a 2 TB HDD in my PS2 which I resized to 1.86 TB using this guide:

http://www.psx-place.com/threads/ps3-1-75-tb-internal-hdd-upgrade-formatting-utility.11989/

The issue is the Restore File System doesn't work anymore so these kind of "hacks" or "workarounds" are not without any problems.

i appreciate the info but i dont want to lose all my ps3 isos . if i delete the partition table with low level format (wipe mbr /partition table) its enough to re-use that hdd to enter secure mode and to reformat it with new CFw (i dont want to do that ) . i just want to install cfw again if its posibble without the need of doing it all again.
 
I use a 2 TB HDD in my PS2 which I resized to 1.86 TB using this guide:

https://www.psx-place.com/threads/p...upgrade-formatting-utility.11989/#post-100471

The issue is the Restore File System doesn't work anymore so these kind of "hacks" or "workarounds" are not without any problems.
Is related but is a bit different matter
When we do a "restore filesystem" it seems the PS3 firmware reads the number of sectors (of either the whole hdd, or specific partitions)... then it makes some math calculations with the number of sectors and after it starts the "restore filesystem" process

If the hdd size is big then it triggers an error and the restore filesystem is not even initiated, in my oppinion it seems to happen because the math calculations about number of sectors returns some kind of error
In other words... the error is caused by an excesive amount of number of sectors


------------
But lets say we increase that free/wasted space from the factory 8% to 16%
As far i know nobody tryed it.. but im wondering if this change would allow to use hdds with big sizes (and still able to complete the "restore filesystem" successfully)

Actually... i wonder whats the purpose of that 8%... incase is used for the (temporal storage) of the data managed by the "restore filesytem" then by reducing the 8% to 1% we are breaking the "restore filesystem" completly



-------------
What i dont get is why eruil is having that problem at 68% when trying to install a new firmware, not sure if this happened to other people
 
Last edited:
Is related but is a bit different matter
When we do a "restore filesystem" it seems the PS3 firmware reads the number of sectors (of either the whole hdd, or specific partitions)... then it makes some math calculations with the number of sectors and after it starts the "restore filesystem" process

If the hdd size is big then it triggers an error and the restore filesystem is not even initiated, in my oppinion it seems to happen because the math calculations about number of sectors returns some kind of error
In other words... the error is caused by an excesive amount of number of sectors


------------
But lets say we increase that free/wasted space from the factory 8% to 16%
As far i know nobody tryed it.. but im wondering if this change would allow to use hdds with big sizes (and still able to complete the "restore filesystem" successfully)

Actually... i wonder whats the purpose of that 8%... incase is used for the (temporal storage) of the data managed by the "restore filesytem" then by reducing the 8% to 1% we are breaking the "restore filesystem" completly



-------------
What i dont get is why eruil is having that problem at 68% when trying to install a new firmware, not sure if this happened to other people

well at least it stays as precedent if it happens to anybody else . :D
 
i appreciate the info but i dont want to lose all my ps3 isos . if i delete the partition table with low level format (wipe mbr /partition table) its enough to re-use that hdd to enter secure mode and to reformat it with new CFw (i dont want to do that ) . i just want to install cfw again if its posibble without the need of doing it all again.
As you already have modded your hdd, then you'll be able to mount it to the PC, backup the data you need and then reformat it in the PS3 recovery mode.
 

Featured content

Trending content

Latest posts

Back
Top