So I've been attempting to factory restore my good ol' Nexus 7 (2013) LTE (deb) all day, and I can't get past this one error that has me stuck. I'm using the stock image from Google, and where I'm stuck at is when running the flash-all.sh from the command line, everything looks great up until "Writing 'userdata'":

Erasing 'userdata'                                 OKAY [ 19.272s]
mke2fs 1.45.4 (23-Sep-2019)
Creating filesystem with 6997491 4k blocks and 1749664 inodes
Filesystem UUID: ee2e310b-02d9-4271-b8ff-75d231a0a955
Superblock backups stored on blocks: 
    32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done   

Sending 'userdata' (180 KB)                        OKAY [  0.011s]
Writing 'userdata'                                 FAILED (remote: 'Bogus size sparse and chunk header')
fastboot: error: Command failed

I found a similar question posted related to a Nexus 5 having the same issue (Flashing Nexus 5 factory image fails on writing userdata), and the same general workaround seems to work up to getting to the android boot screen, except the device is stuck in a bootloop. One comment mentioned needing to resize the partition prior to the first boot. So far, I haven't been able to find how exactly to do that. Anybody got an idea?

Appreciate any help!

  • why don't you just skip userdata, no need to flash it's empty anyway
    – alecxs
    Commented Oct 23, 2020 at 11:18
  • I tried that, except if I skip, and then boot up normally, the OS gets stuck in a boot loop. From what I've read, I need to change the partition size, otherwise it will never successfully write to it when it first boots up.
    – Ryan O.
    Commented Nov 23, 2020 at 16:30
  • you can format from 'fastboot format:ext4 userdata' (use latest platform-tools) or from TWRP 'mke2fs -t ext4 /dev/block/platform/msm_sdcc.1/by-name/userdata'
    – alecxs
    Commented Nov 23, 2020 at 17:43

1 Answer 1


This can be resolved by manually performing the actions specified in the flash-all.bat file. I had the exact same problem and this stack exchange page got me sorted.

Flashing Nexus 5 factory image fails on writing userdata

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .