Help - Search - Members - Calendar
Full Version: Windows 7 x64 - 2 partitions, 1 bootable (hidden) 1 useable/visible in
The CD Forum > The CD Forum > USB Booting
webwolf
I was having problems finding any way to view all USB Flash drive partitions under windows x64, so I considered the issue and came up with a suitable workaround.

This method gives you a boot sector partition at the beginning of the stick (100MB or so, this is the MBR, we don't need to touch that) a second partition which will be bootable using DOS4USB (or your preferred method of creating a bootable USB drive) and a third partition which you can format as whatever file system you prefer and use as you would a typical USB stick.

The issue with Windows and USB flash drive partitions is that windows will only see the first Primary partition and assign a drive letter to it, so if we make the first partition a logical partition and the second partition *the* primary partition then Windows will simply ignore the first partition and assign a drive letter to partition 2.

The first partition is still visible outside of windows (it's still bootable, and is still visible under Linux / Mac)

The primary benefit to this is that your boot partition is protected against changes and fragmentation within windows. DOS4USB can't boot ISO's which are fragmented and this occurs if you modify the contents of the USB stick a lot.

--
Required tools:
EASEUS Partition Master 8.0.1 Home Edition (Freeware) - http://www.partition-tool.com/download.htm
USB4DOS (Freeware) - http://www.pendrivelinux.com/yumi-multiboot-usb-creator/ (Now YUMI, I used an old copy of USB4DOS but this should work the same)

Step 1: erase your USB drive, and configure using USB4DOS / YUMI (There are plenty of resources available to help you achieve this)
Test the USB stick and make sure it's bootable, and the bootable tools you need load.

Step 2: Load EASEUS Partition Master 8.0.1 Home Edition, resize partition 1 (the FAT32 partition, not the small MBR partition at the beginning of the drive)

Step 3: Create a new partition in the unallocated space and format to your preferred file system.

Step 4: Right click partition 1 and click Change drive letter, set it to None.

Step 5: Right click partition 1 and click convert to Logical.

Step 6: Right click partition 2 and click convert to Primary.

Step 7: Right click Partition 2 and click Change drive letter.

Don't forget to apply the changes!

Now under My computer you should see the large empty partition (Partition 2), try booting from the USB stick again.

if you need to make changes to the content of partition 1, simply reverse steps 4 through 7 make the changes and then apply steps 4 through 7 again.

Currently this is the best way I've found to achieve a bootable multi partitioned USB stick under Windows x64.

Enjoy.
Ed_P
Thanks webwolf.
FM_81
You'll get the same effect if you create a 1st primary data-partition (not active set), formated for example in FAT32, and a second primary in EXT2, active, bootable with any loader you wish ...
So is your boot-partition protected against changes too. (OK, there exists EXT2-drivers for windows, but on most corrupted systems you'll not find such, and as said, windows sees only the first.)

Greetings, FM_81
Ed_P
VERY clever FM_81. Thanks. happy62.gif
jaclaz
Nice smile.gif, though you have some terminology mixed.
The MBR is OUTSIDE of ANY partition, it is the first sector of the disk device, and it is of course "seen" by *any* OS.

The one and only partition that windows NT based systems will see on "removable" drives is (in the case of multiple partitions) is the ACTIVE one.

A more convenient way is to use a bootmanager like grub4dos to change Active status of partitions at boot time and/or *any* simple Windows utility to change the Active status before reboot or eject/re-insert.


Cannnot say/remember if there is a 64 bit compile of cfadisk or dummydisk. unsure.gif

For the record, Windows 7 diskpart has a few nice new features, see here:
http://www.911cd.net/forums//index.php?sho...c=24390&hl=
http://reboot.pro/13899/
that may be is useful in this context. dubbio.gif

cheers.gif
jaclaz
FM_81
QUOTE (jaclaz @ Jun 17 2011, 02:32 PM) *
The one and only partition that windows NT based systems will see on "removable" drives is (in the case of multiple partitions) is the ACTIVE one.
As far as I know, it sees the first one, not the active one. I've tested the stick descibed in my last post in XP, Vista and WIN 7, and all recognized only the first, nonactive FAT32.

Greetings, FM_81
jaclaz
QUOTE (FM_81 @ Jun 20 2011, 07:53 AM) *
As far as I know, it sees the first one, not the active one. I've tested the stick descibed in my last post in XP, Vista and WIN 7, and all recognized only the first, nonactive FAT32.

Greetings, FM_81

Then, I take it back ph34r.gif.

I'll re-check my notes, my memory is not as good as it was. blush.gif

cheers.gif
jaclaz
FM_81
But this part
QUOTE
A more convenient way is to use a bootmanager like grub4dos to change Active status of partitions at boot time and/or *any* simple Windows utility to change the Active status before reboot or eject/re-insert.
should stay written! Changing it by GRUB4DOS (or any other loader) can be sometimes a very good idea, no matter if I know no example for that needing at the moment!

Greetings, FM_81
jaclaz
Yep, but we can also do more than that with grub4dos. thumbsup.gif

I presume dubbio.gif (and I would like this time to make sure before posting about it wink.gif ) that it is not even the "first partition" that is visible, but rather the one that is in "first partition entry" in the MBR. (can you test this and report? unsure.gif)

If this is the case, it is possible to use grub4dos to re-write on-the-fly that entry and/or re-arrange entries "at will".

A rather complex approach, but perfectly doable.

The "general idea" is between the lines of this thread:
http://reboot.pro/7138/

Writing a batch or similar, to "revert" situation to before ejecting/disconnecting the stick can be easily made.

cheers.gif
jaclaz

FM_81
It's the first partition and its the first entry, which has FAT32:
CODE
#fdisk -lu /dev/sdf
Disk /dev/sdf: 4020 MB, 4020240384 bytes
124 heads, 62 sectors/track, 1021 cylinders, total 7852032 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0x0007a093

   Device Boot      Start         End      Blocks   Id  System
/dev/sdf1              63     2056191     1028064+   b  W95 FAT32
/dev/sdf2   *     2056192     7843839     2893824   83  Linux
In most cases I use the linux-fdisk, so I know, on which sector a partition starts or ends.

Greetings, FM_81

Off Topic: Only to make things a little bit more confused: the Bart-PE-system boots from EXT2 too ... smile.gif
wimb_2
QUOTE (jaclaz @ Jun 20 2011, 02:15 PM) *
I presume dubbio.gif (and I would like this time to make sure before posting about it wink.gif ) that it is not even the "first partition" that is visible, but rather the one that is in "first partition entry" in the MBR. (can you test this and report? unsure.gif)

Yes indeed, it is the "first primary partition entry" in the MBR of the USB-stick that will be visible in Windows (tested with XP).

I exchanged manually the partition entries in the MBR using TinyHexer and I used EASEUS PM 8 to revert logical into primary
I can have either the 1=NTFS or the 2=FAT32 primary partition visible in XP and the stick is bootable with the NTFS partition via grldr

The stick was first prepared as follows:
1. Format Stick button of Make_USB.exe was used to create stick with 2 partitions (1st part = NTFS and I used 25% for 2nd unformatted FAT32 partition)
2. Grub4dos MBR bootcode was used and some IMG or ISO file to make stick bootable by using GO
3. Use BOOT_IMG.exe to add more Boot Image files if desired (and to update grldr)
4. Use EASEUS PM8 to change 1st primary NTFS partition into logical drive as described by webwolf and to Format FAT32 2nd partition
5. Reboot from USB-stick with Grub4dos - Boot with ISO or IMG file from NTFS logical drive is possible
6. Reboot with XP reveals "the first primay partition entry" which is the FAT32 2nd partition

After the 1st partition was converted from primary into logical, then the 2nd partition becomes the first entry in the partition table smiling9.gif
The second entry of the MBR partition table refers to the EPBR (Extended Partition Boot Record).
The partition table (EPBR) for the extended partition holding the logical drive is at sector 64 and the NTFS bootsector is at sector 127
Not so nice to see the partition table of the EPBR appearing in the second sector of the original NTFS bootsector which started at sector 63
But anyway EASEUS PM8 is capable of doing the conversion and is also equipped with Explorer to show content of invisible partition thumbup.gif

Revert the NTFS logical partition into primary partition will still give the FAT32 partition visible in Windows,
since After EASEUS operations it has become the first entry in the partition table.
Subsequent exchange of entries in MBR partition table will on Reboot make NTFS partition visible in Windows.

Conclusions:
Only primary partitions of USB-stick are visible in Windows and the visible one is "the first primary partition entry" in the MBR partition table
Grub4dos can be used to boot from NTFS logical partition on USB-stick and this logical partition is invisible in Windows.

You can convert to logical partition to make USB-stick partition invisible in Windows.
Or you can exchange primary partition entries in MBR partition table of USB-stick.

Both methods can be used to make the desired partition visible in Windows,
but exchanging primary partition entries in MBR of USB-stick seems to be preferrable,
since it involves not the rearrangement that occurs in changing primary into logical partition.


cheers.gif
jaclaz
@wimb
You can allright change a logical volume inside extended to a primary one by simply making an entry for it in the partition table, though you will need to fix "sectors before" (or use the grub4dos "specific" command "partnew" that should automatically fix that).

QUOTE
******************************************************************************
*** The PARTNEW Command Syntax ***
******************************************************************************

Besides the mappings in the above section, you may instead choose to create a
new primary partition with the PARTNEW command. PARTNEW can generate a primary
partition entry (in the partition table) for a logical partition.

For example,

partnew (hd0,3) 0x07 (hd0,4)+1

where the file (hd0,4)+1 stands for the whole partition (hd0,4). This command
will create a new primary partition (hd0,3) whose type is 0x07 and whose
contents/data is the same as that of the logical partition (hd0,4).

Just like a whole logical partition, a contiguous partition image file can
also be used with PARTNEW:

partnew (hd0,3) 0x00 (hd0,0)/my_partition.img

The type 0x00 indicates a type-auto-detection of the image MY_PARTITION.IMG.
The above command will create a new primary partition (hd0,3) with a proper
type and with contents/data being exactly that of the contiguous file
(hd0,0)/my_partition.img.

PARTNEW will automatically correct the "hidden sectors" in the BPB and the
modification will be permanent.
And PARTNEW modifies the partition table
permanently.

In addition to creating new partition entries, PARTNEW can also be used to
delete(erase, or wipe) a primary partition entry. For example,

partnew (hd0,3) 0 0 0

which will empty the last entry in the partition table in MBR. Generally,
you should use the form of "partnew PARTITION 0 0 0" to erase the entry.
Note that only the entry would be erased, and the data stored in the partition
will not be touched.


cheers.gif
jaclaz
wimb_2
QUOTE (jaclaz @ Jun 21 2011, 04:15 PM) *
@wimb
You can allright change a logical volume inside extended to a primary one by simply making an entry for it in the partition table, though you will need to fix "sectors before" (or use the grub4dos "specific" command "partnew" that should automatically fix that).

Instead of using grub4dos partnew command, I was thinking more of a simple utility running in Windows,
that would exchange first and second partition entry in the MBR of the USB-stick.

This can be useful in case of two primary partitions to change which partition of the USB-stick will be visible in Windows.
Exchange of partition entries followed by disconnect and reconnect will make the other primary partition visible in Windows.
Manually this is working already ....
jaclaz
QUOTE (wimb_2 @ Jun 21 2011, 07:17 PM) *
Instead of using grub4dos partnew command, I was thinking more of a simple utility running in Windows,
that would exchange first and second partition entry in the MBR of the USB-stick.

This can be useful in case of two primary partitions to change which partition of the USB-stick will be visible in Windows.
Exchange of partition entries followed by disconnect and reconnect will make the other primary partition visible in Windows.
Manually this is working already ....

Yes smile.gif, but this happens either "after" or "before next" booting (and as said it may be a complement to the "on-the-fly" or "at-boot-time" choices that grub4dos offfer).

jaclaz
wimb_2
QUOTE (jaclaz @ Jun 21 2011, 08:22 PM) *
Yes smile.gif, but this happens either "after" or "before next" booting (and as said it may be a complement to the "on-the-fly" or "at-boot-time" choices that grub4dos offfer).

Yes, but ....

- The problem of invisible USB-stick partition occurs in Windows and not when booting otherwise
- In most cases grub4dos is not used for booting Windows

That means that what you need most is a Windows utility to flip the USB-stick partition being visible.

cheers.gif
jaclaz
How hard can it be? wink.gif
http://en.wikipedia.org/wiki/Top_Gear_chal...rd_can_it_be.3F

CHPTNORD.CMD attached (as in CHange ParTitioN ORDer).

Obviously ALPHA stage, potentially dangerous (if you UNREM the lines that need to be UNREMmed to actually write to PhysicalDrive).

cheers.gif
jaclaz

P.S.: Attached removed, see newer version a few posts below
wimb_2
QUOTE (jaclaz @ Jun 22 2011, 02:45 PM) *
Obviously ALPHA stage, potentially dangerous (if you UNREM the lines that need to be UNREMmed to actually write to PhysicalDrive).

Nice, but ....

I did not dare to UNREM dsfi command since %DriveNum% is not defined ninja.gif

Also it would be better if using it was limited to Removable drives.

cheers.gif
wimb_2
Stick_Part_Flip.exe program - For USB-stick with two primary partitions

It allows to change which primary partition of the USB-stick is visible in Windows

Usage:

- Select Target Drive of Removable USB-stick and Press GO

Tested in 32-bits XP and Win7 OS but may work as well in other Windows OSes

EDIT: Replaced by USB_Part_Flip.exe see some posts below

cheers.gif
jaclaz
QUOTE (wimb_2 @ Jun 22 2011, 04:55 PM) *
Nice, but ....

I did not dare to UNREM dsfi command since %DriveNum% is not defined ninja.gif

ALPHA 0.02 attached, added also some minimal error check on input.

It's anyway a half @§§ed batch quickly made by assembling snippets of mbrbatch.cmd and some other semi-random batches of mine. blush.gif
The reference to Top Gear was not incidental...whistling.gif

QUOTE (wimb_2 @ Jun 22 2011, 04:55 PM) *
Also it would be better if using it was limited to Removable drives.

Maybe yes, maybe no.
JFYI wink.gif:
http://www.msfn.org/board/topic/120444-how.../page__st__1408

jaclaz
wimb_2
QUOTE (jaclaz @ Jun 23 2011, 11:18 AM) *

OK I see.

We can also limit its use to USB-disks (Fixed + Removable) so that we are sure (for safety) that the MBR of built-in HDD disks cannot be changed.

Then the name of my program will be USB_Part_Flip.exe thumbsup.gif

cheers.gif
wimb_2
=

USB_Part_Flip.exe program - For USB-stick with two primary partitions

It allows to change which primary partition of the USB-stick is visible in Windows

Optionally the program can be used on USB-harddisks to make similar change in the partition table
e.g. reverse the sequence of 1st and 2nd entry in the MBR partition table

Usage:
- Select Target Drive of Removable USB-stick and Press GO


Download - USB_Part_Flip

This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.