Yes. The partition for time machine will be as safe from malware as if it were on a separate drive. However, you still should not use a partition for your Time Machine backup drive.
At the risk of oversimplifying things, partitioning a drive basically means you're splitting your disk so that your operating system sees them as separate drives. So, if you partition the drive into two and use one for your macOS installation and one for your Time Machine backup, then they're both being seen as two totally distinct drives and in this sense the drive is being dealt with as if it were an external drive.
In fact, doing this can actually offer an additional level of protection against malware because malware will usually infect your boot volume, rather than other drives/partitions. Of course, there is no guarantee against malware, and this does not offer full prevention or provide a cure.
However, you should not partition your drive for Time Machine purposes!
By partitioning a drive so that one partition is being used for Time Machine you're effectively providing yourself a false sense of security. The idea of a fully working and current backup is to ensure you have a way to restore your data in the event of data loss, and the best way to do this is to have a backup on a totally separate physical drive.
Below is a list of some reasons why using a partition is a bad idea:
- Your Mac is stolen and therefore your backup is also gone - i.e. you have no way of restoring your data now!
- Your main drive starts to fail and since the Time Machine partition is also on the same physical drive, your backup is also at risk - i.e. some or all of your backup data may become unreadable
- Your Mac is damaged and with it your backup is most likely impacted as well.
As a minimum you should be using at least one external drive for Time Machine, preferably one that is 3x the size of your internal drive. External drives do not cost a lot of money and they also provide the added benefit of being able to be stored away from your Mac at times you will not be using it for a while. For example, if you go away for a week you can take your external drive with you, or store it somewhere else, so that if your house burns down or your Mac gets stolen, you have still have your backup.
My recommendation for individual users
Whenever I setup a backup regime I recommend the following approach:
- Purchase two external drives of equal size and at least 3x the capacity of the computer being backed up
- Label these drives differently (e.g. TM Backup HD 1 and TM Backup HD 2)
- Set both of these external drives as Time Machine backup drives
- As both drives are set up with TM they are alternated whenever both drives are available
- Once the initial backups are done, physically remove one of the external drives and take it 'offsite'*
- On the same day each week, swap the drives over
- The net result is that both hard drives will have backups in the order of one week on, one week off (but between them there is a full set of backups).
* By offsite I mean your workplace, a shed in the back yard, a family member's/friend's place (assuming you trust them!). You could even store it in your car (but this would depend on your climate and where you 'garage' your car).
Basically, the idea is that your offsite drive is somewhere that protects your data in the event your house burns down or you get robbed. My strong suggestion would be in a locked drawer at your workplace (unless you work at home). Most people's workplaces are air-conditioned, secure, and convenient.
IMPORTANT NOTES ABOUT STORAGE
Regardless of the 'offsite' location you choose to keep your hard drive, there are some key factors to keep in mind:
- Always keep the drive safe from large magnetic fields!
- Ensure the location has a temperature range between 10 degrees celsius (50 degrees fahrenheit) and 43 degrees celsius (110 degrees fahrenheit). So, keeping it in a car would usually not be a good idea.