1 (edited by Norson 2017-11-19 03:22:15)

Topic: [SOLVED] GParted resized FAT32 partition and Windows can't read it

I have a 32 GB flash drive. It had a 16 GB FAT32 partition. I wanted to extend the partition to use the entire drive. For some reason  Disk Management in Windows 7 didn't show me the option to resize the partition so I tried using GParted 0.25.0 in Ubuntu 16.04. The partition was resized with no problems reported by Gparted. However, when I plugged the flash drive in to my Windows 7 machine Windows wanted me to format the drive. When I plug the drive in to my Ubuntu machine I can browse the directories and files as if there is no issue. Seems like there is an issue with the partition that Ubuntu doesn't care about and Windows won't recognize. How do I fix this?

2

Re: [SOLVED] GParted resized FAT32 partition and Windows can't read it

Hi

Perhaps this helps you:
http://gparted-forum.surf4.info/viewtopic.php?id=17672

3

Re: [SOLVED] GParted resized FAT32 partition and Windows can't read it

That helped a bit. It was interesting to read. However, I didn't find clear step by step instructions in the bug report at https://bugzilla.gnome.org/show_bug.cgi?id=759916 for fixing the issue. One person mentioned using Active@ DiskEditor to read the file system parameters and enter them in to Testdisk to rebuild but I didn't try that. Some people said just changing the first 3 bytes on the drive might fix it.

I looked at the drive again in GParted and noticed that there was only an extended partition containing a FAT32 logical partition. There were a few empty unpartitioned megabytes at the beginning and end of the drive and no primary partitions. I'm guessing the lack of primary partition/s is the thing Windows doesn't like but Linux is OK with it.

Anyway, Linux seems to have no trouble reading the drive so I might use rsync to copy everything to a correctly partitioned second drive.

4

Re: [SOLVED] GParted resized FAT32 partition and Windows can't read it

It is better to use the latest GParted version. Versions newer than 0.25 include a patch for FAT32 filesystem resizing operations.

Concerning ms windows not reading flash drives, I had problem with such a 32GB stick under vista and 7 (it stopped reading it), however windows 8 and 10 could read the stick. Obviously the device drivers aren't the same for these o.s. versions, and the stick isn't damaged.

*** It is highly recommended to backup any important files before doing resize/move operations. ***

5

Re: [SOLVED] GParted resized FAT32 partition and Windows can't read it

You can use hexedit to change the initial bytes in the partition.  For example if your FAT32 partition was /dev/sda1, then you want it to look like the following:

$ sudo hexdump -n 7k -C /dev/sda1
00000000  eb 58 90 4d 53 57 49                              |.X.MSWI|
00000007

To do this edit the partition with hexedit.

$ sudo hexedit /dev/sda1

6

Re: [SOLVED] GParted resized FAT32 partition and Windows can't read it

I'm not sure the bug report exactly matches my problem. I started with a primary FAT32 partition on the flash drive. I made the partition bigger to use the entire flash drive. For some reason GParted changed the parimary partition to an extended partition and GParted now shows the FAT32 partition is a logical partition in the extended partition. I saw no mention of that in the bug report I referenced in my earlier post. sdc1 is the extended partition and sdc5 is the logical FAT32 partition. I'm not sure if I should hexedit sdc1 or sdc5.

$ sudo hexdump -n 7k -C /dev/sdc1
00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
$ sudo hexdump -n 7k -C /dev/sdc5
00000000  78 02 00 4d 53 57 49 4e  34 2e 31 00 02 10 3c 00  |x..MSWIN4.1...<.|

I tried

$ sudo hexedit /dev/sdc5

because it had the 78 02 00 mentioned in the bug report. I changed the first three bytes to eb 58 90 and pressed F2 to save and Ctrl + X to quit. That worked, I think. The files on the flash drive are viewable in Windows, now. Microsoft's Disk Management now shows an extended partition, by itself, on the flash drive containing a FAT32 logical partition. Apparently Windows is OK with an extended partition without any primaries. Chkdsk says the filesystem is OK. Thank you.

7

Re: [SOLVED] GParted resized FAT32 partition and Windows can't read it

Glad to learn that the issue is solved. If so, you can edit your initial post to add [SOLVED] in the title.
smile

*** It is highly recommended to backup any important files before doing resize/move operations. ***