If you in stock recovery, reboot to fastboot mode and flash twrp to your phone and after that in Twrp mode,you can backup your partition via dd codes.First you have to find partition blocks name. in adb you write this code "ls -al /dev/block/by-name" and you can see the partition names and block for example.
boot partition in my phone "lrwxrwxrwx 1 root root 16 1970-03-22 19:02 boot -> /dev/block/sde49" so partition name is sde49.
If you want to backup your partition you write this code. "dd if=dev/block/sde49 of=/sdcard/boot.img" so in your phone sdcard you can find your backup
If you want to restore your partition firstly put your boot.img to your phone main storage (sdcard) and you write this code. "dd if=/sdcard/boot.img of=/dev/block/sde49" so this will restore your partition.
Regards