When I use a pendrive with two partitions on a Windows system, it only recognizes the first partition that I've created in that pendrive.

I have a pendrive with two partitions: an ext4 and a ntfs (the one that should be recognized).

So, the problem is that when I use this pendrive on Windows it tries to read my ext4 partition since it's the first one that I've created. I'm not sure if just changing the pendrive's name partition from sda2 to sda1 on linux could solve my problem on windows, but that is the only solution that I can think right now.


You can't swap sdaX for sdaY, which wouldn't do anything in Windows anyway.
Your problem is a Windows problem, not a Linux problem: use the disk manager thingy in Windows to set a letter drive to the NTFS partition.

| improve this answer | |
  • Check also the partiton table on the pendrive. If for example the partition type is wrong, Windows may ignore the NTFS partition. – jofel Aug 18 '15 at 9:26

You could swap the first partition entry in the partition table with the second one using the dd tool.

I advice though that you make a backup of your files (or filesystems) before trying this procedure!

I also won't claim a high degree of reliability afterwards because it is not common practice to have partition entries in descending order.

Note for example that the fdisk tool will report an incorrect order of your partition entries after performing this procedure.

However, I have tested the access to the NTFS-partition and it appears to work in Windows 7 as well as Windows 10. I have not tested any other Windows-version. Also Ubuntu 14.04 appears to recognize the ext4 partition again afterwards (and also the NTFS-partition).

I have tested and succeeded in doing the following:

First copy the first partition entry in your partition table like such (substituting /dev/sdc for the correct device):

dd if=/dev/sdc of=./mbrpart1.dd skip=446 bs=1 count=16

Then copy the second partition entry in your partition table like such (again substituting /dev/sdc for the correct device):

dd if=/dev/sdc of=./mbrpart2.dd skip=462 bs=1 count=16

After writing both partition entries to those two .dd-files one can swap partitions by writing mbrpart1.dd (ext4) to second partition entry and mbrpart2.dd (NTFS) to first partition entry.

So write mbrpart1.dd (ext4 partition entry) to the second partition entry (substitute /dev/sdc for correct device):

dd if=./mbrpart1.dd of=/dev/sdc seek=462 bs=1 count=16; sync

And write mbrpart2.dd (NTFS partition entry) to the first partition entry (substitute /dev/sdc for correct device):

dd if=./mbrpart2.dd of=/dev/sdc seek=446 bs=1 count=16; sync

And then it should be done.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.