Just to add, when I've defrag'd my disks I've done it during scheduled maintenance periods when the server has either been disconnected from the network or not in use.
I always try to stop as many services as possible that might write to the disk before attempting to defrag - AV sofwtare, database software etc etc. and please make sure you have a valid backup before attempting any maintenance of any kind.