Guest User

Untitled

a guest
Jun 18th, 2019
718
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. How to resize USER partition:
  2. You will need:
  3. ninfs
  4. linux
  5. ~/.switch/prod.keys (with your bis keys) (hint: use lockpick)
  6.  
  7. First, mount your emuMMC's rawnand as a loop block device:
  8. $ losetup -f --show -o 0x800000 emummc.bin
  9.  
  10. This will output the location of the block device it just mounted (usually /dev/loop33 for me).
  11.  
  12. Next: Backup files in USER.
  13. $ mount_nandhac /dev/loop33 ~/mount
  14. $ losetup -f --show ~/mount/USER.img
  15. $ sudo mount /dev/loop34 ~/mount2
  16. $ sudo cp -r ~/mount2/* ~/user_backup/
  17. $ sudo umount ~/mount2
  18. $ losetup -d /dev/loop34
  19. $ sudo umount ~/mount
  20. (Assuming the first losetup output /dev/loop33 and then second output /dev/loop34)
  21.  
  22. Now: Resize the rawnand gpt's USER entry
  23. $ gdisk /dev/loop33
  24. i > 11
  25. d > 11
  26. n > enter > +XXG/M with XX being whatever size you want and M or G depending if you want it in MebiBytes or GibiBytes > Enter whatever the i > 11 output for "Partition GUID code: ".
  27. c > 11 > USER
  28. x > c > 11 > Enter whatever the i > 11 output for "Partition unique GUID: "
  29. a > 11 > 0 > enter
  30. finally, i > 11 and verify everything matches the original i > 11 apart from last sector and size
  31. w > Y
  32.  
  33.  
  34. Finally: Reformat the decrypted USER partition and replace files
  35. $ mount_nandhac /dev/loop33 ~/mount
  36. $ losetup -f --show ~/mount/USER.img
  37. $ gparted /dev/loop34
  38. Reformat as a FAT32 partition and then close this out (It should show that a FAT32 partition already exists, if not you did something wrong when editing the gpt)
  39. $ sudo mount /dev/loop34 ~/mount2
  40. $ sudo cp -r ~/user_backup/* ~/mount2/
  41. $ sudo umount ~/mount2
  42. $ losetup -d /dev/loop34
  43. $ sudo umount ~/mount
  44. $ losetup -d /dev/loop33
  45.  
  46. Finally, truncate your emummc image by however much you shrunk USER by, and fix gpt headers:
  47. $ truncate -s -XXG/M emummc.img
  48. $ losetup -f --show -o 0x800000 emummc.bin
  49. $ gdisk /dev/loop33
  50. x > e > w > Y
  51. $ losetup -d /dev/loop33
  52.  
  53. This should now be complete! Probably a better way of doing some of this, but this is what worked for me
RAW Paste Data