public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* completely hide parts of the partition table from Windows?
@ 2009-08-18 21:22 Mikael Pettersson
  2009-08-18 22:32 ` Alan Cox
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Mikael Pettersson @ 2009-08-18 21:22 UTC (permalink / raw)
  To: linux-kernel; +Cc: Andries Brouwer

The BIOS on my laptop clips disk capacities to 128GB. There's no BIOS
update or BIOS setup option to fix this. Passing libata.ignore_hpa=1
allows the Linux kernel to access larger disks, so Linux does work Ok
with larger disks.

However, the laptop dual-boots Windows (for work-related stuff), and
Windows has a major problem: if any entry in the msdos partition table
refers to a sector above the BIOS 128GB limit, the Windows kernel
crashes and reboots early in its boot sequence. The type of the
partition doesn't matter, the fact that it describes an area above
the stupid BIOS limit is enough to trigger the crash.

So what I'm looking for is some sub-partition table format with the
following two properties:
1. resides in an msdos partition entry of a type that Windows does
   not inspect (for whatever extended partitions or Apple/BSD/Sun
   stuff that Windows may have been taught to recognize)
2. the locations and sizes of the sub-partitions are NOT limited by
   the parent msdos partition entry

I've looked at the code in fs/partitions/msdos.c, and it seems that
most of the extended/BSD/Sun formats don't give me property #2 above.

The minix and Unixware format parsers look like they ignore the parent
msdos partion entry boundaries, but I'm not sure if that's by design
or just sloppy coding.

Any recommendations? If no existing partition table format is suitable
for my use case then I'm perfectly willing to invent a simple new format
and add the corresponding parser to the kernel.

/Mikael

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: completely hide parts of the partition table from Windows?
  2009-08-18 21:22 completely hide parts of the partition table from Windows? Mikael Pettersson
@ 2009-08-18 22:32 ` Alan Cox
  2009-08-18 23:49   ` Mikael Pettersson
  2009-08-18 22:35 ` Andries E. Brouwer
  2009-08-18 22:39 ` Matthias Schniedermeyer
  2 siblings, 1 reply; 10+ messages in thread
From: Alan Cox @ 2009-08-18 22:32 UTC (permalink / raw)
  To: Mikael Pettersson; +Cc: linux-kernel, Andries Brouwer

> Any recommendations? If no existing partition table format is suitable
> for my use case then I'm perfectly willing to invent a simple new format
> and add the corresponding parser to the kernel.

Or if its not the boot partition can you not just tell device mapper about
it and create a device mapper device of the offset ?

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: completely hide parts of the partition table from Windows?
  2009-08-18 21:22 completely hide parts of the partition table from Windows? Mikael Pettersson
  2009-08-18 22:32 ` Alan Cox
@ 2009-08-18 22:35 ` Andries E. Brouwer
  2009-08-18 23:56   ` Mikael Pettersson
  2009-08-18 22:39 ` Matthias Schniedermeyer
  2 siblings, 1 reply; 10+ messages in thread
From: Andries E. Brouwer @ 2009-08-18 22:35 UTC (permalink / raw)
  To: Mikael Pettersson; +Cc: linux-kernel, Andries Brouwer

On Tue, Aug 18, 2009 at 11:22:30PM +0200, Mikael Pettersson wrote:

> So what I'm looking for is some sub-partition table format with the
> following two properties:
> 1. resides in an msdos partition entry of a type that Windows does
>    not inspect (for whatever extended partitions or Apple/BSD/Sun
>    stuff that Windows may have been taught to recognize)
> 2. the locations and sizes of the sub-partitions are NOT limited by
>    the parent msdos partition entry

The reason I added type 85 = LINUX_EXTENDED_PARTITION
was precisely your concern: it should be something
that DOS/Windows doesnt know about.

> I've looked at the code in fs/partitions/msdos.c, and it seems that
> most of the extended/BSD/Sun formats don't give me property #2 above.

The standard description of extended partitions says that the size field
of the parent extended partition descriptor is irrelevant, only the
starting sector matters.

If you look at the parse_extended() code in msdos.c you'll see
that it does not use its parameter first_size.
(Except in a certain case that you will not be in.)

Make a table that has a Linux extended partition (type 85)
that is short enough not to cause Windows to worry. Have logical
partitions inside of any size and location you desire.

Andries


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: completely hide parts of the partition table from Windows?
  2009-08-18 21:22 completely hide parts of the partition table from Windows? Mikael Pettersson
  2009-08-18 22:32 ` Alan Cox
  2009-08-18 22:35 ` Andries E. Brouwer
@ 2009-08-18 22:39 ` Matthias Schniedermeyer
  2 siblings, 0 replies; 10+ messages in thread
From: Matthias Schniedermeyer @ 2009-08-18 22:39 UTC (permalink / raw)
  To: Mikael Pettersson; +Cc: linux-kernel, Andries Brouwer

On 18.08.2009 23:22, Mikael Pettersson wrote:
> The BIOS on my laptop clips disk capacities to 128GB. There's no BIOS
> update or BIOS setup option to fix this. Passing libata.ignore_hpa=1
> allows the Linux kernel to access larger disks, so Linux does work Ok
> with larger disks.
> 
> However, the laptop dual-boots Windows (for work-related stuff), and
> Windows has a major problem: if any entry in the msdos partition table
> refers to a sector above the BIOS 128GB limit, the Windows kernel
> crashes and reboots early in its boot sequence. The type of the
> partition doesn't matter, the fact that it describes an area above
> the stupid BIOS limit is enough to trigger the crash.
> 
> So what I'm looking for is some sub-partition table format with the
> following two properties:
> 1. resides in an msdos partition entry of a type that Windows does
>    not inspect (for whatever extended partitions or Apple/BSD/Sun
>    stuff that Windows may have been taught to recognize)
> 2. the locations and sizes of the sub-partitions are NOT limited by
>    the parent msdos partition entry
> 
> I've looked at the code in fs/partitions/msdos.c, and it seems that
> most of the extended/BSD/Sun formats don't give me property #2 above.
> 
> The minix and Unixware format parsers look like they ignore the parent
> msdos partion entry boundaries, but I'm not sure if that's by design
> or just sloppy coding.
> 
> Any recommendations? If no existing partition table format is suitable
> for my use case then I'm perfectly willing to invent a simple new format
> and add the corresponding parser to the kernel.

This is problem sligtly similar to my "I don't care about partitions i 
only want to use the whole HDD for storage".

The solution i use for my problem is 'loop' (My HDDs are encrypted so 
the loop(-AES) wasn't optional anyway). With a loop you can use any 
place in any size on the HDD like it is a partition, you just have to be 
careful to place it correctly.

The first time you have to losetup the loop so that you can mkfs it:
losetup /dev/loop<whatever> /dev/sd<whatelse> -o <offset> --sizelimit=<size_in_byte>

After the filesystem is created you can use something along this lines:
mount /dev/sd<whatelse> /<mountpoint> -oloop,offset=<offset>,sizelimit=<size_in_bytes>[...]

If you place the area last on the device, you can skip sizelimit then 
the loop uses the whole avaiable space to the end of the device.


AFAIK you can also use "device-mapper" in a similar way, i just don't 
have any personal experiences.

And last but not least, the documentation of GRUB meantions a 'hide'-bit 
for partitions and suggests that DOS/Windows honours it. Maybe setting 
the 'hide'-bit is enough.




Bis denn

-- 
Real Programmers consider "what you see is what you get" to be just as 
bad a concept in Text Editors as it is in women. No, the Real Programmer
wants a "you asked for it, you got it" text editor -- complicated, 
cryptic, powerful, unforgiving, dangerous.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: completely hide parts of the partition table from Windows?
  2009-08-18 22:32 ` Alan Cox
@ 2009-08-18 23:49   ` Mikael Pettersson
  2009-08-22 22:54     ` Mikael Pettersson
  0 siblings, 1 reply; 10+ messages in thread
From: Mikael Pettersson @ 2009-08-18 23:49 UTC (permalink / raw)
  To: Alan Cox; +Cc: Mikael Pettersson, linux-kernel, Andries Brouwer

Alan Cox writes:
 > > Any recommendations? If no existing partition table format is suitable
 > > for my use case then I'm perfectly willing to invent a simple new format
 > > and add the corresponding parser to the kernel.
 > 
 > Or if its not the boot partition can you not just tell device mapper about
 > it and create a device mapper device of the offset ?

I have no experience with the device mapper, but I'll give it a
try and see how it works out. Thanks for the suggestion.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: completely hide parts of the partition table from Windows?
  2009-08-18 22:35 ` Andries E. Brouwer
@ 2009-08-18 23:56   ` Mikael Pettersson
  2009-08-22 22:59     ` Mikael Pettersson
  0 siblings, 1 reply; 10+ messages in thread
From: Mikael Pettersson @ 2009-08-18 23:56 UTC (permalink / raw)
  To: Andries E. Brouwer; +Cc: Mikael Pettersson, linux-kernel

Andries E. Brouwer writes:
 > On Tue, Aug 18, 2009 at 11:22:30PM +0200, Mikael Pettersson wrote:
 > 
 > > So what I'm looking for is some sub-partition table format with the
 > > following two properties:
 > > 1. resides in an msdos partition entry of a type that Windows does
 > >    not inspect (for whatever extended partitions or Apple/BSD/Sun
 > >    stuff that Windows may have been taught to recognize)
 > > 2. the locations and sizes of the sub-partitions are NOT limited by
 > >    the parent msdos partition entry
 > 
 > The reason I added type 85 = LINUX_EXTENDED_PARTITION
 > was precisely your concern: it should be something
 > that DOS/Windows doesnt know about.
 > 
 > > I've looked at the code in fs/partitions/msdos.c, and it seems that
 > > most of the extended/BSD/Sun formats don't give me property #2 above.
 > 
 > The standard description of extended partitions says that the size field
 > of the parent extended partition descriptor is irrelevant, only the
 > starting sector matters.
 > 
 > If you look at the parse_extended() code in msdos.c you'll see
 > that it does not use its parameter first_size.
 > (Except in a certain case that you will not be in.)

Right. I misread the "process the data partitions" part to imply
that the limits were enforced for all four entries, not just the
last two usually-junk entries. Thanks for clarifiying that.

 > Make a table that has a Linux extended partition (type 85)
 > that is short enough not to cause Windows to worry. Have logical
 > partitions inside of any size and location you desire.

I have created extended partitions with non-default type
(though not 85). I'll see if I can convince fdisk or parted to
create one with entries exceeding the parent's limits.

Thanks,

/Mikael

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: completely hide parts of the partition table from Windows?
  2009-08-18 23:49   ` Mikael Pettersson
@ 2009-08-22 22:54     ` Mikael Pettersson
  0 siblings, 0 replies; 10+ messages in thread
From: Mikael Pettersson @ 2009-08-22 22:54 UTC (permalink / raw)
  To: Mikael Pettersson; +Cc: Alan Cox, linux-kernel, Andries Brouwer

Mikael Pettersson writes:
 > Alan Cox writes:
 >  > > Any recommendations? If no existing partition table format is suitable
 >  > > for my use case then I'm perfectly willing to invent a simple new format
 >  > > and add the corresponding parser to the kernel.
 >  > 
 >  > Or if its not the boot partition can you not just tell device mapper about
 >  > it and create a device mapper device of the offset ?
 > 
 > I have no experience with the device mapper, but I'll give it a
 > try and see how it works out. Thanks for the suggestion.

Doesn't work. I have unpartitioned space at the end of /dev/sda,
but attempting to dmsetup create test --table '0 N linear /dev/sda M'
fails in dm-table:__table_get_device() with -EBUSY. It does seem to
work if the disk in question has no mounted partitions, but that
won't be the case when the disk is in my laptop.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: completely hide parts of the partition table from Windows?
  2009-08-18 23:56   ` Mikael Pettersson
@ 2009-08-22 22:59     ` Mikael Pettersson
  2009-08-23  7:36       ` Andries E. Brouwer
  0 siblings, 1 reply; 10+ messages in thread
From: Mikael Pettersson @ 2009-08-22 22:59 UTC (permalink / raw)
  To: Mikael Pettersson; +Cc: Andries E. Brouwer, linux-kernel

Mikael Pettersson writes:
 > Andries E. Brouwer writes:
 >  > On Tue, Aug 18, 2009 at 11:22:30PM +0200, Mikael Pettersson wrote:
 >  > 
 >  > > So what I'm looking for is some sub-partition table format with the
 >  > > following two properties:
 >  > > 1. resides in an msdos partition entry of a type that Windows does
 >  > >    not inspect (for whatever extended partitions or Apple/BSD/Sun
 >  > >    stuff that Windows may have been taught to recognize)
 >  > > 2. the locations and sizes of the sub-partitions are NOT limited by
 >  > >    the parent msdos partition entry
 >  > 
 >  > The reason I added type 85 = LINUX_EXTENDED_PARTITION
 >  > was precisely your concern: it should be something
 >  > that DOS/Windows doesnt know about.
 >  > 
 >  > > I've looked at the code in fs/partitions/msdos.c, and it seems that
 >  > > most of the extended/BSD/Sun formats don't give me property #2 above.
 >  > 
 >  > The standard description of extended partitions says that the size field
 >  > of the parent extended partition descriptor is irrelevant, only the
 >  > starting sector matters.
 >  > 
 >  > If you look at the parse_extended() code in msdos.c you'll see
 >  > that it does not use its parameter first_size.
 >  > (Except in a certain case that you will not be in.)
 > 
 > Right. I misread the "process the data partitions" part to imply
 > that the limits were enforced for all four entries, not just the
 > last two usually-junk entries. Thanks for clarifiying that.
 > 
 >  > Make a table that has a Linux extended partition (type 85)
 >  > that is short enough not to cause Windows to worry. Have logical
 >  > partitions inside of any size and location you desire.
 > 
 > I have created extended partitions with non-default type
 > (though not 85). I'll see if I can convince fdisk or parted to
 > create one with entries exceeding the parent's limits.

The problem here is that both fdisk and parted refuse to let me
create a logical partition that exceeds the boundaries of the
enclosing extended partition entry. So for this approach I'd have
to find another Linux partitioning tool, or hack e.g. fdisk to
bypass its safety checks (which do make sense for most use cases,
just not for mine).

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: completely hide parts of the partition table from Windows?
  2009-08-22 22:59     ` Mikael Pettersson
@ 2009-08-23  7:36       ` Andries E. Brouwer
  2009-08-23 15:19         ` Mikael Pettersson
  0 siblings, 1 reply; 10+ messages in thread
From: Andries E. Brouwer @ 2009-08-23  7:36 UTC (permalink / raw)
  To: Mikael Pettersson; +Cc: Andries E. Brouwer, linux-kernel

On Sun, Aug 23, 2009 at 12:59:01AM +0200, Mikael Pettersson wrote:

>  >  > Make a table that has a Linux extended partition (type 85)
>  >  > that is short enough not to cause Windows to worry. Have logical
>  >  > partitions inside of any size and location you desire.
> 
> The problem here is that both fdisk and parted refuse to let me
> create a logical partition that exceeds the boundaries of the
> enclosing extended partition entry. So for this approach I'd have
> to find another Linux partitioning tool, or hack e.g. fdisk to
> bypass its safety checks (which do make sense for most use cases,
> just not for mine).

My plan would be (i) create the right logical partitions
(inside a sufficiently large extended one) using any partitioner.
(ii) change the type and size of the outer extended partition only,
for example using sfdisk. The -N option can be used to tell sfdisk
to change only a single partition entry.

Andries


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: completely hide parts of the partition table from Windows?
  2009-08-23  7:36       ` Andries E. Brouwer
@ 2009-08-23 15:19         ` Mikael Pettersson
  0 siblings, 0 replies; 10+ messages in thread
From: Mikael Pettersson @ 2009-08-23 15:19 UTC (permalink / raw)
  To: Andries E. Brouwer; +Cc: Mikael Pettersson, linux-kernel

Andries E. Brouwer writes:
 > On Sun, Aug 23, 2009 at 12:59:01AM +0200, Mikael Pettersson wrote:
 > 
 > >  >  > Make a table that has a Linux extended partition (type 85)
 > >  >  > that is short enough not to cause Windows to worry. Have logical
 > >  >  > partitions inside of any size and location you desire.
 > > 
 > > The problem here is that both fdisk and parted refuse to let me
 > > create a logical partition that exceeds the boundaries of the
 > > enclosing extended partition entry. So for this approach I'd have
 > > to find another Linux partitioning tool, or hack e.g. fdisk to
 > > bypass its safety checks (which do make sense for most use cases,
 > > just not for mine).
 > 
 > My plan would be (i) create the right logical partitions
 > (inside a sufficiently large extended one) using any partitioner.
 > (ii) change the type and size of the outer extended partition only,
 > for example using sfdisk. The -N option can be used to tell sfdisk
 > to change only a single partition entry.

Thanks, sfdisk did the trick.

/Mikael

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2009-08-23 15:19 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-18 21:22 completely hide parts of the partition table from Windows? Mikael Pettersson
2009-08-18 22:32 ` Alan Cox
2009-08-18 23:49   ` Mikael Pettersson
2009-08-22 22:54     ` Mikael Pettersson
2009-08-18 22:35 ` Andries E. Brouwer
2009-08-18 23:56   ` Mikael Pettersson
2009-08-22 22:59     ` Mikael Pettersson
2009-08-23  7:36       ` Andries E. Brouwer
2009-08-23 15:19         ` Mikael Pettersson
2009-08-18 22:39 ` Matthias Schniedermeyer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox