Let’s say you have to send your Xperia phone to the service center and they send a replacement phone. But your phone is pattern-locked but since the screen is broken, you cannot really open it. So how do you get your data off the phone?
Use an OTG adapter, so that you can connect your mouse and operate your phone. You can remove the pattern lock and do a back-up on the pre-installed ‘backup and restore’ application. In any case, the data is wiped out at the service center. But if you want to format the data at your end, you can do a software repair on your Xperia Z1 by following the instructions given here http://www.sonymobile.com/global-en/tools/update-s
Download the SUS and follow the steps.