Ubuntu – Change or Assign a Drive Letter to an external hard drive (or any drive)

command linediskexternal-hddhard drivepartitioning

I have an external hard drive that I formatted with Ubuntu (using the Gnome Disk Utility aka Disks) as an NTFS file system. Most of my computers in the house run Linux but I have a housemate using Windows 7. Usually, this external hard drive is connected to a file server, and files are accessed over the network; however, my file server broke down and I wanted to plug this external drive into my house mate's Windows 7 computer in the meantime so he can still access our media.

The drive is detected fine by Windows and it installs the drivers successfully and the device manager reports the device is working properly but it will not show up in Windows Explorer. After doing some googling and checking out the disk management utility in Windows, I've discovered the problem to be that the external drive has no drive letter assigned to it and that's why Windows can't bring it to the file manager. The usual solution is to use the disk management utility in Windows to assign a drive letter but the option is greyed out (yay Windows!).

I found a way to assign a drive letter through DOS using diskpart but don't have access to a Windows computer atm. I'd like to assign a drive letter to this drive (and a couple of other similar NTFS drives) from one of my Linux machines so that he can just plug in the drive when he gets home and not have to have me there to set it up.

So, unfortunately, all the Ask Ubuntu questions that have a title asking how to change the drive letter of a disk are actually pleas for support and were resolved in other ways… I would actually just like to know how to assign or change the drive letter of a disk. GUI or CLI is fine, however, CLI is preferred. I couldn't find anything in the man pages on the part about it, nor could I find any options in gparted or gnome disk utility. I also couldn't find much by googling, except some people suggesting that it's not even possible to do from a Linux machine because Linux doesn't use drive letters, but I doubt that. Thanks.

Question: How to change or assign a drive letter to disk? Preferably using CLI, but instructions to use a GUI are also acceptable (read above only if you need to know why).

Best Answer

All you need to do is use fdisk (in linux) to change the partition id to 7. In your case the partition id 83 (linux partition) or something else which windows considers the volume as hidden. When the partition id is 7, windows will automatically recognizes the partition volume as NTFS and assigns a drive letter whenever the FDD was recognized. Drive letter is a mount point which is windows specific. In linux some directory, mostly /mnt/dir is used for mount point. Linux can successfully mount NTFS volumes with partition id 7 and hence you will be able to use the partition from both LINUX as well as windows.

Related Question