2
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?
Few thoughts; I cannot test them now, so just a comment: (1) The partition type may be relevant,
0x07
for NTFS. (2) I think one of my Windows OS-es (old one) was picky and required the first partition to start at the sector63
(decimal). I couldn't use this start sector directly, I created a new partition with a greater number, then moved its beginning in the expert menu (x
,b
). I don't remeber if the partition had to be set as active. – Kamil Maciorowski – 2018-10-15T16:56:32.593I recalled this answer, it may be relevant.
– Kamil Maciorowski – 2018-10-15T21:01:39.663