Hey there, pcfresh.
Before I start you should know what a File System is used for. Basically, the File System is how the data is structured and organized on a partition or a disk and what the OS (operating system, e.g. Windows, Linux, Mac OS X, etc.) uses to keep track of files. Different operating systems support different File Systems (in some cases there are exceptions). You can check out this link if you want to know more:
https://en.wikipedia.org/wiki/File_system
As far as I know PS3 used Ext4 File System for the internal drives and it's quite possible that the same is used for the PS4 internal drives. On the other hand, for the externally connected storage devices (USB flash drive, external HDDs, etc), in order to be recognized by the console, they need to be formatted with either FAT32 or exFAT (I recommend exFAT as it doesn't have the file and partition size limitation of FAT32). All of that means that you can't disconnect your internal drive and use it as a backup to restore your info on your newly installed HDD, because it won't be formatted with the proper File System in order for it to be recognized via an external connection by the PS4. However, the data should still be intact and you should be able to use it with the console internally if you decide to swap drives again.
So if you want to backup everything (apps, games, saved data, etc.) you should have an externally connected drive, formatted with exFAT. Here's a detailed tutorial on how to replace your drive, which also includes a link with info on how to backup your current HDD's data: https://support.us.playstation.com/articles/en_US/KC_Article/Upgrade-PS4-HDD/
Hope that helps.
Boogieman_WD