Resizing VFLASH Storage Device

From PS3 Developer wiki
Jump to navigation Jump to search

Introduction

I tried first to remove GameOS HDD region, then created a smaller one and used the free space to create one new HDD region for Linux. But every time i did it, OFW removed it again at the next boot and reformatted the HDD. So i decided to use VFLASH because GameOS doesn't touch it.

VFLASH is a virtual device, as the name already suggests. VFLASH is the region #1 on the HDD of PS3. By default, VFLASH is only 256 MB. And it has one free region, region #7, which is currently not used by HV or GameOS.

HV hides VFLASH HDD region from LPAR 2 and it doesn't see it.

First, i resized the VFLASH. By doing this, you will loose your data on HDD but NOT on VFLASH !!! VFLASH data remains untouched. Resizing VFLASH doesn't cause corruption of data already installed there !!! So backup your GameOS data from UFS2 partition before you will do it.

After resizing VFLASH, GameOS will reformat the HDD again but with a little difference :-) It will have less HDD space now because i made VFLASH larger.

First step is to dump the partition table of HDD. Second step is to remove GameOS partitions. Then resize VFLASH by modifying the partition table and writing it back to HDD. The last step is creating new VFLASH region.

I did all these steps from a Linux with my kernel booted by BootOS but it's not necessary and can be easily done from GameOS itself. I implemented my dual boot on 3.41 PS3 from GameOS before SONY took it away.

I made VFLASH about 40GB large but you can make it even larger if you want to.

Advantages Of Installing Linux on VFLASH

  • VFLASH is HDD, so you won't loose any performance compared with HDD
  • You won't loose your Linux if GameOS reformats your HDD

Dumping HDD Partition Table

  • Partition table is stored on first sectors of HDD
  • Dump it with my ps3disk Linux kernel driver or with GameOS and HV call lv1_storage_read
# dd if=/dev/ps3da of=partition_table_old.bin bs=512 count=2

Removing GameOS Partitions From HDD

There are actually 2 methods i used to do these. First method is to modify the HDD partition table directly. The second method is to use my PS3 Linux kernel and ps3stormgr kernel module.

1. Method

2. Method

  • You will need my ps3stormgr Linux kernel module and ps3stor-utils
  • In HV, HDD is the storage device with index 3
  • On PS3 slim i used, GameOS creates 2 HDD regions #2 and #3 for itself (region #0 is the whole HDD and region #1 is VFLASH)
  • Be careful with ps3stor_region tool because it won't ask you anything and just delete a storage region you specified
  • If you deleted VFLASH accidentally then don't panic just reboot to GameOS and reinstall your firmware. Another option is to create VFLASH region again with ps2stor_region create
  • Deleting a storage region with "ps3stor_region" doesn't delete data stored on HDD, it just tells HV to modify the storage device partition table, so if you deleted a storage region its data is still there and if you create it again as it was earlier then you won't loose anything :-) I tested it by myself !!!
  • "ps3stormgr" Linux kernel driver uses HV calls 250-253 to modify the partition table of a storage device
# ps3stor_region /dev/ps3stormgr delete 3 3
# ps3stor_region /dev/ps3stormgr delete 3 2

Patching HDD Partition Table

Adding New VFLASH Region