[clug] linux Digest, Vol 117, Issue 1

Eyal Lebedinsky eyal at eyal.emu.id.au
Sat Sep 1 20:55:01 MDT 2012


Tried gdisk now, with same problem. I started by zapping everything (z) then creating
new GPT etc. It still said sector size is 512B. Where does it get it from? I see
	# cat /sys/bus/scsi/devices/8:0:9:0/block/sdi/queue/hw_sector_size
	512
Is it related?

Is it possible that a protective MBR is created with the wrong sector size (512B)
and sectors count? Is there a way to get it set up based on the disk physical
sector size?

I tried to set up the disk using 'fdisk -b 4096' but it still limited the size.
Moreover, changing the number of cylinders (to 33418) did *not* change the total
number of sectors(note 'total 536870911 sectors'). So no beef.

If all else fails, if I manually edit the first few words of the MBR, will it make
things work or will it just break it?

Eyal

=========== start of fdisk
# fdisk -b 4096 /dev/sdi
Note: sector size is 4096 (not 512)

Command (m for help): p

Disk /dev/sdi: 2199.0 GB, 2199023251456 bytes
255 heads, 63 sectors/track, 33418 cylinders, total 536870911 sectors
Units = sectors of 1 * 4096 = 4096 bytes
Sector size (logical/physical): 4096 bytes / 4096 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0f9a1a03

    Device Boot      Start         End      Blocks   Id  System

Command (m for help): x

Expert command (m for help): c
Number of cylinders (1-1048576, default 33418): 45600

Expert command (m for help): p

Disk /dev/sdi: 255 heads, 63 sectors, 45600 cylinders			<<<<< new value

Nr AF  Hd Sec  Cyl  Hd Sec  Cyl     Start      Size ID
  1 00   0   0    0   0   0    0          0          0 00
  2 00   0   0    0   0   0    0          0          0 00
  3 00   0   0    0   0   0    0          0          0 00
  4 00   0   0    0   0   0    0          0          0 00

Expert command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root at e7 ~]# fdisk -b 4096 /dev/sdi
Note: sector size is 4096 (not 512)

Command (m for help): p

Disk /dev/sdi: 2199.0 GB, 2199023251456 bytes
255 heads, 63 sectors/track, 33418 cylinders, total 536870911 sectors	<<<<< 33418 is back
Units = sectors of 1 * 4096 = 4096 bytes
Sector size (logical/physical): 4096 bytes / 4096 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0f9a1a03

    Device Boot      Start         End      Blocks   Id  System

Command (m for help): q

# fdisk -b 4096 /dev/sdi
Note: sector size is 4096 (not 512)

Command (m for help): p

Disk /dev/sdi: 2199.0 GB, 2199023251456 bytes
255 heads, 63 sectors/track, 33418 cylinders, total 536870911 sectors
Units = sectors of 1 * 4096 = 4096 bytes
Sector size (logical/physical): 4096 bytes / 4096 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xc8f2ef86

    Device Boot      Start         End      Blocks   Id  System

Command (m for help): n
Partition type:
    p   primary (0 primary, 0 extended, 4 free)
    e   extended
Select (default p):
Using default response p
Partition number (1-4, default 1):
Using default value 1
First sector (256-536870910, default 256):
Using default value 256
Last sector, +sectors or +size{K,M,G} (256-536870910, default 536870910):
Using default value 536870910

Command (m for help): p

Disk /dev/sdi: 2199.0 GB, 2199023251456 bytes
255 heads, 63 sectors/track, 33418 cylinders, total 536870911 sectors
Units = sectors of 1 * 4096 = 4096 bytes
Sector size (logical/physical): 4096 bytes / 4096 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xc8f2ef86

    Device Boot      Start         End      Blocks   Id  System
/dev/sdi1             256   536870910  2147482620   83  Linux
=========== end of fdiskOn 09/02/12 08:06, rodneyp at pcug.org.au wrote:

> On Sat, 1 Sep 2012 12:00:03 eyal wrote:
>> Message: 2
>> Date: Sat, 01 Sep 2012 18:49:42 +1000
>> From: Eyal Lebedinsky <eyal at eyal.emu.id.au>
>> To: list CLUG <linux at lists.samba.org>
>> Subject: [clug] 3TB (4k sector) disk question
>> Message-ID: <5041CC26.1030603 at eyal.emu.id.au>
>> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>>
>> [This is up to date f16]
>>
>> Today I bought a 3TB disk, which originally was in a USB3 case (now out of
>> it).
>>
>> When introduced linux (as bare SATA) it seems that a sector size of 512B is
>> used, and the disk size is limited.
>>
>> 'hdparm -I' knows that this is a native 4k disk:
>>          Model Number:       ST3000DM001-9YN166
>>          Logical  Sector size:                   512 bytes
>>          Physical Sector size:                  4096 bytes
>>          Logical Sector-0 offset:                  0 bytes
>>          device size with M = 1024*1024:     2861588 MBytes
>>          device size with M = 1000*1000:     3000592 MBytes (3000 GB)
>>
>> However parted thinks otherwise (I created one large GPT partition):
>>
>> # parted /dev/sdi
>> GNU Parted 3.0
>> Using /dev/sdi
>> Welcome to GNU Parted! Type 'help' to view a list of commands.
>> (parted) print
>> Model: ATA ST3000DM001-9YN1 (scsi)
>> Disk /dev/sdi: 2199GB
>> Sector size (logical/physical): 512B/512B
>> Partition Table: gpt
>>
>> Number  Start   End     Size    File system  Name     Flags
>>    1      1049kB  2199GB  2199GB  ext2         primary
>>
>> Note the line 'Sector size (logical/physical): 512B/512B'.
>>
>> How do I make linux use 4k sector size? Or is there a jumper
>> on the disk? Or a special SATA command to configure the disk?
>>
>> Also, should GPT not be able to create very large disks even with 512B
>> sectors, using the 64bit internal pointers/sizes/etc.? Where is the
>> disk size limit coming from?
>>
>> TIA
>>          Eyal
>>
>> --
>> Eyal Lebedinsky (eyal at eyal.emu.id.au)
>
> I've sucessfully partitoned HDD as small as *4 GB* with GPT using parted or
> gdisk.  The latter has much better defaults, implements more of the GPT
> features and optimises the disk better for 4k physical sectors/blocks.
>
> No jumpers were required - however I've never had a 3 TB disk.   It's possible
> that the latter have a jumper to nobble them back to 512 B sectors, for
> Windows.
>
> openSUSE & Ubuntu handle GPT partition tables correctly, from my first hand
> experience, as do their patched GRUB 0.97.  I would expect Fedora to do
> likewise.
>
> I suggest that you let  gdisk 'have its head" in creating a new disk label and
> aligning partitions to 1 MBi boundaries etc..  Several factors to consider for
> a well implemented GPT, particularly if used with a (U)EFI mainboard - see
>
>   http://www.rodsbooks.com/gdisk/
>

-- 
Eyal Lebedinsky	(eyal at eyal.emu.id.au)


More information about the linux mailing list