Is it possible to lock the bootloader without losing data? Is it possible to lock my phone without losing the system data it has? I had previously unlocked my Nexus 6p to get root access, and have since despised the big yellow warning sign reminding me that my device is unlocked every time I restart my phone. I have downloaded over a hundred apps as well as movies, music, and other files that I don't want to lose, so factory resetting is not an option. I am running Android 7.1.1 Nougat with a TWRP custom recovery.
On Nexus 6P the bootloader relocking method is contains the Factory Reset, there is nothing to do.

If you are trying to relock your device you should see a screen like this: image.

If you want to keep your files and data you should make a backup and when your device bootloader agian locked you restore it.

This is a normal behaviour but for example on OP2 there is a method to keep your data in save during the bootload relocking procedure.