Western Digital is planning to raise $3.17 billion by selling a part of its stake in flash memory unit Sandisk , which it used to own, as the hard disk drive maker looks to reduce debt.