Quantcast
Channel: Active questions tagged fdisk+ntfs - Super User
Viewing all articles
Browse latest Browse all 11

How do I format an NTFS drive on CentOS 7 so that I can also use it in Windows?

$
0
0

We have a LIDAR system that collects data in the field. The computers that process the raw data are Windows computers so we use NTFS. However, the LIDAR system itself runs CentOS 7. Normally this is no problem. We format the collection drives to NTFS on Windows or use GParted (CentOS or Ubuntu). CentOS mounts and writes to them just fine and Windows can read them.

Our customers would like to be able to format the collection drives in the LIDAR system using CentOS though. I thought this would be a trivial task and wrote a script. The script works to format the drives and CentOS will write data to them. However, after using the script Windows will no longer recognize the drives.

If GParted can make this work then there must be something wrong with they way I am formatting them. My procedure is as follows:

umount <mountPoint>

This ensures the drive is not mounted.

(echo o; echo n; echo p; echo 1; echo ; echo ; echo w) | fdisk /dev/<driveLetter>

This uses fdisk to write a new partition table by taking the following actions:

  • o: Create a new empty DOS partition table
  • n: Add a new partition
    • p: Create a primary partition
    • 1: Partition 1
    • default first sector (showing as 65535 on a 480GB drive)
    • default last sector (showing as 937703087 on a 480GB drive)
  • w: Write the table to disk

Then...

mkfs.ntfs -f -L <driveLabel> /dev/<driveLetter>1

This formats the drive partition 1 to NTFS.

mount -a

This remounts the storage drives.

Windows cannot see the drives formatted this way. However, if I use AOMEI in Windows it will see the drives even though I cannot use them. The only clue that it gives me is that it adds a *: to the drive label. So instead of <driveLabel> it shows *:<driveLabel>.

Can anyone tell me if there is a flaw in my script or if I am missing something?


Viewing all articles
Browse latest Browse all 11

Trending Articles