Hypothetically, what would happen if you did a cloud backup and wiped your phone before going through customs, then restored the phone on the other side?
If you did it well, and of course are willing to lie when asked if you'd done such a thing (major red flag for the CBP flunkies) you'd probably be okay, but with an obvious caveat: entering the country with a phone and other electronics normally stuffed with personal information but in your case curiously empty would probably cause you to get flagged for special attention much more than if your device content looked normally cluttered.
That's why plausible deniability should be implemented in such a way that one could have multiple encrypted profiles on a phone, each one with its hidden and encrypted storage, but the safe one wouldn't be empty or unused to avoid raising warning flags; all sensitive social media and communication would take place only on other accounts, still the user should maintain their day to day communications (family, friends) on the safe one. Encrypted profiles would activate only after entering their unique password, but the phone would immediately default to the safe one at each sleep or power off. This however doesn't protect from cell traffic analysis which would reveal for example the phone (tower+location+source and dest. IP+IMSI+IMEI+time) was connected to that server at a certain time, still would require more efforts from an officer than merely scanning all mail or posts on social media. A VPN helps, but as per above, now one would have to explain why they're using one, and I totally expect VPNs to be criminalized very soon.
All of that's great advice and quite detailed, but i'd just bring a second burner phone with some basic social media and etc content on it from intermittent safe use so it's always ready for travel.
They can deny entry to non-citizens for basically any reason, including "you have a wiped phone and won't give us access to your cloud account", so... yeah probably best not to do that. Or at least make up a plausible reason for it.
I think a better option is probably just to delete any app that might have critical comments on it, like social media etc. And then you can just say you've quit social media.
Suppose I want to do this with my laptop, and dump my drive to the cloud (say accessible via SSH) to reinstall another operating system overwriting it. It's likely that the new operating system won't touch most of the blocks in my drive, so when restoring after having passed the boundary I don't want to transfer those unchanged blocks. Is there a good tool to do that easily?
If you use a SSD or above, you do not have any control over these "blocks" (called cells in these technologies). You cannot access them at all once they are unliked (i.e. the slack source you had with HDD which you could access does not exist anymore).