[Nexus 4 Q&A, Help & Troubleshooting] USSENTERNCC1701E:
This may or may not work, no guarantees. This will be difficult, time consuming, and you must do everything exactly as written; so read it first and ask questions before you begin. I am using a Windows PC, most of these commands will be similar on other OS's, those when in the adb shell are identical. This will require adb and a custom recovery (I use TWRP, so I'll be able to offer TWRP specific help quicker), find a method to flash that before you begin, and find where that recovery keeps it backup files. Also this will require you to flash a rooted ROM, of the same android version you had before: if you had stock, I recommend you flash stock and root it; either way, have that ready to go before you start. Lastly, the worst case scenario will require you to have a linux system and possibly some kind of removable media (USB stick, external HDD, etc), you can just boot a linux live disk, and that's what I'll be doing with Ubuntu; again, have this ready first. There will come a point about mid way through, where, depending on the results you may need to wait for me to follow up with you, I will try to do this in a timely manner, but I can't promise anything.

Basically what we are going to do is explore the file system in an adb shell while it is booted to a custom recovery, hopefully from there your /data and /sdcard partitions will still be intact; if they are not we may still be able to recover some of your data. If they are intact you can simply use the recovery to make a backup of them.

And so, with your phone connected to your computer, boot to recovery. Then open a command prompt and enter:

adb shell
cat /proc/mounts

The output will look like:

First is the block, then the mount point, then the file system type, last is information about how recovery treats it.

If you do not see /dev/block/mmcblk0p23 associated with a mount point then enter:

mount -o rw /dev/block/mmcblk0p23 /data
mount -o rw /dev/block/mmcblk0p23 /sdcard

If you get an error on both of these then skip to the breakt.

Now check both these directories to ensure it is the data you expect it to be, enter:

cd /data
ls
cd /sdcard
ls

Maybe go down a few levels to confirm your data is really there. If the output doesn't look right, then skip to the break.

Otherwise, enter:

exit

Use the phone screen to navigate to the backups menu and backup data.

When the backup is complete use adb pull to copy the backup onto your computer, this may take a very long time.

adb pull /sdcard/TWRP TWRP

Now flash your ROM, including a data wipe, and boot it, once it is running fully, reboot into recovery and push the backup to the phone.

adb push TWRP /sdcard/TWRP

Use the phone screen to restore the data.

--------------------THE BREAK, cause XDA automagically made these two posts one, ****ers--------------------

Hopefully you got this sorted out with the first part, this part may not work at all, and it will be a lot more tedious if it does. So, at this point something happened which indicates /mmcblk0p23 really did lose the data, so we'll just copy the whole thing and explore that copy in linux to extract what data you can.

With the phone in recovery, and a command prompt in an adb shell:

dd if=/dev/block/mmcblk0p23 of=/tmp/userdata.ext4

This may take a REALLY long time. When it is done, enter:

exit
adb pull /tmp/userdata.ext4

This will take just as long or longer. Transfer userdata.ext4 to your removable media device. And boot to your linux setup. Open a terminal window in the directory with userdata.ext4 enter:

sudo mkdir userdata
sudo mount -o loop userdata.ext4 userdata
cd userdata
ls

Now if any of your data still exist in a form I'd be able to help you recover, it will be in this directory, userdata. If you see something that you recognize, or that you know you need, copy it and save it to the removable media. After that you can reboot your system.

Go ahead and flash your new ROM now, let it fully book, and then copy back whatever you managed to save.

I kinda lost steam there toward the end, sorry, it's 0316 here. If anything is unclear ask away. Good luck.