0

This is a strange one. I have access to a server in another country for work. It runs Linux Centos 7. It has ntfs-3g and ntfsutils and ntfsprogs installed. If someone in the office puts in a USB drive into the server I can see it and mount the partition. So far so good.

The issue is that I need to create an operating system on this USB drive, and to do that I need 3 files, one of which is a ISO image of centos 7. To do that someone takes the USB drive, formats it with ntfs under windows 10 and copies on 3 files, including a 4.5GB DVD iso image. After copying these 3 files, the person checks it and the 3 files are copied as files onto the USB flash drive as expected.

When they put the drive into the server, messages detects the USB drive as a 32 GB kingston data traveller. However it creates a cdrom device /dev/sg5 and it while it creates /dev/sde it doesn't create /dev/sde1. I cannot mount /dev/sg5 as it's not a block device. I cannot mount /dev/sde because it has no partitions.

I go into /dev/sde with fdisk and i can see 4 unreadible partitions with nonsense partition offsets which cannot be possible. I try ntfsfix, it runs to completion, but doesn't solve the issue. The partition table is still nonsense.

This is what the partition table looks like in fdisk:

[root@localhost ~]# fdisk /dev/sde
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): p

Disk /dev/sde: 31.0 GB, 31029460992 bytes, 60604416 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x73736572

This doesn't look like a partition table
Probably you selected the wrong device.

Device Boot      Start         End      Blocks   Id  System
/dev/sde1      1920221984  3736432267   908105142   72  Unknown
/dev/sde2   ?  1936028192  3889681299   976826554   6c  Unknown
/dev/sde3   ?           0           0           0    0  Empty
/dev/sde4        27722122    27722568         223+   0  Empty

Command (m for help): d

If i go into fdisk, delete the 4 partitions and create a new one, exit, and format the usb flash drive ntfs, then i can mount the drive fine.

So at this point, I thought, you know what, there's something wrong with the USB drive. We used a different USB drive, again, we took the 3 files, including an ISO image, copied them onto the flash drive, put it into the server, mounted the USB drive, copied the 3 files across, made the new server image, and catted / dd'd it to the USB flash drive. No errors, the server booted up fine from the USB flash drive. No problems whatsoever.

Now we discovered some bugs in the server image, so we tried to recreate it. As before we took the same USB drive that just was previously mountable, formatted it ntfs under windows, copied the 3 files onto it, put it into the server, and now the server cannot see the partitions. Same problem as the other USB flash drive once again a non block device cdrom /dev/sg5, and a /dev/sde with 4 nonsense partitions on it and no readable partition.

  • I tried rebooting the server it doesn't see the partition block device,

  • I tried getting the person to reformat the drive ntfs,

  • I've tried exfat (centos 7 doesn't see this at all for some reason),

  • I can't use fat32 formatting because the DVD iso is 4.5 GB,

  • I've tried dding the first 512 bytes of the USB flash drive in case it's an mbr,

  • I've tried deleting the partitions in linux on the /dev/sde device and readding 1 single, ntfs partition. The partition shows up under linux as /dev/sde1, but when windows formats it, the USB flash drive is unreadable again.

For both USB drives (different brands) ntfs was readable, then an operating system was installed on the drives, now the drives are visible from windows but not linux.

Is there any way to "fix" these drives so that they are usable by both windows and linux? Has anyone see this behaviour before?

Possible theories about causes:

  1. Windows sees the ISO image being copied onto the USB drive and does something strange to it like takes it upon itself to create something at the start of the flash drive.
  2. There some weird bootable artifact left lying around that we can't get rid of.

1 Answer 1

0

The issue was eventually resolved by cat /dev/zero > /dev/sde and then fdisking from within linux removing the partitions, creating one, formatting it with mkfs.ntfs -f /dev/sde, then copying the files under Windows without formatting.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .