Resize partitions

Hello

I have a hdd pf 512 with 2 partitions: 165 Gb for system and programs and the rest for data. I need to take 50 Gb from D (second partition) and add-it to the system partition and I cannot figure how to do-it ad disk utility cannot do-it. I understood that can be done using terminal commands but I have no ideea what are. Any advise?

Thank you

try man diskutil

Resize partitions
 
 
Q