I've been thinking some more on this, and reading through the discussion on write access to the UFS filesystem on the past couple of pages. I started to think why get it working on Linux when FreeBSD supports it natively; why not just decrypt the drive on a Linux system, and then pass the device through to a FreeBSD VM.
The first issue is that the PS3s PowerPC is big-endian, and so a x86 FreeBSD VM cannot read the big-endian formatted dev_hdd0. But with qemu we can configure the VM to emulate a PowerPC system, so now we can pass the device through to a big-endian system which should be able to natively read the drive.
And sure enough it works!
I decrypt the device in Linux, I then directly pass the device (/dev/mapper/ps3hdd2 - I have a Slim) through to the qemu PowerPC FreeBSD VM, and then mount the device within FreeBSD. Write access to dev_hdd0 natively works.
Code:
root@:~ # file -s /dev/vtbd0
/dev/vtbd0: Unix Fast File system [v2] (big-endian) last mounted on /cell_mw_cfs, last written at Fri Nov 3 16:32:49 2023, clean flag 0, readonly flag 0, number of blocks 311386280, number of data blocks 301585654, number of cylinder groups 3311, block size 16384, fragment size 2048, average file size 16384, average number of files in dir 64, pending blocks to free 0, pending inodes to free 0, system-wide uuid 0, minimum percentage of free blocks 8, TIME optimization
Note the last written date time is Fri Nov 3 16:32:49 2023 - so the PS3 has made no attempt to fixing the drive when I've booted it since then.
Given the suspected corruption that my drive has, I was able to run fsck on it...
Code:
root@:~ # fsck -y /dev/vtbd0
** /dev/vtbd0
** Last Mounted on /cell_mw_cfs
** Phase 1 - Check Blocks and Sizes
** Phase 2 - Check Pathnames
UPDATE FILESYSTEM TO TRACK DIRECTORY DEPTH? yes
** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts
** Phase 5 - Check Cyl groups
FREE BLK COUNT(S) WRONG IN SUPERBLK
SALVAGE? yes
SUMMARY INFORMATION BAD
SALVAGE? yes
BLK(S) MISSING IN BIT MAPS
SALVAGE? yes
394087 files, 259173843 used, 42411811 free (69523 frags, 5292786 blocks, 0.0% fragmentation)
***** FILE SYSTEM MARKED CLEAN *****
***** FILE SYSTEM WAS MODIFIED *****
It worked!! The PS3 booted up perfectly, and didn't complain of any disk corruption.
Give me some time and I'll write up the commands I used to boot qemu and pass the device through, and the pre-built FreeBSD image I used.
For reference this is my configuration:
Code:
Windows 11 host
PS3 drive connected to USB SATA
│
└── Linux Mint VM (VMware Workstation)
│
Entire PS3 drive is passed through to VM
/dev/mapper/ps3hdd is created
│
└── FreeBSD VM (qemu-system-ppc64)
|
/dev/mapper/ps3hdd2 is passed through to VM
Read/Write access is natively available
I notice that reserving %8 of free space seems to be a feature of the file system, so presumably there is a native way of changing this now that write access is possible.