Resizing VFLASH Storage Device: Difference between revisions
Graf chokolo (talk | contribs) |
|||
(20 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
[[Category:OtherOS]] | |||
= Introduction = | = Introduction = | ||
Line 7: | Line 8: | ||
HV hides VFLASH HDD region from LPAR 2 and it doesn't see it. | HV hides VFLASH HDD region from LPAR 2 and it doesn't see it. | ||
First, i resized the VFLASH. '''By doing this, you will | First, i resized the VFLASH. '''By doing this, you will lose your data on HDD but NOT on VFLASH !!! | ||
VFLASH data remains untouched. Resizing VFLASH doesn't cause corruption of data already installed there !!! | 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.''' | So backup your GameOS data from UFS2 partition before you will do it.''' | ||
Line 25: | Line 26: | ||
* VFLASH is HDD, so you won't loose any performance compared with HDD | * VFLASH is HDD, so you won't loose any performance compared with HDD | ||
* You won't loose your Linux if GameOS reformats your HDD | * You won't loose your Linux if GameOS reformats your HDD | ||
* By upgrading/downgrading PS3's firmware you won't loose your Linux region. The only problem is how to boot Linux again :-) | |||
* But now that SONY knows how we can install Linux on the HDD of a PS3 slim they could of course make it harder for us in the future firmwares. | |||
= Dumping HDD Partition Table = | = Dumping HDD Partition Table = | ||
Line 75: | Line 78: | ||
== 1. Method == | == 1. Method == | ||
On Linux/Windows/Mac (from a PC), create a new partition table. No partitions need be created. | |||
== 2. Method == | == 2. Method == | ||
Line 93: | Line 98: | ||
= Patching HDD Partition Table = | = Patching HDD Partition Table = | ||
== Example Of | == Example Of A Patched HDD Partition Table With Resized VFLASH Region == | ||
<pre> | <pre> | ||
Line 107: | Line 112: | ||
00000400 | 00000400 | ||
</pre> | </pre> | ||
Here you can see an example of a patched HDD partition table with resized VFLASH region and removed GameOS regions. | |||
I set sector count of VFLASH region to '''0x4080000''' sectors. | |||
Of course you shouldn't use here sector count larger than your HDD allows :-) | |||
== Writing Patched HDD Partition Table to HDD == | |||
<pre> | |||
# dd if=part_table_patched.bin of=/dev/ps3da bs=512 count=2 | |||
# sync | |||
</pre> | |||
Now reboot to GameOS and it should start formatting your HDD again. But now it won't use the space we reserved for VFLASH :-) | |||
= Adding New VFLASH Region = | = Adding New VFLASH Region = | ||
* Now the last step is adding new VFLASH region where we can install our beloved Linux :-) | |||
* '''VFLASH storage device has one unused region - region #7 - which we can use !!!''' | |||
* To complete this step you will need my '''ps3stor-utils''' and my Linux kernel driver '''ps3stormgr''' | |||
* Make sure you reboot after patching HDD partition table | |||
<pre> | |||
# ps3stor_region /dev/ps3stormgr create 4 0x80000 0x4000000 0x1070000002000001 | |||
</pre> | |||
* The above command creates a new VFLASH region which starts at sector '''0x80000''' and has '''0x4000000''' sectors. | |||
You can of course use another value for sector count. But it shouldn't be larger than the free space you added to VFLASH of course :-) | |||
* The command should return '''0x7'''. It means the new region has index 7. | |||
* Now reboot your Linux and if you are using my VFLASH Linux driver then you should see now a new VFLASH device '''/dev/ps3vflashh'''. | |||
* Now you can partition it with '''fdisk''' e.g. and install Linux there :-) Have fun. | |||
* If you have any problems then contact me and i will try to help you. | |||
{{Linux}}<noinclude>[[Category:Main]]</noinclude> |
Latest revision as of 22:21, 2 September 2019
Introduction[edit | edit source]
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 lose 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[edit | edit source]
- VFLASH is HDD, so you won't loose any performance compared with HDD
- You won't loose your Linux if GameOS reformats your HDD
- By upgrading/downgrading PS3's firmware you won't loose your Linux region. The only problem is how to boot Linux again :-)
- But now that SONY knows how we can install Linux on the HDD of a PS3 slim they could of course make it harder for us in the future firmwares.
Dumping HDD Partition Table[edit | edit source]
- 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
- Partition table of a storage device contains all storage device regions with their start sector, sector count and ACL list
# dd if=/dev/ps3da of=partition_table_old.bin bs=512 count=2
Example Of An Unmodified HDD Partition Table[edit | edit source]
alex@gentoo ~ $ hexdump -C partition_table_old.bin 00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000010 00 00 00 00 0f ac e0 ff 00 00 00 00 de ad fa ce |................| 00000020 00 00 00 00 00 00 00 03 00 00 00 00 00 00 00 02 |................| 00000030 00 00 00 00 00 00 00 08 00 00 00 00 00 08 00 00 |................| 00000040 10 70 00 00 01 00 00 01 00 00 00 00 00 00 00 0b |.p..............| 00000050 10 70 00 00 02 00 00 01 00 00 00 00 00 00 00 03 |.p..............| 00000060 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| * 000000c0 00 00 00 00 00 08 00 10 00 00 00 00 17 01 f1 a0 |................| 000000d0 10 70 00 00 01 00 00 01 00 00 00 00 00 00 00 03 |.p..............| 000000e0 10 70 00 00 02 00 00 01 00 00 00 00 00 00 00 03 |.p..............| 000000f0 10 20 00 00 03 00 00 01 00 00 00 00 00 00 00 03 |. ..............| 00000100 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| * 00000150 00 00 00 00 17 09 f1 b8 00 00 00 00 00 3f ff f8 |.............?..| 00000160 10 70 00 00 01 00 00 01 00 00 00 00 00 00 00 03 |.p..............| 00000170 10 70 00 00 02 00 00 01 00 00 00 00 00 00 00 03 |.p..............| 00000180 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| * 00000400
Here you can see a HDD partition table from the HDD of a PS3 slim. It has 3 regions: VFLASH and 2 GameOS regions.
The VFLASH region starts at sector 0x8 and is of size 0x80000 sectors. Each sector is 512 bytes. So, VFLASH is 256 MB large.
You can also see the ACL list of every HDD region. E.g. VFLASH can be accessed by LPAR auth id 0x1070000001000001 (LPAR 1 or HV processes) and 0x1070000002000001 (LPAR 2 or GameOS). This list can be manipulated by HV calls 252 and 253 or with my ps3stor-utils and ps3stormgr Linux kernel module.
Removing GameOS Partitions From HDD[edit | edit source]
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. Actually this step can be skipped.
1. Method[edit | edit source]
On Linux/Windows/Mac (from a PC), create a new partition table. No partitions need be created.
2. Method[edit | edit source]
- 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 # removes UFS2 region
Patching HDD Partition Table[edit | edit source]
Example Of A Patched HDD Partition Table With Resized VFLASH Region[edit | edit source]
alex@gentoo ~ $ hexdump -C part_table_patched.bin 00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000010 00 00 00 00 0f ac e0 ff 00 00 00 00 de ad fa ce |................| 00000020 00 00 00 00 00 00 00 03 00 00 00 00 00 00 00 02 |................| 00000030 00 00 00 00 00 00 00 08 00 00 00 00 04 08 00 00 |................| 00000040 10 70 00 00 01 00 00 01 00 00 00 00 00 00 00 0b |.p..............| 00000050 10 70 00 00 02 00 00 01 00 00 00 00 00 00 00 03 |.p..............| 00000060 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| * 00000400
Here you can see an example of a patched HDD partition table with resized VFLASH region and removed GameOS regions.
I set sector count of VFLASH region to 0x4080000 sectors.
Of course you shouldn't use here sector count larger than your HDD allows :-)
Writing Patched HDD Partition Table to HDD[edit | edit source]
# dd if=part_table_patched.bin of=/dev/ps3da bs=512 count=2 # sync
Now reboot to GameOS and it should start formatting your HDD again. But now it won't use the space we reserved for VFLASH :-)
Adding New VFLASH Region[edit | edit source]
- Now the last step is adding new VFLASH region where we can install our beloved Linux :-)
- VFLASH storage device has one unused region - region #7 - which we can use !!!
- To complete this step you will need my ps3stor-utils and my Linux kernel driver ps3stormgr
- Make sure you reboot after patching HDD partition table
# ps3stor_region /dev/ps3stormgr create 4 0x80000 0x4000000 0x1070000002000001
- The above command creates a new VFLASH region which starts at sector 0x80000 and has 0x4000000 sectors.
You can of course use another value for sector count. But it shouldn't be larger than the free space you added to VFLASH of course :-)
- The command should return 0x7. It means the new region has index 7.
- Now reboot your Linux and if you are using my VFLASH Linux driver then you should see now a new VFLASH device /dev/ps3vflashh.
- Now you can partition it with fdisk e.g. and install Linux there :-) Have fun.
- If you have any problems then contact me and i will try to help you.