PS3 [Tutorial] HDD mounting and decryption on Linux

@oleguer
You must compile bswap16-ecb only if You using different kernel than default one (4.15.0-54) in Linux Mint 19.2. If You using this distribution and didn't perform kernel update (like i.e using as LiveDVD/USB) then only what is left is to load it to memory as I already compile it and attach in the archive. *.ko is a compiled binary, like i.e *.dll for Windows. ;)

If You using other kernel version, then You must unpack archive with source too, run terminal, go to path with source (i.e "cd `/home/mint/bswap16-ecb v1.1/source/`") and type "sudo make" to start compilation. It can fail if in the distro missing additional apps, but then You get error message which points You what is missing, which You must in such case install it ("sudo apt install appnameexample") and again trying to compile And that's exactly the reason why I already compiled it, to safe headache none technical peoples as much as possible. ;)

PS: Forget about bswap16 for nbd client and dmbswap16, because both are now obsolete and even doesn't work with current nbd-client and kernel.

To know which kernel You using, You can type in terminal "sudo uname -r" or go in update manager kernel (current used will have mark near the name).

Oh, and after compilation or just unpacking binary, You also must tell system to allow him to run it. On Mint is sufficient to click on right mouse button, then specification, then check the checkbox read and execute for Your current user just like on the screenshot in tutorial (in terminal, go to module and type "chmod +x bswap16.ko" (if target filename contain spaces, You must close whole in " or ` symbols in both sides ;])).
 
Last edited:
I use "sudo uname -r" and well (like you) the version is 4.15.0-54-generic this is I need?? I can "jump" the step 6 and continue?? thanks berion!!
 
Yes, You don't need to compile it. Just name it "bswap16.ko", place in "/home/<Your user name>/ps3/" and change permissions to allow it execute (because Linux don't allow run any app just like that, this is one of the important differences between Windows and *nix operating systems).

Of course for You, this is from live session when in live user is named "mint". "Read" and "Execute" are mandatory for at least both You and root:

file_atb.png


- - -

BTW: You have mentioned in other thread that You using VMWare. Did You expose drives to virtual machine? In other way virtualised Linux will not see PS3 HDD.

And another warning: DON'T agree for Windows ask to "initialize HDD" or it will overwrite partition table and You will end as reader of my another tutorial. :D
 
Last edited:
Yes, I know under windows I need exit with secure, and when windows exit vmware run them like a linux disk.
I continue now! ^^ thank you!!

Fail! when I try (I change the directory and run) "sudo make bswap16.ko" linux say make cant do anything for 'bswap16.ko'.....why?? ((my linux knowledge is 0, sorry))
 
Last edited:

Because what You did tell him have no sense. :P

"Sudo" means "super user do", which means do as administrator. "Make" is app which looking for make script and do what is written in that script. I have tell You that You don't need compile anything (especially trying "compiling binary from binary" ;p).

So just go to no.7 and remember to chose Your console type. It is extremely important.
 
ok, """^^ sorry (I try to repear the step 6 and I need jump them) I continue with the tutorial and fail in step 3 (of "hardpart")

""cryptsetup create -c bswap16-ecb -d / dev / zero ps3hdd-bs / dev / sdx""
(I have mount the disk like sdb with external box)
(I load bswap16 "insmod '/home/mint/ps3/bswap16.ko") but I cant mount the ps3 hdd.... ((where is ps3hdd-bs?? I Think "^^))
<code> root@cristian-virtual-machine:/home/cristian/PS3HD# cryptsetup create -c bswap16-ecb -d /dev /zero ps3hdd-bs /dev/sdb
El dispositivo ps3hdd-bs no existe o se ha denegado el acceso. ((Code is on spanish access denied ps3hdd-bs dont exist))
</code>


P.S. I only want unlock the 8% of hdd on my 1.5tb internal HDD (I format the hdd previously for this reason I dont have data (I think with my knowledge I loose my data....for this reason I format the ps3)
P.S.2! If its possible "^-^ (I dont know! but I like think yes!) I want to format & encrypt my new internal hdd of 5tb using the pc to copy content of my other hdd (1.5tb) estructure, dev flash partitions, ufs byte locations, etc and resize the dev_hdd0 (to expand of all hdd size) you think it is possible?? This is my objective (in case has possible I equip the ps3 with 5tb internal and if not possible with 1.5tb with 8% unlock)
 
Last edited:
There is no need to sorry. That's not kind of knowledge which comes just by intuition for most of the peoples. I don't help You because I want help You in Your goal, but because I want You to learn something. ;)

First, before You start doing anything in terminal, type "sudo su". This will "switch" You to root user, otherwise, to almost every command, You must put sudo on start (which is annoying isn't?), and maybe You forgot about it, and that's why You don't have. Just guessing. So in summary, do "sudo su" once or add "sudo" to each command later. Choice is Yours.

Isn't Your user is named "cristian-virtual-machine"? ;) If yes, then correct the lines. "/home/<user name>/" is like in Windows "C:\Users\<user name>\". So You didn't load this module into memory because it didn't found it, because such place doesn't exist. And You didn't create mapper because module crypto which cryptosetup ask wasn't found.

Another thing is, if You put every stuff in folder "PS3HD", You must also correct all the line from "ps3" to "PS3HD" for the same reason as earlier.

Computers doesn't read in Your mind, they doesn't thinking, they are just tools, just only a little more complicated than hammer. ;)
 
I know a little part of you need say to me! but when I read the command
"cryptsetup create -c bswap16-ecb -d / dev / zero ps3hdd-bs / dev / sdx "
I only understand the /dev/sdx (sdb in my case as the hdd)

I think "bswap16-ecb" can be the folder of my bswap16-ecb (for this reason I think the structure is /home/cristian/PS3HD/bswap16-ecb/ (I begin on this folder for this reason I think no need all route but I dont know...)

but all other sintax and commands I dont know what I need for this reason I cant write my command well #_# (linux overdose xD)

First Try!
cristian@cristian-virtual-machine:~/PS3HD$ sudo su
[sudo] contraseña para cristian:
root@cristian-virtual-machine:/home/cristian/PS3HD# insmod '/home/cristian/PS3HD/bswap16.ko
> cryptsetup create -c PS3HD -d / dev / zero ps3hdd-bs / dev / sdb
> cryptsetup create -c aes-xts-plain64 -d /home/cristian/PS3HD/ata_key.bin -s 256 ps3hdd / dev /sdb / ps3hdd-bs
> kpartx -a / dev /sdb / ps3hdd
> ls -la /dev/sdb / mapper

What is the sintax fails?? because if you read you know..... but I only catch two or three things..... Thank you show much @Berion! For your patience!! ((It's hard because I dont know much....but I try and try (my first thing I do is format because I know the hdd dont be success ""^^))
 
Last edited:
cryptsetup is a program for creating mappers (let's say, that they are virtual devices). "create" telling him that You want... create one. ;) "-c" telling that You want use some math on source device (/dev/sdx) and "bswap16-ecb" is not a file as You probably think but algorithm name which bswap16-ecb v1.0 or 1.1 "serve". "-d" telling that You want specify encryption/decryption key, which in this case is just zeroes (and Linux by default have some virtual devices as source of some data (zeroes, random, pseudorandom etc)). "ps3hdd-bs" is mapper created "after maths" on "/dev/sdx".

You can choose different name if You want, i.e Conchita. ;p I chose "ps3hdd-bs" because it is IMO informative ("byte swapped PS3 HDD"), just like later "ps3hdd" (which is decrypted and in proper order data of PS3 HDD). After that, all mappers will be listed as devices in i.e "/dev/mapper/Conchita-Whatever" or "/dev/mapper/Abella". "dev/sdb" in Your case is only a source device to performing several mathematical operation on the fly and mapper are i.e representation of each of one.

https://linux.die.net/man/8/cryptsetup

The whole reason of bswap16 is to change byte order from Big Endian to Little Endian because x86 works on LE. Without this problem, You could just create mapper with data decryption, but because of that, You must first transform data stream. Two older solutions doing the same thing but with different methods. dmbswap16 was also kernel module but doesn't provide any crypto service, however it stops works in time around kernel 4.x. Next approach was merging this with network block device server and connect to it on the same device. This stops works with newest nbd-client and no one know why.


BTW: The main reason why I choose bswap16-ecb is because:
- works in live environment, so no installation required
- doesn't need any additional apps
- compiled version will always works with one of the most popular Linux distributions
- even if module stops working/compiling on newer kernel, then user can just find old Linux and just booting it without worrying about fade out repositories or checking thousands of versions of dependant apps/libs/etc.

So this solution will works as long as this default kernel in this Linux Mint 19.2 support Your hardware (or VM support this Linux) and as long as You have this specific distribution. Before, just no one care about it and I brings to You all, flame from the Olimp. Well, with some help of great minds which wrote those stuff in the first place of course. :D
 

Attachments

Last edited:
Finally I'm lost! I think I will never got this.... I will try another time but I lose the hope.... because I dont know what I do....and dont know what I need.... for this reason I think this is imposible for me.....Thanks for all your time @Berion but I think I need step by step (comand by comand) tutorial..... and your tutorial try to connect the hdd and my intention is only unlock the 8% and try format new other hdd to plug & play in ps3 (("no one can do this.....and obiously, I can't do this...)) Thanks for your help I will try again but not today.....today I desist #_#*'*'
 
1. expose PS3 HDD to VM (I assumed it will be "/dev/sdb" but You must check Yourself)
2. add execute attribute to all scripts (*.sh) and *.ko
3. generate ata key using keygen script for Your PS3 model
4. if Your PS3 model is Slim, do:
Code:
sudo su
insmod "/home/mint/ps3/bswap16-ecb v1.1/bswap16-ecb v1.0 (for 4.15.0-54-generic).ko"
cryptsetup create -c bswap16-ecb -d /dev/zero ps3hdd-bs /dev/sdb
cryptsetup create -c aes-xts-plain64 -d /home/mint/ps3/ata_key.bin -s 256 ps3hdd /dev/mapper/ps3hdd-bs
kpartx -a /dev/mapper/ps3hdd
dd if=/dev/mapper/ps3hdd2 of=/home/mint/ps3/superblock.img bs=512 count=256
`/home/mint/ps3/find_ps3_ufs2_byte_locations.sh superblock.img`
printf '\x01' | dd of=/dev/mapper/ps3hdd2 bs=1 seek=65599 count=1 conv=notrunc
printf '\x01' | dd of=/dev/mapper/ps3hdd2 bs=1 seek=65667 count=1 conv=notrunc
kpartx -d /dev/mapper/ps3hdd
cryptsetup remove ps3hdd
cryptsetup remove ps3hdd-bs
rmmod bswap16
exit
exit

Sanity checks after You created all mappers:
  • Type "lsblk /dev/sdb". You should see both mappers under sdb, if not then You didn't created them for some reason (You will get error message and this is Your reason).
  • Type "hexdump -C /dev/mapper/ps3hdd | head -8". You should see mostly zeroes and some funny text (DEAD FACE FACE 0FF0), if not, You didn't decrypted (ERK wasn't Yours, wrong key generated, or wrong model algorithm chose).
 
Last edited:
Thanks @Berion if I do this I know all credits is for you!!
(yes my ps3 model is slim, my ERK are mine and I have virtual machine with vmware and your linux recomendation of tutorial)
One question....when I finally (I think finally I can with your help) map the drive on linux what I need do to unlock the 8% of extra space??? (this is my intention..... unlock the space ^^)
 
Code:
sudo su
insmod "/home/mint/ps3/bswap16-ecb v1.1/bswap16-ecb v1.0 (for 4.15.0-54-generic).ko"
cryptsetup create -c bswap16-ecb -d /dev/zero ps3hdd-bs /dev/sdb
cryptsetup create -c aes-xts-plain64 -d /home/mint/ps3/ata_key.bin -s 256 ps3hdd /dev/mapper/ps3hdd-bs
kpartx -a /dev/mapper/ps3hdd
dd if=/dev/mapper/ps3hdd2 of=/home/mint/ps3/superblock.img bs=512 count=256
`/home/mint/ps3/find_ps3_ufs2_byte_locations.sh superblock.img`
printf '\x01' | dd of=/dev/mapper/ps3hdd2 bs=1 seek=65599 count=1 conv=notrunc
printf '\x01' | dd of=/dev/mapper/ps3hdd2 bs=1 seek=65667 count=1 conv=notrunc
kpartx -d /dev/mapper/ps3hdd
cryptsetup remove ps3hdd
cryptsetup remove ps3hdd-bs
rmmod bswap16
exit
exit

Today I try again @Berion and I cant do this! -_-'''
When I try
insmod "/home/mint/ps3/bswap16-ecb v1.1/bswap16-ecb v1.0 (for 4.15.0-54-generic).ko"
Only have
Code:
root@cristian-virtual-machine:/home/cristian/PS3HD# insmod '/home/cristian/PS3HD/bswap16/bswap16-ecbv1.1.ko'
insmod: ERROR: could not insert module /home/cristian/PS3HD/bswap16/bswap16-ecbv1.1.ko: Invalid module format
(I only change my directory (try with ' ' and " " and without) of the file and I change the permisions on the file)
And try your sanity check of HDD and obtain this
Code:
root@cristian-virtual-machine:/home/cristian/PS3HD# lsblk /dev/sdb
NAME MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sdb  8:16  0  1,4T  0 disk

What I do wrong?? I will try, and try and try (if you help me) to sucess this tutorial!! Thank you for your patience!!
 
You cannot load v1.1 because it is for different kernel (the one in Mint 19.3). You have 19.2, so use v1.0 instead and should load fine. In source archive there is v1.1 but compiled *.ko is v1.0, You probably took the last one which I attached few posts above (it is not for Your kernel ;]).

And BTW: All lines You must doing one by one, if one doesn't succeed, there is no reason to do the rest as they depending on all before. As I said those "sanity checks" are to type AFTER mappers creating, while You aren't even load module yet to create first mapper in further line. ;)
 
@Berion I try again And I make new virtual machine with linux mint 19.3 and I make the same directories like you..... and fail again >.<""
This is the code I do (I think the fail is because my hdd is 1.5tb and your code is for another disk space code)
Code:
mint@mint:~/ps3$ sudo su
root@mint:/home/mint/ps3# insmod "/home/mint/ps3/bswap16-ecbv1.1.ko"  ***this is your update package***
root@mint:/home/mint/ps3# lsblk
NAME  MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
loop0  7:0  0  1.8G  1 loop /rofs
sda  8:0  0  20G  0 disk 
sdb  8:16  0  1.4T  0 disk 
sr0  11:0  1  1.9G  0 rom  /cdrom
root@mint:/home/mint/ps3# cryptsetup create -c bswap16-ecb -d /dev/zero ps3hdd-bs /dev/sdb
root@mint:/home/mint/ps3# cryptsetup create -c aes-xts-plain64 -d /home/mint/ps3/ata_key.bin -s 256 ps3hdd /dev/mapper/ps3hdd-bs
root@mint:/home/mint/ps3# kpartx -a /dev/mapper/ps3hdd
root@mint:/home/mint/ps3# dd if=/dev/mapper/ps3hdd2 of=/home/mint/ps3/superblock.img bs=512 count=256
256+0 records in
256+0 records out
131072 bytes (131 kB, 128 KiB) copied, 0.286633 s, 457 kB/s
root@mint:/home/mint/ps3# `/home/mint/ps3/find_ps3_ufs2_byte_locations.sh superblock.img`
Checking: command not found
root@mint:/home/mint/ps3#
Thanks for your help!! I go one step more today Finally I think I can do it! *with your help! Thanks again! :)
 
Hi berion! I try another time! and cant do it! this is the code! Thanks for your help!
Code:
root@mint:/home/mint/ps3# insmod "/home/mint/ps3/bswap16-ecb.ko"
root@mint:/home/mint/ps3# lsblk
NAME  MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
loop0  7:0  0  1.8G  1 loop /rofs
sda  8:0  0 119.2G  0 disk
├─sda1  8:1  0  100M  0 part
├─sda2  8:2  0  16M  0 part
├─sda3  8:3  0 118.6G  0 part
└─sda4  8:4  0  518M  0 part
sdb  8:16  0  1.8T  0 disk
└─sdb1  8:17  0  1.8T  0 part
sdc  8:32  1  125G  0 disk
└─sdc1  8:33  1  125G  0 part /cdrom
sdd  8:48  0  1.4T  0 disk (((PS3HDD)))
sr0  11:0  1  1024M  0 rom 
root@mint:/home/mint/ps3# cryptsetup create -c bswap16-ecb -d /dev/zero ps3hdd-bs /dev/sdd
root@mint:/home/mint/ps3# cryptsetup create -c aes-xts-plain64 -d /home/mint/ps3/ata_key.bin -s 256 ps3hdd /dev/mapper/ps3hdd-bs
root@mint:/home/mint/ps3# kpartx -a /dev/mapper/ps3hdd
root@mint:/home/mint/ps3# dd if=/dev/mapper/ps3hdd2 of=/home/mint/ps3/superblock.img (I think the fail is this file!) bs=512 count=256
256+0 records in
256+0 records out
131072 bytes (131 kB, 128 KiB) copied, 0.0122572 s, 10.7 MB/s
root@mint:/home/mint/ps3# `/home/mint/ps3/find_ps3_ufs2_byte_locations.sh superblock.img`
Checking: command not found# 
root@mint:/home/mint/ps3# lsblk
NAME  MAJ:MIN RM  SIZE RO TYPE  MOUNTPOINT
loop0  7:0  0  1.8G  1 loop  /rofs
sda  8:0  0 119.2G  0 disk 
├─sda1  8:1  0  100M  0 part 
├─sda2  8:2  0  16M  0 part 
├─sda3  8:3  0 118.6G  0 part 
└─sda4  8:4  0  518M  0 part 
sdb  8:16  0  1.8T  0 disk 
└─sdb1  8:17  0  1.8T  0 part 
sdc  8:32  1  125G  0 disk 
└─sdc1  8:33  1  125G  0 part  /cdrom
sdd  8:48  0  1.4T  0 disk 
└─ps3hdd-bs  253:0  0  1.4T  0 crypt
  └─ps3hdd  253:1  0  1.4T  0 crypt
  ├─ps3hdd1 253:2  0  256M  0 part 
  ├─ps3hdd2 253:3  0  1.4T  0 part 
  └─ps3hdd3 253:4  0  2G  0 part 
sr0  11:0  1  1024M  0 rom
 
@oleguer You did the same as earlier and I must say the same: You didn't run "find_ps3_ufs_byte_locations.sh" for reason You must figure out. Probably lack of permissions as I also said.

Hmm... try this:
sh `/home/mint/ps3/find_ps3_ufs2_byte_locations.sh superblock.img`

Everything else seems be ok. Which means You have created decrypted mappers and made superblock image from GameOs partition.

BTW: Keep backup of superblock because if something goes wrong, You will need restore it (or You will end with need of formatting HDD). So do not use "dd" on "/dev/mapper/ps3hdd2" AFTER You unlock additional space because it will overwrite original by modified. ;) In other words, make copy of it now or just rename this file (i.e to "superblock_original.img").
 
Last edited:

Similar threads

Back
Top