You are here:Home»KB»Hardware»My Hard Drive Sectors and LBA Formats Notes
Wednesday, 30 August 2023 06:44

My Hard Drive Sectors and LBA Formats Notes

Written by

 

  • When I talk about hard drives in this article, this will include spinning disks (rust drives), SSD, SAS and NVMe unless specified otherwise.
  • If your drive supports 4Kn, you should set it to this mode. It is better for performance, and if it was not, they would not of made it. There is a reason the internal physical sectors are 4096B, So why emulate 512 sectors with the etra processing layer.

Advanced Format, LBA Formats and Sector Sizes

There are several types of LBA formats or sector size configurations as shown in the table below. However there are a lot of custom sector configurations that various manufactures have used in the past. These custom configurations I think are now being phased out in favour of new standards.

Traditional hard drives had a sector size set on the drive and that was it, but now there is a new format called, `Advanced Format`. The new format has a physical sector size and a logical sector size allowing to the drive to utilise the benefits of a larger sector size internally but present an emulated logical sector size to older host controllers allow the drive to be used on these older platforms where they do not support the new sector size natively.

Advanced format drives need to have 4096 Byte physical sectors and be able to support 512B/4096B as logical sectors (i think).

The sector size (logical/physical) is controlled by the hard drive, not the OS of file system. Most drives will not let you change the sector settings, but professional spinning drives or NVMe usually allow their sector size to be to be changed. I do not know if any SSD have this feature. This functionality is built into the NVMe standard so there are several utilities that are not vendor specific but for spinning drives, it is via vendor specific software from each of the various manufacturers if the drive supports it.

Format Logical Sector Size (Bytes)
Physical Sector Size (Bytes)

LBA Format
(NVMe Only)

Identification
Logo
Notes
           
512n 512 512 n/a n/a Legacy format
512e 512 4096 0 AF 512 sectors are emulated
4Kn 4096 4096 1 4Kn New standard
  • e = emulated
  • n = native

Advanced Format - ArchWiki - This article explain in detail the 'Advanced Format' and tells how to get Sector Size and LBA format information from your drives aswell as how to change their modes. Read this article first and the rest will be easy.

My General Notes

Some note I have compiled about the whole process.

  • What are Advanced Format, Sector Sizes, 512n, 512e, 4kn?
    • Why are there logical and physical sectors defined?
      • This is so the hard drive can take advantage of reading and writing physical sectors in 4k blocks while presenting 512B logical sectors to the controller and therefore the OS. This feature allows for old systems to use these newer drives.
      • Most if not all computers now can use 4K sectors natively.
    • Advanced Format HDD Technology Overview (Lenovo) (PDF)
      • This is an extremely in-depth but easy to read paper that fully explains the Advanced Format (AF) in detail and explains why you can see different sector sizes.
      • Sectors and Emulation
        • Physical Sector  is the minimum amount of data that the HDD can read from or write to the physical media in a single I/O. For Advanced Format HDDs, the physical sector size is 4 KB.
        • Logical sector is the addressable logical block, which is the minimum amount of data that the HDD can address. This amount is also the minimum amount of data that the host system can deliver to or request from the HDD in a single I/O operation. Advanced Format HDDs support 512-bytes and 4-KB logical sizes.
        • This separation allows applications that query the drive's sector sizes to detect drive format and properly align their storage I/O operations to sector boundaries. For applications that expect 512-byt sector HDD formats and do not query sector sizes, this separation establishes a path to 512-byte emulation.
        • The Advanced Format 4Kn HDDs transfer data to and from host by using native 4-KB blocks. The system must support 4Kn HDDs at all levels: architecture, disk partition structures, UEFI, firmware, adapters, drivers, operating system and software.
      • The Advanced Format 4Kn HDDs transfer data to and from host by using native 4-KB blocks. The system must support 4Kn HDDs at all levels: architecture, disk partition structures, UEFI, firmware, adapters, drivers, operating system and software.
      • and so on.......
    • Advanced Format - Wikipedia
    • Hardware - Sector Size — OpenZFS documentation
      • Historically, all hard drives had 512-byte sectors, with the exception of some SCSI drives that could be modified to support slightly larger sectors. In 2009, the industry migrated from 512-byte sectors to 4096-byte “Advanced Format” sectors. Since Windows XP is not compatible with 4096-byte sectors or drives larger than 2TB, some of the first advanced format drives implemented hacks to maintain Windows XP compatibility.
      • The first advanced format drives on the market misreported their sector size as 512-bytes for Windows XP compatibility. As of 2013, it is believed that such hard drives are no longer in production. Advanced format hard drives made during or after this time should report their true physical sector size.
      • Drives storing 2TB and smaller might have a jumper that can be set to map all sectors off by 1. This to provide proper alignment for Windows XP, which started its first partition at sector 63. This jumper setting should be off when using such drives with ZFS.
      • As of 2014, there are still 512-byte and 4096-byte drives on the market, but they are known to properly identify themselves unless behind a USB to SATA controller. Replacing a 512-byte sector drive with a 4096-byte sector drives in a vdev created with 512-byte sector drives will adversely affect performance. Replacing a 4096-byte sector drive with a 512-byte sector drive will have no negative effect on performance.
    • What are 4K sector hard drives? What is Windows Support Policy? - As technology advances, we'll soon see more 4K sector hard drives in future. Does Microsoft support this standard and format on Windows OS? Read here!
    • Transition to Advanced Format 4K Sector Hard Drives | Seagate UK - Hard drive companies are migrating from 512 bytes to a larger, more efficient sector size of 4,096 bytes, referred to as 4K sectors. Learn about this transition.
    • Internal Drive Advanced Format 4k Sector Size Support and Information
      • A brief descriptions of the different LBA formats and their benefits.
        • 4K native (4Kn)
          • Logical and physical sectors capable of holding 4,096 bytes of data.
          • Sector size larger than traditional 512 byte sector size.
          • Improved performance, better error correction, increased storage density, and efficient handling of larger files.
          • Limited compatibility with older operating systems.
          • Sector Size
            • Format Type: 4K native (4Kn)
            • Logical bytes per sector: 4096 bytes
            • Physical Sectors: 4096 bytes
        • 512 emulated (512e)
          • Physical sector size of 4,096 bytes while emulating 512 byte sector size.
          • Compatible with systems and applications designed for traditional 512 byte sector size.
          • Translation layer handles conversion between physical 4K sectors and logical 512 byte sectors.
          • Backward compatibile but may not offer same performance advantages as native 4K drives.
          • Sector Size
            • Format Type: 512 emulated (512e)
            • Logical bytes per sector: 512 bytes
            • Physical Sectors: 4096 bytes
        • 512 native (512n)
          • Sector size of 512 bytes.
          • Logical and physical sectors of storage device hold 512 bytes of data.
          • Lower storage density compared to 4K native.
          • 512 native are not 4K drives.
          • 4K native may offer better performance advantages than 512 native drives.
          • Sector Size
            • Format Type: 512 native (512n)
            • Logical bytes per sector: 512 bytes
            • Physical Sectors: 512 bytes
    • What is 4Kn Drives and Differences between 512e Drives - Rene.E Laboratory - Find the disk is marked with AF or 4Kn when purchsing? What are they and the differences? Overall introduction of AF and 4Kn drives will be provided.
    • What is 4k Native Hard Drive? Can Data on 4k HDD be Recovered - Complete guide to explore about 4K sectored hard drives. We’ve also mentioned feasible solution to recover lost data from 4K Native HDD smoothly.
  • Cluster Size
    • What Should I Set the Allocation Unit Size to When Formatting? | how-to-geek - What does "Allocation unit size" mean, anyway?
    • Default cluster size for NTFS, FAT, and exFAT - Microsoft Support
      • Describes the default values that are used by Windows when a volume is formatted to NTFS, FAT or exFAT.
      • All file systems that are used by Windows organize your hard disk based on cluster size (also known as allocation unit size). Cluster size represents the smallest amount of disk space that can be used to hold a file. When file sizes do not come out to an even multiple of the cluster size, additional space must be used to hold the file (up to the next multiple of the cluster size).
      • Full tables of all default cluster sizes.
    • Anatomy of hard disk clusters | TechRepublic
      • Understand the anatomy of hard disk clusters will help you interpret what goes on behind the scenes during your basic maintenance functions. Talainia Posey gives you the details.
      • Each partition on your hard disk is subdivided into clusters. A cluster is the smallest possible unit of storage on a hard disk.
    • [Allocation Unit Size FAT32 Explained] What Allocation Unit Size Should I Use for FAT32 - EaseUS
      • This article explained Allocation Unit Size FAT32. When you formatting your USB drive, you may just click the format tab and wait for the process to finish. Actually, you need to do more than that. For example, choose a proper allocation unit size. In this article, we will tell you what allocation unit size you should use for FAT32 drive.
      • This has a table of default cluster sizes for various different sizes of FAT and NTFS partitions.
    • How to Change SSD Cluster Size? 2023 Best Guide - EaseUS - We cover everything to know about changing cluster size on your SSD, including what cluster size is and what hard disk partition formats like exFAT are.
    • How to choose the right cluster size - When we format a volume or create a new simple volume, we're asked to choose a cluster size, if we choose to skip this option, the System will default it to 4k on NTFS partition in most of the cases unless the disk capacity is over 32T.
  • OS Compatibility
    • Advanced format disk compatibility update - Compatibility Cookbook | Microsoft Learn
      • Due to new physical media formats supported in Windows 8, it is no longer safe for programs to make assumptions on the sector size of modern storage devices.
      • This article is an updated version of the article titled “512-byte Emulation (512e) Disk Compatibility Update” which was released for Windows 7 SP1 and Windows Server 2008 R2 SP1. This update contains much new info, some of which is applicable only to Windows 8 and Windows Server 2012.
    • FAQ: Support statement for 512e and 4K Native drives for VMware vSphere and vSAN (2091600) | VMware Knowledge Base
      • This article provides FAQs about support for 512e and 4K Native (4Kn) drives for GA versions of VMware vSphere and VMware vSAN (formerly known as Virtual SAN).
      • It has a section tells you what 4K Native and 512e drives are.
      • If both physical and logical sectors are showing 4096, you are running on 4KN.
      • 512e is the advanced format in which the physical sector size is 4,096 bytes, but the logical sector size emulates 512 bytes sector size. The purpose of 512e is for the new devices to be used with OSs that do not support 4Kn sectors yet. However, inherently, 512-byte emulation involves a read-modify-write process in the device firmware for every write operation that is not 4KB aligned.
    • Device Sector Formats | VMWare - ESXi supports storage devices with traditional and advanced sector formats. In storage, a sector is a subdivision of a track on a storage disk or device. Each sector stores a fixed amount of data.
  • Emulated sectors and backwards compatibility
    • why has windows installed using 512bytes per sector - Bing Search
      • Hard drive manufacturers emulate a sector with a length of 512 bytes to increase compatibility, especially for use as a boot drive. Many software products and even operating systems have hardcoded 512 as a sector and do not query the drive, so they fail when handling drives with a sector size different from 512 bytes. The drives are physically a 4k block storage, but the firmware in them is presenting the drive as 512 byte sectors, primarily for backwards compatibility with systems that don't recognize the 4k sector format. Only Windows 8 supports use of 4k sectors.
    • storage - Why do hard drives still use 512 bytes emulated sectors? - Super User
      • The reason hard drive manufacturers emulate a sector with a length of 512 byte is to increase compatibility - especially for the use as a boot drive.
      • Loads of software products and even operating systems have hardcoded 512 as a sector and do not query the drive.
      • They fail when handling drives with a sector size different from 512 bytes.
      • Misalignment - as others pretend - only results in performance degradation and additional hard drive wear but is no reason for a harddrive to show virtual sectors with a size of 512 bytes. It is rather the opposite: The effort to maintain compatibility by showing sectors of 512 bytes to the world outside of the hard drive which then have to assigned to internal sectors of 4096 byte by the firmware of the hardware causes alignment problems.
    • hard drive - Will I harm my SSD if Windows 10 image created from an old HDD with 512 bytes per sector is installed on it? - Super User
      • Many manufacturers have set their hard disks to 4k per sector but considering compatibility with operating system, manufacturers emulate a 4k sector to 8 512-byte sectors to manage data, which is the so called 512e.
      • Moreover, as NTFS becomes the standard file system whose default allocation unit size (cluster size) is 4K, the physical 4K sector may be misaligned with the 4K cluster.
      • As a result, reading data in 1 cluster will read 2 physical 4K sectors so that data read and write speed will be reduced. Cluster size is set by the system rather than hard disk manufacturers.
      • Therefore, it is very necessary to make them aligned if we want to get best SSD optimization, and to align partition can achieve this goal.
    • Change Bytes per Physical Sector - Microsoft Q&A
      • The sector size is an inherent characteristic of the drive and cannot be changed. 512 bytes was the most common size but many newer drives are now 4096 bytes (4K).
      • The drives are physically a 4k block storage, but the firmware in them is presenting the drive as 512 byte sectors, which is why you see a physical and logical sector size that are different. this is primarily for backwards compatibility with systems that don't recognize the 4k sector format.
    • 4Kn Hard Drives & Backwards RAID Compatibility | TechMikeNY
      • This post will give some background on 4Kn sectored drives and some compatibility issues with Dell and HP RAID controllers that are not compatible with 4Kn hard drives.
      • 4Kn hard drives (4K = 4096 bytes; n = native)
      • AF (512e / 512/Emulated)) - Added into the family of Advanced Format (AF) drives, you have 512e (e = emulation). Because the sector size impacts the read & write protocols of a drive, a middle-ground solution was developed to allow the transition between 512n and 4Kn drives. A 512e formatted drive has 4K-bytes per physical sector but maintains 512-bytes per logical sector. Put simply, the logical sector “tricks,” or emulates, the system into thinking it is a 512-byte formatted drive, while the physical sector remains 4K. 512e formatted drives allow for the installation of Advanced Format drives into devices running an OS that does not support 4Kn sectored drives.
      • Advanced Format is a group of formats or standard with different flavours and this article explains them.
  • Should i be using 4096 Byte logical sectors on my HDD (4Kn)?
    • Yes: Because of improved performance, better error correction, increased storage density, and efficient handling of larger files. 512n is classed as the legacy format and 512e was a bridge technology between 512n and 4Kn.
    • should i be using Bytes/Sector 4096 on my SSD - Bing Search
      • On modern drives, it is recommended to use a cluster size of 4096 bytes or a multiple of that, aligned to a multiple of 4096 bytes. This is because all modern drives have 4096 byte sectors, normally exposed as virtual 512 byte sectors for compatibility reasons. When you create a 4096 block size, it is made up of eight 512 byte physical sectors. This means that even if the system only needs one 512 byte sector of information, the drive reads eight 512 byte sectors to get it.
    • Is the default 512 byte physical sector size appropriate for SSD disks under Linux? - Ask Ubuntu
      • In the old days, 512 byte sectors was the norm for disks. The system used to read/write sectors only one sector at a time, and that was the best that the old hard drives could do.
      • Now, with modern drives being so dense, and so fast, and so smart, reading/writing sectors only one sector at a time really slows down total throughput.
      • The trick was... how do you speed up total throughput, but still maintain compatibility with old/standard disk subsystems? You create a 4096 block size that are made up of eight 512 byte physical sectors. 4096 is now the minimum read/write transfer to/from the disk, but it's handed off in compatible 512 byte chucks to the OS.
      • This means that even if the system only needs one 512 byte sector of information, the drive reads eight 512 byte sectors to get it. If however, the system needs the next seven sectors, it's already read them, so no disk I/O needs to occur... hence a speed increase in total throughput.
      • Modern operating systems can fully take advantage of native 4K block sizes of modern drives.
    • 512E vs 4KN NVME Performance - Carlos Felicio - In this blog post, we evaluate performance between different physical sector formats (namely 512 and 4096 bytes).
    • Why 4K drive recommended for OS installation? | Dell US - This blog helps to understand why the transition happened from 512 bytes sector disk to 4096 bytes sector disk. The blog also gives answers to why 4096 bytes (4K) sector disk should be opted for OS installation. The blog first explains about sector layout to understand the need of migration, then gives reasoning behind the migration and finally it covers the benefits of 4K sector drive over 512 bytes sector drive.
    • Setting 4k sector size on NVMe SSDs: does performance actually change? | TechPowerUp Forums
      • In-Depth research with various useful links.
      • NVMe specifications allow the host to send specific low-level commands to the SSD in order to permanently format the drive to 4096 bytes logical sector size (it is possible to go back to a 512 bytes size in the same way). Not all NVMe SSDs have this capability.
      • Most client-oriented storage operates by default in "512-bytes emulation" mode, where although the logical sector size is 512 byes/sector, internally the firmware uses 4096 bytes/sector. Storage with a 4096 byte size for both logical and physical sectors operates in what is commonly called "4K native" mode or "4Kn". Due to possible software compatibility issues that have still not been completely solved yet (for instance, cloning partitions from a 512B drive to a 4096B drive is not directly possible), these drives tend to be quite rare in the client space and it is mostly enterprise class drives that employ it.
      • Why change this setting? In theory, the 4K native LBA mode would get away with the "translation" the firmware has to do with 512-bytes logical sectors to map them to the underlying 4K "physical" arrangement (if a physical/logical distinction makes sense for SSDs) and may offer somewhat higher performance in this way.
      • This is possibly true for fast NVMe SSDs and high-performance (non-Windows) file systems in high-I/O environments, but it is unclear whether Windows performance with ordinary NTFS partitions would be improved, and the subject is sort of obscure and somewhat confusing. Some people for instance may think that the logical sector size is the same as the partition's cluster size (which defaults to 4 kB on Windows), but they are unrelated with each other. Furthermore, changing the logical sector size requires to delete everything on the SSD and basically reinstall the OS from scratch, which makes it even more unlikely for users to attempt it and see if differences arise. This is better tested with brand-new, empty drives.S
    • SN550 - Why it uses 512B sector instead of 4096? - WD SSD Drives & Software - WD Community
      • My WD Blue N550 1TB uses 512B sectors “out of the box”. So I often read modern drives are using 4096B sectors, but in special SSDs, they need it because its their internal size. If using 512B sectors would this make double write cycles and so shortening the lifetime of the drive.
      • This discuss the performance on the different modes and has user feedback along with some technical information.
    • Performance impact of 512byte vs 4K sector sizes - C:Amie (not) Com! - When you are designing your storage subsystem. On modern hardware, you will often be asked to choose between formatting using 512 byte or 4K (4096 byte) sectors. This article discusses whether there is any statistically observable performance difference between the two in a 512 vs. 4K performance test.
    • 4k Sectors vs 512 Byte Sector Benchmarks, and a 20 Year Reflection
      • I have, in a server I’ve built, some new Exos x16 drives. These drives are interesting in that they support dynamic switching between 512 byte sectors and 4096 byte sectors - which means that one can actually compare like-for-like performance with sector size!
      • But, these drives support actually switching how they report - they can either report 512 byte sectors to the OS and internally emulator, or they can report 4k native sectors. Does it actually matter? I didn’t know - so I did the work to find out! And, yes, it does.
      • If you write a 512 byte sector, the drive has to read the 4k sector, modify it in cache, and write it back to disk - meaning that there are twice the operations required as just laying down a new 4k sector atomically.
      • Conclusions: Use 4k Sectors!
        • As far as I’m concerned, the conclusions here are pretty clear. If you’ve got a modern operating system that can handle 4k sectors, and your drives support operating either as 512 byte or 4k sectors, convert your drives to 4k native sectors before doing anything else. Then go on your way and let the OS deal with it.
    • Trying to figure out NVME sector size/performance / Newbie Corner / Arch Linux Forums
      • In-depth thread and is investigating slow speed and if this is related to sector size.
      • A:
        • From what little I know about NVME drives, I know that poor performance is usually due to either throttling from high temperatures or misaligned sector-size.
      • A:
        • I know I'm late for this, and this may not be relevant, but I believe I experienced a similar problem a while back when I did a dd if=/dev/sda of=/dev/sdb. My Arch OS was very slow on /dev/sdb afterwards, even though /dev/sda ran fine. Any disk write would be very slow.
        • It turns out HDD's and SSD's don't work the same way, and I wasn't aware of this. An SSD does a lot of work behind the scenes and needs to keep a list of "unused" blocks. I finally stumbled upon a solution and ran`fstrim /` or something similar. This will inform the block driver which blocks are not in use by the file-system and this speeds writes up significantly. Since I used dd, no blocks's weren't readily available. At least that's my vague intuition on how this works.
  • How to convert `file systems` from 512B to 4K sectors?
    • This really only comes into play when you are moving from one physical hard disk to another and they have a different physical sector size.
    • Use dedicated disk imaging software to do the changes for you.
    • The easy way is to move via a disk image Image.
      1. Create an image of the old drive. Dont use RAW, it must be made on the file level.
      2. (Optionally) if using the same hard drive, you should change your sector size now.
      3. Deploy the image on the new drive.
    • windows 10 - Cloning a 512 bytes per sector HDD to a 4096 bytes per sector SSD - Super User
      • Q: I bought a new SSD to replace my traditional HDD on my Windows 10 laptop. However, it seems my HDD is 512 bytes per sector (from msinfo32) and I cannot format the SSD to anything less than 4096 bytes per sector. How do I clone the HDD to the SSD?
      • This outlines how to image the drive as required with these sections.
        • Create partitions with diskpart
        • Imaging disk to a WIM
        • Accessing data within a WIM or ESD
    • hard drive - 512B to 4KiB (Advanced Format) HDD cloning with dd - Super User
      • What is the best practice to clone with a dd an existing 512-bytes-per-sector HDD (whole disk, not specific partitions) to a modern 4-kibibytes-per-sector Advanced Format drive? What options should be used? Does they matter at all?
      • Goes through how to use Linux dd.
  • How to check whether the HDD Is 4K aligned
  • Why is my Samsung EVO SSD showing 512 and not 4096 Bytes/Sector when it is a modern drive?
    • This one got me. I thought all drives by now should be 4K sectors and thats what I thought `AF`format was.
    • Samsung Ssd Sector Size (Real Research) - TechReviewTeam
      • Did you know that Samsung SSDs use a unique sector size called “Advanced Format”? This sector size is larger than the traditional 512-byte sector size, leading to improved performance, enhanced data integrity, and better storage efficiency. Plus, Samsung’s advanced firmware algorithms work seamlessly with this sector size, providing a more optimized and stable storage solution for your data.
      • This explains many things and clears others up.
      • What is the sector size of Samsung Evo SSD?
        • The sector size of the Samsung Evo SSD is 512 bytes. This is the standard sector size for most solid-state drives (SSDs) in the market.
      • What is sector size in Samsung NVMe SSD?
        • The sector size in Samsung NVMe SSDs is 4 KB.
      • How to change sector size from 512 to 4096 Windows 10?
        • No, it is not possible to change the sector size of an SSD on Windows 10. The sector size of an SSD is a hardware-level feature that is determined by the manufacturer and cannot be changed by software.

 


 

What size are my Hard Drive's sectors?

This section has notes and commands on how to find out how your hard drive's sectors are configured.

There are several sector sizes that can be identified:

  • Logical Sector Size
  • Physical Sector Size
  • Cluster Size

You will need administrative or root permissions to run some or all of these tests below.

  • In PowerShell commands
    • `Format-List` and `Format-Table` are interchangeable as they just format the results, NOT the hard drive. `Format-List` is easier to read. You can also use the command `Select` in-place of these two format commands, but I am not sure what the difference is. With any of these options you can filter the results by placing the required fields at the end
    • `| sort-object <variable here>` you can organise the result by the  selected variable with this switch.
  • ./sda and ./nvme0n1 devices can be changed in the commands below.
  • These might also work for NVMe drives but it might not show both the logical and physical sectors.

 

Get-Disk (Windows)

Get-Disk | Format-List
Get-Disk | Format-List LogicalSectorSize, PhysicalSectorSize

  • PowerShell only
  • Shows:
    • Logical sector size
    • Physical sector size

 

Get-PhysicalDisk (Windows)

Get-PhysicalDisk | Format-List                
Get-PhysicalDisk | Format-List FriendlyName, LogicalSectorSize, PhysicalSectorSize

  • PowerShell only
  • Shows:
    • Logical sector size
    • Physical sector size

 

fsutil fsinfo ntfsinfo (Windows)

fsutil fsinfo ntfsinfo C:

  • You need a mounted volume for this to work.
  • Shows:
    • Logical sector size
    • Physical sector size
    • Cluster size

 

fsutil fsinfo sectorinfo (Windows)

fsutil fsinfo sectorinfo C:

  • You need a mounted volume for this to work.
  • Shows:
    • Logical sector size
    • Physical sector size

 

msinfo32 (Windows)

msinfo32

  • Instructions
    1. Run msinfo32 in a command prompt and that should open a GUI window called "System Information"
    2. In the left pane select "System Summary --> Components --> Storage --> Disks". This should load info of all drives in the right pane
    3. Find your desired drive and check the value for "Bytes/Sector". it should say "Bytes/Sector 4096"
  • Shows:
    • Logical sector size

 

wmic partition (Windows)

wmic partition
wmic partition get BlockSize, StartingOffset, Name, Index, Type

  • You need partitions for this to work.
  • Shows:
    • Logical sector size

 

wmic diskdrive (Windows)

wmic diskdrive
wmic diskdrive get BytesPerSector, Description, Index, Description, Manufacturer, Model, Name, Partitions

  • You need partitions for this to work.
  • Shows:
    • Logical sector size

 

SeaChest Lite/Format (Windows)

SeaChest_Lite_x64_windows -d PD0 -i
SeaChest_Format_x64_windows -d PD0 -i

  • Shows:
    • Logical sector size
    • Physical sector size

 

SeaChest SMART (Windows)

SeaChest_SMART_x64_windows -d PD0 --SATInfo

  • Shows:
    • Logical sector size
    • Physical sector size

 

openSeaChest Format (Windows)

openSeaChest_Format -d PD0 -i

  • Shows:
    • Logical sector size
    • Physical sector size

 

openSeaChest SMART (Windows)

openSeaChest_SMART -d PD0 --SATInfo

  • Shows:
    • Logical sector size
    • Physical sector size

 

fdisk (Linux)

sudo fdisk -l

  • You need a mounted volume for this to work.
  • Shows:
    • Logical sector size
    • Physical sector size

 

parted (Linux)

sudo parted /dev/sda print

  • /dev/sda is optional.
  • You need a mounted volume for this to work.
  • Shows:
    • Logical sector size
    • Physical sector size

 

smartctl (Linux)

sudo smartctl -a /dev/sda

  • /dev/sda is optional.
  • -a and -x seem to bring back the same information.
    • -a: show all SMART information for the device
    • -x: show all information for device
  • If this is not installed in your Linux flavour, you need to install `smartmontools` which includes `smartctl`.
  • Shows:
    • Logical sector size
    • Physical sector size

 

sg_readcap (Linux)

sudo sg_readcap /dev/sda

  • If this is not installed in your Linux flavour, you need to install `sg3-utils` which includes `sg_readcap`.
  • Shows:
    • Logical sector size

 

sgdisk (Linux) (doesn't work correctly for NVMe)

sudo sgdisk -p /dev/sda

 

hdparm (Linux)

sudo hdparm -I /dev/sda

  • Shows:
    • Logical sector size
    • Physical sector size

 

cat (Linux)

cat /sys/block/sda/queue/hw_sector_size
cat /sys/block/sda/queue/logical_block_size
cat /sys/block/sda/queue/physical_block_size

  • NB:
    • hw_sector_size only shows the logical sector size.
    • when you run this on a NWMe drive all of the commands show the logical sector size.
  • Shows:
    • Logical sector size
    • Physical sector size

 

SeaChest Lite/Format (Linux)

sudo SeaChest_Format -d /dev/sda PD0 -i

No picture - Could not figure out how to install.

  • Shows:
    • Logical sector size
    • Physical sector size

 

SeaChest SMART (Linux)

sudo SeaChest_SMART -d /dev/sda --SATInfo

No picture - Could not figure out how to install.

  • Shows:
    • Logical sector size
    • Physical sector size

 

openSeaChest Format (Linux)

sudo openSeaChest_Format -d /dev/sda -i

No picture - Could not figure out how to install.

  • Shows:
    • Logical sector size
    • Physical sector size

 

openSeaChest SMART (Linux)

sudo openSeaChest_SMART -d /dev/sda --SATInfo

No picture - Could not figure out how to install.

  • Shows:
    • Logical sector size
    • Physical sector size

 

Notes

 


 

Does my HDD allow it's sectors to be changed?

This might not work for NVMes, but the section below will deal with them

The ability to switch between a 4k and 512 logical sector size requires the firmware to allow this to happen

SeaChest / openSeaChest

Windows:
SeaChest_Lite_x64_windows -d PD0 -i
SeaChest_Format_x64_windows -d PD0 -i
openSeaChest_Format -d PD0 -i

Linux:
SeaChest_Lite -d /dev/sda -i
SeaChest_Format -d /dev/sda -i
openSeaChest_Format -d /dev/sda -i
  • Run one of the commands above and then by looking in the Features Supported Section you can tell if this is supported or not.
    • SATA will list this as Set Sector Configuration
    • SAS will list this as Fast Format. Note: Check the product manual on SAS products as this is not as easy to detect support for.

`Setting sector size is not supported on this device` error

If you have tried changing the sector size with SeaChest/openSeaChest and you got the following message below, it means your drive cannot have its sector size changes as it is not allowed by the firmware. SeaChest checks for before sending these commands.

Notes

 

wdckit show (Windows) (Western Digital)

wdckit show disk1 -f

I do not know what to look for here or if it even will show if the sector value can be changed.

 

wdckit getfeature (Windows) (Western Digital)

wdckit getfeature disk1 --supported-capabilities -l

I do not know what to look for here or if it even will show if the sector value can be changed.

 

How do I detect my NVME's support LBA formats?

  • So far I only have found out how to do this in Linux.
  • NVMe drives are part of SCSI (Small Computer System Interface).
  • I am not sure how accurate the information returned for traditional disk is.
  • If the NVMe has more than 1 supported mode you can change it.
  • Spinning drives (ATA/SAS/SATA) do not have a `LBA format` setting so there is no mode to be read or set. Professional drives can usually have their sector size changed with proprietary software from that vendor, but that is not changing a mode but rather changing the sector size setting directly. Looking at the hard drive's logical and physical sector values is enough.
  • SSD should be managed the same way as spinning disks.
  • NVMe have `LBA format`modes built in because (i think) this functionality is built into the NVMe standard, as such there are non-vendor specific software available to read and change these modes. I also think that you cannot change the sector size but only select from one of the `LBA formats` that the drive supports, hence why we need to read these modes. Most NVMe should support 512e and 4Kn modes. Not all NVMe SSDs have this capability.

SeaChest Lite/Format (Windows)

SeaChest_Lite_x64_windows -d PD0 --showSupportedFormats
SeaChest_Format_x64_windows -d PD0 --showSupportedFormats

  • You need to install the `SeaChest Utilities` from Seagate.
  • Relative Performance
    • When you read the information at the bottom you will see the results give you a result of Best for each of the LBA formats, I think this is a manufacturers recommendation of how the drive will perform in this format and I don't think it is is the local system that is making this assessment.
  • Shows:
    • Supported LBA Formats

 

openChest Format (Windows)

SeaChest_Format -d PD0 --showSupportedFormats

  • Shows:
    • Supported LBA Formats

 

nvme (Linux)

sudo nvme id-ns -H /dev/nvme0n1

  • Instructions
    • You can see at the bottom of this example the supported `LBA formats`.
  • If this is not installed in your Linux flavour, you need to install `nvme-cli` which includes `nvme`.
  • Relative Performance
    • When you read the information at the bottom you will see the results give you a result of Best for each of the LBA formats, I think this is a manufacturers recommendation of how the drive will perform in this format and I don't think it is is the local system that is making this assessment.
  • Shows:
    • Supported LBA Formats

 

smartctl (Linux)

sudo smartctl -a /dev/nvme0n1

  • Look at the section Supported LBA Sizes (NSID 0x1)
    • Id = The LBA format number. this is used to switch the modes.
    • Fmt = The current format, the + indicating the active one.
    • Data = The logical sector size.
    • Metadt = ?
    • Rel_Perf = The manufactures determination of this modes performance?
  • If this is not installed in your Linux flavour, you need to install `smartmontools` which includes `smartctl`.
  • Shows:
    • Supported LBA Formats

 

sg_inq (Linux)

sudo sg_inq -a /dev/nvme0n1

  • If this is not installed in your Linux flavour, you need to install `sg3-utils` which includes `sg_inq`.
  • Shows:
    • Supported LBA Formats

 

SeaChest Format (Linux)

sudo SeaChest_Format -d /dev/nvme0n1 --showSupportedFormats

No picture - Could not figure out how to install.

  • You need to install the `SeaChest Utilities` from Seagate, but I don't know how to do this.
  • Relative Performance
    • When you read the information at the bottom you will see the results give you a result of Best for each of the LBA formats, I think this is a manufacturers recommendation of how the drive will perform in this format and I don't think it is is the local system that is making this assessment.
  • Shows:
    • Supported LBA Formats

 

openSeaChest Format (Linux)

sudo openSeaChest_Format -d /dev/nvme0n1 --showSupportedFormats

No picture - Could not figure out how to install.

  • You need to install 'openSeaChest Utilities' to use this utility, but I don't know how to do this.
  •  Shows:
    • Supported LBA Formats

 


 

How do I change a HDD's Sector Size or a NVMe's LBA format?

  • I think you can only change the logical sector size, the physical size is set at manufacture.
  • The disk's firmware has to explicitly support 4Kn sectors - this is common in "enterprise" or "professional" drives, but might be absent in a "consumer" drive. Where each manufacturer decides to drive that line between their products is often unclear, or changes over time.
  • NVMe drives are part of SCSI (Small Computer System Interface).
  • On SSD/NVMe you can only change the logical sector size. The physical one is fixed. This is more about changing the sector emulation or removing it.
  • Spinning disks usually only allow 512 and 4096, but some might allow custom sector sizes.
  • Some vendor branded utilities might work on other drives. Do this with caution.
  • Spinning drives (ATA/SAS/SATA) - if they support this feature, can have their sector size changed with proprietary software from that vendor and this is not tied to a `LBA format` number.
  • SSD - Most SSDs will not have this feature and it is most likely only enterprise drives that do. You will use a utility to change the secotr size
  • NVMe - They have `LBA format`modes built in and can be changed with generic software or sometimes vendor supplied software. Not all NVMe SSDs have this capability. You should use the vendor's software when possible.

Spinning Drives (ATA/SAS/SATA/SSD) (Generic)

Professional drives can usually have their sector size changed with proprietary software from that vendor. See the manufacturers website for their utilities.

With SSDs and other HDDs your mileage might vary with different utilities.

sg_format (Windows)

sg_format --format --size 512 PD1
  • How to Reformat Sector Size 520b or 528b to 512b in Windows - 1139 - YouTube | My PlayHouse
    • If you get an "The request could not be preformed because of an I/O device error." when trying to use a hard Drive or SSD that might have come from an enterprise storages system. This might just be how to fix that. (and using Windows this time!!)
    • Dutch guy, very easy to watch.
    • Uses the Windows version of `sg3-utils` and needs to be downloaded here.
    • This was done on a rack server.
    • It might utilise Cygwin.
    • This video also has troubleshooting hints and tips.

wdckit (Windows) (Western Digital, HGST or SanDisk)

wdckit format disk0 -b 4096
wdckit format disk0 --blocksize 4096
wdckit format disk0 -b 4096 --fastformat
  • --fastformat
    • Every make and drive model does not support the --fastformat option.
    • If the format command fails, remove --fastformat option from command syntax.
    • This switch is just for SAS drives I think.
  • When you change the sector size the drive will appear empty, but data is still there just in a different sector size. If you change back to your original sector size the data will re-appear unless you have done other operations to the drive inbetween the changes.
  • You will need to download this from here.
  • Backup your files before you begin.

SeaChest Lite/Format (Windows) (Seagate)

SeaChest_Lite_x64_windows -d PD0 --setSectorSize 4096 --confirm this-will-erase-data-and-may-render-the-drive-inoperable
SeaChest_Format_x64_windows -d PD0 --setSectorSize 4096 --confirm this-will-erase-data-and-may-render-the-drive-inoperable
  • When you change the sector size the drive will appear empty, but data is still there just in a different sector size. If you change back to your original sector size the data will re-appear unless you have done other operations to the drive inbetween the changes.
  • Backup your files before you begin.
  • Notes from the manual
    • -setSectorSize [new sector size]
      • This option is only available for drives that support sector size changes.
      • On SATA Drives, the set sector configuration command must be supported. On SAS Drives, fast format must be supported.
      • A format unit can be used instead of this option to perform a long format and adjust sector size.
      • Use the --showSupportedFormats option to see the sector sizes the drive reports supporting.
      • If this option doesn't list anything, please consult your product manual.
      • This option should be used to quickly change between 5xxe and 4xxx sector sizes.
      • Using this option to change from 512 to 520 or similar is not recommended at this time due to limited drive support.

openSeaChest Format (Windows) (Seagate)

SeaChest_Format -d PD0 --setSectorSize 4096 --confirm this-will-erase-data-and-may-render-the-drive-inoperable
  • When you change the sector size the drive will appear empty, but data is still there just in a different sector size. If you change back to your original sector size the data will re-appear unless you have done other operations to the drive inbetween the changes.
  • Backup your files before you begin.
  • Notes from the manual
    • -setSectorSize [new sector size]
      • This option is only available for drives that support sector size changes.
      • On SATA Drives, the set sector configuration command must be supported. On SAS Drives, fast format must be supported.
      • A format unit can be used instead of this option to perform a long format and adjust sector size.
      • Use the --showSupportedFormats option to see the sector sizes the drive reports supporting.
      • If this option doesn't list anything, please consult your product manual.
      • This option should be used to quickly change between 5xxe and 4xxx sector sizes.
      • Using this option to change from 512 to 520 or similar is not recommended at this time due to limited drive support.

 

hdparm (Linux)

hdparm --set-sector-size 4096 /dev/sda
  • I have not tested this command.

SG Utils (Linux)

sg_format --format --size=4096 /dev/sg0
  • How to reformat drive sector size | 520b 524b 528b to 512b or 4k - YouTube | Art of Server
    • In this video, I'm going to show you how to reformat drives with non-standard sector sizes like 520b, 524b, and 528b to 512b or 4k sectors so that they can be used with normal servers. HDDs and SSDs that are being retired from enterprise storage systems from the likes of EMC or NetApp often have the drives formatted with these non-standard sectors, effectively preventing them from being used in normal systems. However, once I show you how to reformat them to standard sector sizes, you'll be able to use these drives again!
  • If this is not installed you need to install the package `sg3-utils`.

wdckit (Linux) (Western Digital, HGST or SanDisk)

wdckit format /dev/ada1 -b 4096
wdckit format /dev/ada1 -blocksize 4096
wdckit format /dev/ada1 -b 4096 --fastformat
  • --fastformat
    • Every make and drive model does not support the --fastformat option.
    • If the format command fails, remove --fastformat option from command syntax.
    • This switch is just for SAS drives I think.
  • When you change the sector size the drive will appear empty, but data is still there just in a different sector size. If you change back to your original sector size the data will re-appear unless you have done other operations to the drive inbetween the changes.
  • You will need to download this from here.
  • Backup your files before you begin.

SeaChest Lite/Format (Linux) (Seagate)

SeaChest_Lite_x64_windows -d /dev/sda --setSectorSize 4096 --confirm this-will-erase-data-and-may-render-the-drive-inoperable
SeaChest_Format_x64_windows -d /dev/sda --setSectorSize 4096 --confirm this-will-erase-data-and-may-render-the-drive-inoperable
  • When you change the sector size the drive will appear empty, but data is still there just in a different sector size. If you change back to your original sector size the data will re-appear unless you have done other operations to the drive inbetween the changes.
  • Backup your files before you begin.
  • Notes from the manual
    • -setSectorSize [new sector size]
      • This option is only available for drives that support sector size changes.
      • On SATA Drives, the set sector configuration command must be supported. On SAS Drives, fast format must be supported.
      • A format unit can be used instead of this option to perform a long format and adjust sector size.
      • Use the --showSupportedFormats option to see the sector sizes the drive reports supporting.
      • If this option doesn't list anything, please consult your product manual.
      • This option should be used to quickly change between 5xxe and 4xxx sector sizes.
      • Using this option to change from 512 to 520 or similar is not recommended at this time due to limited drive support.
  • Upon running the command you will be prompted with the following

 

openSeaChest Format (Linux) (Seagate)

SeaChest_Format -d /dev/sda --setSectorSize 4096 --confirm this-will-erase-data-and-may-render-the-drive-inoperable
  • When you change the sector size the drive will appear empty, but data is still there just in a different sector size. If you change back to your original sector size the data will re-appear unless you have done other operations to the drive inbetween the changes.
  • Backup your files before you begin.
  • Notes from the manual
    • -setSectorSize [new sector size]
      • This option is only available for drives that support sector size changes.
      • On SATA Drives, the set sector configuration command must be supported. On SAS Drives, fast format must be supported.
      • A format unit can be used instead of this option to perform a long format and adjust sector size.
      • Use the --showSupportedFormats option to see the sector sizes the drive reports supporting.
      • If this option doesn't list anything, please consult your product manual.
      • This option should be used to quickly change between 5xxe and 4xxx sector sizes.
      • Using this option to change from 512 to 520 or similar is not recommended at this time due to limited drive support.

 

NVMe

Because NVMe drives have mode switching built in as part of the standard, most drives will support changing 512B  --> 4K and vice-versa if required. During this process make sure you have chjeck your drive supports having it's `LBA format` changing (see above).

You need to read the notes below and in particular follow the tutorial by Carlos Felicio listed below before using the command on your Linux PC.

wdckit (Windows) (Western Digital, HGST or SanDisk)

wdckit format disk0 -l 1
wdckit format disk0 -lbaformat 1
  • When you change the sector size the drive will appear empty, but data is still there just in a different sector size. If you change back to your original sector size the data will re-appear unless you have done other operations to the drive inbetween the changes.
  • You will need to download this from here.
  • Backup your files before you begin.

SeaChest Format (Seagate)

SeaChest_Format_x64_windows -d PD0 --nvmFormat 1
SeaChest_Format_x64_windows -d PD0 --nvmFormat 4096
  • When you change the sector size the drive will appear empty, but data is still there just in a different sector size. If you change back to your original sector size the data will re-appear unless you have done other operations to the drive inbetween the changes.
  • Backup your files before you begin.
  • I am not sure if this will change the LBA format on an NVMe if you select the right sector size.
  • Notes from the manual
    • --nvmFormat [current | format # | sector size]    (NVMe Only)
      • This option is used to start an NVM format operation.
      • Use "current" to perform a format operation with the Sector size currently being used.
      • If a value between 0 and 15 is given, then that will issue the NVM format with the specified sector size/metadata size for that supported format on the drive.
      • Values 512 and higher will be treated as a new sector size to switch to and will be matched to an appropriate lba format supported by the drive.
      • This command will erase all data on the drive.
      • Combine this option with--poll to poll for progress until the format is complete.

openSeaChest Format (Seagate)

SeaChest_Format -d PD0 --nvmFormat 1
SeaChest_Format -d PD0 --nvmFormat 4096
  • When you change the sector size the drive will appear empty, but data is still there just in a different sector size. If you change back to your original sector size the data will re-appear unless you have done other operations to the drive inbetween the changes.
  • Backup your files before you begin.
  • I am not sure if this will change the LBA format on an NVMe if you select the right sector size.
  • Notes from the manual
    • --nvmFormat [current | format # | sector size]    (NVMe Only)
      • This option is used to start an NVM format operation.
      • Use "current" to perform a format operation with the Sector size currently being used.
      • If a value between 0 and 15 is given, then that will issue the NVM format with the specified sector size/metadata size for that supported format on the drive.
      • Values 512 and higher will be treated as a new sector size to switch to and will be matched to an appropriate lba format supported by the drive.
      • This command will erase all data on the drive.
      • Combine this option with--poll to poll for progress until the format is complete.

nvme (Linux)

sudo nvme format --lbaf=1 /dev/nvme0n1
sudo nvme format --lbaf=1 /dev/nvme0n1p1
  • When you change the sector size the drive will appear empty, but data is still there just in a different sector size. If you change back to your original sector size the data will re-appear unless you have done other operations to the drive inbetween the changes.
  • If this is not installed in your Linux flavour, you need to install `nvme-cli` which includes `nvme`.
  • Backup your files before you begin.

wdckit (Linux) (Western Digital, HGST or SanDisk)

wdckit format /dev/ada1 --l 1
wdckit format /dev/ada1 --lbaformat 1
  • When you change the sector size the drive will appear empty, but data is still there just in a different sector size. If you change back to your original sector size the data will re-appear unless you have done other operations to the drive inbetween the changes.
  • You will need to download this from here.
  • Backup your files before you begin.

 

Notes

The links below will purely deal with swapping the `LBA format` and NVMe drives.

  • General
    • windows 7 - Can I change my SSD sector size? - Super User
      • While not truly sectors - because SSDs are not circular - the memory cells of an SSD are grouped into pages of 4 kB each. Pages are in turn collected in blocks of 512 kB (still not 512 bytes though).
      • Remember that SSDs cannot write to non-empty memory, but must clear entire pages of memory at a time, temporarily moving data to another location and back after the page has been cleared. This is why the TRIM command and garbage collection are important to keep an SSD in good shape.
      • The 512B sector size reported by the SSD is only for compatibility purposes. Internally data is stored on 8kiB+ NAND pages. The SSD controller keeps track of the mapping from 512B to pages internally in the FTL (Flash Translation Layer).
    • broken HDD after format change from 512 to 4096 4kn | TrueNAS Community
      • Hi all, I used the SeaChest-Software on Linux system to fastformat from 512 to 4kn on a new Seagate Exos X16 10TB HDD. The topic was working for 2v4 brand new HDDs. But now 2 HDD seem to be fully broken.
      • Some suggestions on what to do.
  • Cannot format NVMe: LBA Format specified is not supported, but it is.
    • fedora - Format SSD with nvme : LBA Format specified is not supported - Super User
      • Q: I would like to erase a SSD under Fedora 32 using nvme utility and I get this message : "LBA Format specified is not supported".
      • A: "I put the computer to sleep and then, after resume, the lock was released and the format command was ok."
      • Some troubleshooting tips aswell here.
    • SN750 - Cannot format using the nvme command - #7 by toniob - WD SSD Drives & Software - WD Community
      • It looks like your system has a security feature that’s locked the drive. Security implementation is vendor specific (not defined by NVMe). nvme-cli doesn’t have device specific unlocking capabilities.
      • I finally found what was the issue. The drives were locked by both the computers. For one of them, I put the computer to sleep and then, after resume, the lock was released and the format command was ok. For the second one, the suspend trick did not work. I used a pci-e to m.2 adapter and format it with the other computer.
  • Tutorials
    • How to switch your NVME SSD to 4KN Advanced Format - Carlos Felicio
      • In this post, I provide detailed instructions on how to convert your NVME SSD to use the advanced 4Kn format for physical sectors. (he might mean logical sectors)
      • Some manufacturers will provide tools to do this switch (e.g., Sabrent, Seagate), but what about when these tools are not available, and you know the device runs native 4KN? I was not able to find a way to do this in Windows, but there is a clever, open source tool called “nvme” that can do the job, as pointed out by Jonathan Bisson in this article, titled “Switching your NVME ssd to 4k“.
      • This is a easy to follow tutorial covering everything and I would start here.
    • Switching your NVME ssd to 4k - Bjonnh.net
      • I recently got a WD SN850. There is a little trick to do when you receive it to switch it to 4k LBA and thus getting better performance by using native block size.
      • I did see a 10% improvement on my ext4 really basic benchmarks. There is really little reason to keep it to 512 except for compatibility anyway the disk seems to use 4k internally.
    • How to Change the Logical Sector Size in Intel® Optane™
      • How to check and change the logical sector size in Intel® Optane™ drives using the Intel Memory and Storage Tool.
      • The logical sector size can be checked and changed using the Intel® Memory and Storage (Intel® MAS) Tool CLI.
    • linux - Switching HDD sector size to 4096 bytes - Unix & Linux Stack Exchange
      • To switch the HDD sector size, you would first need to verify that your HDD supports the reconfiguration of the Logical Sector Size. Changing the Logical Sector Size will most likely make all existing data on the disk unusable, requiring you to completely repartition the disk and recreate any filesystems from scratch. The hdparm --set-sector-size 4096 /dev/sdX would be the "standard" way to change the sector size, but if there's a vendor-specific tool for it, I would generally prefer to use it instead - just in case a particular disk requires vendor-specific special steps.
      • On NVMe SSDs, nvme id-ns -H /dev/nvmeXnY will tell (among other things) the sector size(s) supported by the SDD, the LBA Format number associated with each sector size, and the currently-used sector size. If you wish to change the sector size, and the desired size is actually supported, you can use nvme format --lbaf=<number> /dev/nvmeXnY to reformat a particular NVMe namespace to a different sector size.
    • How to use/format Native 4Kn drives in Synology or NAS | Roel Broersma
      • Now, a few years later, companies like Western Digital (HGST) and Seagate come with ‘Advanced Format’ drives, it’s one drive which you can use in 512-byte mode or 4Kn mode. I recently bought two Western Digital (HGST) Ultrastar DC HC550 (18TB) drives and had some struggles with them to use them in my Synology NAS as 4Kn drives. See how I fixed it..
      • Use "Hugo" which is a Western Digital proprietary tool.
    • How to change Intel Optane P4800X sector size | tmikey’s fireplace - The nvme-format tool can do the job! All you need is nvme format -l 3 /dev/nvme1n1 right? Not quite.
  • Western Digital
    • WD Red Plus 4TB (WD40EFZX) - The product page for my drive which also has a datasheet (which does not show sector sizes).
    • hard drive - How to convert the Western Digital "Ultrastar® DC HC530 14TB HDD" from 512e to 4Kn sector size? (In Windows 10) - Super User
      • This is not entirely true, according to that product specification, this drive supports an ATA command called Set Sector Configuration Ext, which could be used to change the logical sector size, without need of using any propitiatory programs from vendor, such as HUGO; see section Set Sector Configuration Ext (B2h) page 287 for a details description of this command.
      • Some technical information on another way of changing the sector size with non-vendor-specific:
        comcontrol command <disk> [-v] -a "<command> <features> <lba_low> <lba_mid> <lba_high> <device> <lba_low_exp> <lba_mid_exp> <lba_high_exp> <features_exp> <sector_count> <sector_count_exp>" -r -
        
        wdckit format --model WDC\ \ WUH721816ALE6L4 -b 4096 --fastformat
        --fastformat - Set Fast Format for SCSI/ATA devices. Not applicable for NVMe devices
    • How do I change a hard drive's logical sector size from 512 bytes to 4096 bytes? | TrueNAS Community
      • This thread follows a user figuring out how to change the sector size on his WD Red 20TB disks
      • Tthe theory behind the conversion is that it will remove whatever drive firmware overhead is in place that causes it to be broken into eight 512-byte sectors.
      • The default TrueNAS configuration will never use an ashift value lower than 12 on data vdevs, meaning the smallest write to disk that TrueNAS will ever make is 4K - so the read-modify-write from 512e isn't a risk here, but the thought process is "why go from 4K down to 8x512b back to 4K, and potentially introduce some edge-case failure?"
      • This is the first mention of the wdckit I found.
  • Seagate SeaChest / openSeachchest
    • To change the sector size of a Seagate drive, you can use Fast Format to check if the drive supports changing the sector size. If it does, you can change the format from 512e to 4Kn using SeaChest_Lite.
    • Reformatting WD Red Pro 20TB (WD201KFGX) from 512e to 4Kn sector size « Frederick's Timelog
      • Using Seagate's openSeaChest_Format utility, we can set the sector size to 4096.
      • Usually it is a bad idea to use one vendor’s tools with another’s. There were a lot of forum posts suggesting that the right utility is a proprietary WD tool called “HUGO,” which is not published on any WD support site. Somebody made a tool for doing this on Windows too: https://github.com/pig1800/WD4kConverter.
      • Seagate has one of the leading cross-platform utilities for SATA/SAS drive configuration: SeaChest. I think I’ve even been able to run one of these on ESXi through the Linux compatibility layer. Seagate publishes an open-source repository for the code under the name openSeaChest, available on GitHub: https://github.com/Seagate/openSeaChest , and thanks to the license, vendors like TrueNAS are able to include compiled executables of openSeaChest on TrueNAS SCALE.
      • Q: Do you think I can change 512e to 4Kn ?
      • A: No, you won’t be able to. I bet that when you run openSeaChest_SMART -d /dev/sata3 --SATInfo, there is no “Set Sector Configuration” under Features Supported?
    • How to convert 512e to 4Kn using Fast Format (Seagate Exos X16 drive) ? | TrueNAS Community
      • Q:
        • I'm planning to purchase some Seagate Exos X16 (model ST16000NM001G) 16TB drives. They come formatted in 512e by default, but they support "Fast Format" to convert to 4Kn so that they appear as a true 4Kn to the OS. This is documented in the Seagate documentation, but they neglect to say how you do it, and with what tool.
        • What tool or command line option can I use to do this? Do you have to use the Seagate Seatools (it doesn't even appear to support it)? Does BSD or Windows support this? Or sg_format? Or parted? I've search all over the web and cannot find any information on this.
        • PS- Yes, I know that using ashift=12 works fine with 512e drives, that's not my question, I want to convert the drives to 4Kn using the Fast Format feature. Thanks.
      • A:
        # In an elevated (admin) Command Prompt window, scan for your drive with the command:
        SeaChest_Lite --scan
        
        # You should see your drive ID something like "PD1" for example.
        # Check to see if the drive supports changing the sector size using Fast Format:
        SeaChest_Lite --device PD1 --showSupportedSectorSizes
        
        # Change the format from 512e to 4Kn:
        SeaChest_Lite --device PD1 --setSectorSize 4096
        The commands are out of date, but the logic is not. You can just change the syntax to match the updated software.
    • FormatUnit has no effect · Issue #21 · Seagate/ToolBin · GitHub
      • Q: I was trying to change my ST4000NM005A SAS drive from 512e to 4kn and I ran the command:
         SeaChest_Format_x64_windows_R.exe -d arc:0:0:4 --formatUnit 4096 --fastFormat 1 --confirm this-will-erase-data-and-may-render-the-drive-inoperable

        This has no effect and the drive still shows 512 as logical sector size rather than 4096.

      • A: When you interrupted the format the first time, this puts the drive into "Format Corrupt" state. In this mode a lot of commands that SeaChest uses to detect drive features do not complete properly (even if the drive does support the command). This is because in format corrupt state certain commands are not available, but you should be able to send a new format to clear it and get it back to normal. This part makes sense.
    • How to switch your Seagate Exos X16 to 4KN Advanced Format on Windows - Carlos Felicio - A simple to follow tutorial.
    • SeaChest should warn the user that setSectorSize on USB External Hard is unsupported and could brick the drive · Issue #10 · Seagate/ToolBin · GitHub
      • On a Ubuntu 20.10 (running Linux 5.8) system, I used SeaChest Lite (downloaded from official website on 9/30/2020) and set a USB Seagate External Hard Drive 16TB (STEB16000400) to sector size 4096. The operation succeeded with no error, but the drive became sorta bricked. Now the system can't boot when the USB HDD is attached, because it kinda froze on detecting that drive. The drive's blue light would always blink, with no apparent head seek could be heard.
      • The commands to change the sector size reformat the drive quickly, but if interrupted for any reason can become unresponsive or have other issues. This command set is made to allow customers to setup drives before integrating them into their environment, before any data is written to them, but it's purpose is really meant for advanced configurations in large scale storage. There is no real benefit to switching to 4k at home, especially on USB drives. I will add an additional warning to SeaChest_Lite ahead of this operation to help warn about this kind of issue.
      • Dont use this command while the drive is attached via a USB adapter.
    • broken HDD drive after changing to 4kn · Issue #16 · Seagate/ToolBin · GitHub
      • The best advice I can give for configuring any new product before integration into a system is to do it from a Live OS (LiveCD or LiveUSB) to reduce the chance of an installed OS from trying to interact with the drive during any of the configuration process. Also, make sure that low-level configuration commands such as these are performed prior to writing any partition information on the disk. Data is not guaranteed to be accessible in the same way after changing the sector size and other things already written to disk may use checksums based on individual sector sizes which would no longer work properly once changed (if the original data was still accessible).
      • When possible, I would also make sure that the drive and any HBA that it may be attached to have the latest firmware versions to ensure they can understand the change in sector size after it's performed and don't have any other compatibility issues.
      • To check for Seagate firmware updates, you can put the drive SN into this form and it will show manuals, software, and any available firmware updates.
      • As for SeaChest_Lite vs SeaChest_Format, the commands work the same way so one is not any better than the other. The code that runs this process is in opensea-operations which both of these tools use so that it works the same.
    • Seagate Technology - Download Finder - Find manuals, software, and firmware for your Seagate drive.

Software

The various software that has been used in this article.

  • Generic
    • nvme-cli
    • hdparm
      • hdparm(8) — Arch manual pages - hdparm provides a command line interface to various kernel interfaces supported by the Linux SATA/PATA/SAS "libata" subsystem and the older IDE driver subsystem. Many newer (2008 and later) USB drive enclosures now also support "SAT" (SCSI-ATA Command Translation) and therefore may also work with hdparm. E.g. recent WD "Passport" models and recent NexStar-3 enclosures. Some options may work correctly only with the latest kernels.
      • linux - Switching HDD sector size to 4096 bytes - Unix & Linux Stack Exchange
        • To switch the HDD sector size, you would first need to verify that your HDD supports the reconfiguration of the Logical Sector Size. Changing the Logical Sector Size will most likely make all existing data on the disk unusable, requiring you to completely repartition the disk and recreate any filesystems from scratch. The hdparm --set-sector-size 4096 /dev/sdX would be the "standard" way to change the sector size, but if there's a vendor-specific tool for it, I would generally prefer to use it instead - just in case a particular disk requires vendor-specific special steps.
      • hdparm download | SourceForge.net - Download hdparm for free. hdparm - get/set ATA/SATA drive parameters under Linux
      • linux - Change logical sector size to 4k - Unix & Linux Stack Exchange
        • Many times asked, but without a conclusive answer: Can you change the logical block size from 512e to 4k (physical block size)?
        • A solution using hdparm --set-sector-size 4096 doesn't work under qemu/kvm so i can't really test it, without using a spare device which i don't have.
        • A:
          • Changing a HDD to native 4k sectors works at least with WD Red Plus 14 TB drives but LOSES ALL DATA. The data is not actually wiped but partition tables and filesystems cannot be found after the change because of their now incorrect LBA locations.
          • hdparm --set-sector-size 4096 --please-destroy-my-drive /dev/sdX
          • This command changes your drive to native 4k sectors. The change persists on drive over reboots but you can revert it by setting 512 at some later time. REBOOT IMMEDIATELY after adjusting your disks. Attempt partitioning the drives and adding data only after a reboot (gdisk will then show 4096/4096 sector size).
          • For NVME SSDs the LBA sector size can be changed with the nvme utility (in package nvme-cli on Debian based ditros).
      • hdparm - Debian Manpages
        • hdparm provides a command line interface to various kernel interfaces supported by the Linux SATA/PATA/SAS "libata" subsystem and the older IDE driver subsystem. Many newer (2008 and later) USB drive enclosures now also support "SAT" (SCSI-ATA Command Translation) and therefore may also work with hdparm. E.g., recent WD "Passport" models and recent NexStar-3 enclosures. Some options may work correctly only with the latest kernels.
        • : For drives which support reconfiguring of the Logical Sector Size, this flag can be used to specify the new desired sector size in bytes. VERY DANGEROUS. This most likely will scramble all data on the drive. The specified size must be one of 512, 520, 528, 4096, 4160, or 4224. Very few drives support values other than 512 and 4096. Eg. hdparm --set-sector-size 4096 /dev/sdb
    • sdparm
      • Linux sdparm utility - The sdparm utility accesses SCSI device parameters. When the SCSI device is a disk, sdparm's role is similar to its namesake: the Linux hdparm utility which is primarily designed for ATA disks that had device names starting with "hd". More generally sdparm can be used to access parameters on any device that uses a SCSI command set. Apart from SCSI disks, such devices include CD/DVD drives (irrespective of transport), SCSI and ATAPI tape drives and SCSI enclosures. A small set of commands associated with starting and stopping the media, loading and unloading removable media and some other housekeeping functions can also be sent with this utility.
    • sg3-utils
      • The sg3_utils package
        • The sg3_utils package contains utilities that send SCSI commands to devices. As well as devices on transports traditionally associated with SCSI (e.g. Fibre Channel (FCP), Serial Attached SCSI (SAS) and the SCSI Parallel Interface(SPI)) many other devices use SCSI command sets. ATAPI cd/dvd drives and SATA disks that connect via a translation layer or a bridge device are examples of devices that use SCSI command sets.
      • How to install sg3-utils on Ubuntu 20.04 (Focal Fossa)? - In this article we are going to learn the commands and steps to install sg3-utils package on Ubuntu 20.04 (Focal Fossa).
      • `sg_scan` will show listed devices
      • `sg_scan -i` will show listed devices with their names
      • `sginfo -a /dev/sg0` will give more details information on CD/DVD but might also for other SCSI drives.
  • Western Digital
    • wdckit
      • wdckit Drive Utility Download and Instructions for Internal Drives
        • wdckit is a command line utility to perform various operations on one or more supported drives. wdckit commands can be executed as a one-time command from the terminal or from within the interactive session.
        • Supported Products (from them manual) - All WDC, HGST, and SanDisk from 2017 and newer; Interface (SATA/SAS/NVMe/NVMeoF)
        • Windows: Administrative privilege is required to execute the tool. Linux: Root authority is required to execute the tool.
        • There is a manual inside the download
          • The syntax for command execution is consistent across the various platforms. In this section, the commands are presented in the platform neutral form of wdckit. The user should have a practical knowledge of navigating the command line interface for the specific system platform.
          • The manual is broken up into tables of each command.
          • Format is on page 33
      • wdckit show
        Lists the details like disk#, serial number, capacity, state, geometry information, protection information, progress information, version, statistics, etc.
      • The switches are the same in Windows and Linux, the only difference is the device name.
      • If you see -- more (7%) -- or similiar, usually on fiorst run, press the space bar as this will accept the EULA.
    • Western Digital Dashboard
      • How to download and install Western Digital Dashboard to access your drives performance data.
      • Download, Install, Test Drive and Update Firmwareusing the Western Digital Dashboard.
      • The Western Digital Dashboard helps users maintain peak performance of the Western Digital drives in Windows® operating systems with a user-friendly graphical interface for the user. The Western Digital Dashboard includes tools for analysis of the disk (including the disk model, capacity, firmware version, and SMART attributes) and firmware updates.
    • Firmware Download and Updates for Western Digital Internal and External Drives
      • Western Digital, WD, HGST, SanDisk, SanDisk Professional and WD_BLACK drive firmware update availability, information for HDD and SSD products.
      • WD and WD_BLACK brand color drives have the firmware installed at the factory. Any firmware update for WD brand color hard (HDD) or solid state (SSD) drives are delivered through the Western Digital Dashboard installed on a running Windows computer.
    • "Hugo" by Western Digital
      • this is old and I do not have a copy yet. It might of been replaced by the wdckit.
      • Hugo | TrueNAS Community
        • This is version 7.4.5 of the Western Digital HUGO utility, used for performing low-level maintenance on compatible disk drives, such as conversion to 4K native sectoring.
        • Download button is orange and at the top right.
      • GitHub - pig1800/WD4kConverter - A simple Windows command-line tool for changing logical sector size for WD/HGST Datacenter drives. This program needs administrator privilege to run. It is designed to work on SATA interface by using ATA Pass-Through function provided by Windows.
  • Seagate
    • SeaChest Utilities
    • openSeaChest Utilities
      • GitHub - Seagate/openSeaChest  - Cross platform utilities useful for performing various operations on SATA, SAS, NVMe, and USB storage devices.
      • openSeaChest is a collection of comprehensive, easy-to-use command line diagnostic tools and programming libraries for storage devices that help you quickly determine the health and status of your storage product. The collection includes several tests that show device information, properties and settings. It includes several tests which may modify the storage product such as power management features or firmware download. It includes various commands to examine the physical media on your storage device. Close to 200 commands and sub-commands are available in the various openSeaChest utilities. These are described in more detail below.
      • openSeaChest repository availability
      • Tutorial[ Seagate Disks ]: Install Seagate OpenSeaChest Utilities - Practical instructions on how to install this software on Linux.
      • openseachest package versions - Repology - List of package versions for project openseachest in all repositories
  • Oracle
  • Other

 

 

Read 263 times Last modified on Wednesday, 27 September 2023 14:40