Micky1979 Posted November 20, 2014 Share Posted November 20, 2014 sectorsize is a tiny command line I made to detect the Physical and logical sector size of your hard disk. usage: sudo sectorsize /dev/diskX output on a AF (Advanced Formatted ) drive: Physical sector size: 4096 Logical sector size: 512 output on non AF drive: Physical sector size: 512 Logical sector size: 512 OSX seem to show always 512-byte as "logical" sector size (*because is a standard?), but you can see that AF drive show a physical 4096-bytes sector, and probably this mean that this drive use the 512e tecnology (512 bytes emulation). *NOTE: hard disk with 4K use firmware to emulate 512 sector size....as the OS wants.. This will be useful to see if your hard disk uses the Advanced Format technology or not. Why? Installing Chamelon (or Clover) currently can create the boot0 error on AF drives with physical 4096-bytes (or 4K). This will be useful to understand what to do before installing the bootloader on these drives. A test will be performed by changing Chameleon installer to do all automatically. stay tuned Thanks to verdant for the tests made Micky sectorsize_v1.1_binary.zip sectorsize_v1.1_source.zip sectorsize_v1.2_scripting_easy.zip 3 Link to comment Share on other sites More sharing options...
blackosx Posted November 21, 2014 Share Posted November 21, 2014 Nice little tool micky1979 So maybe that DKIOCGETPHYSICALBLOCKSIZE is used to populate the 'Physical Block Size' value in Device Characteristics in ioreg? ioreg -lw0 | grep "Device Characteristics" 1 Link to comment Share on other sites More sharing options...
Micky1979 Posted November 21, 2014 Author Share Posted November 21, 2014 First I never look at this before , but I think Yes, surely the ioreg is populated by sys/disk.h for extra details. Diskarbitration framenwork (as I am using in Pandora show only Logical size or I have to do something special that I did not understand), now I have more code to work on! and DKIOCGETPHYSICALBLOCKSIZE seems a more direct and precise method, with just two lines of code and a clean output ...(and the code can be use in a Cocoa app too) EDIT this because I want to use that in a bash script (or send this as argument from the app to the Chamelon/Clover scripts??), and I made variant of that command that exit in this way: ------------------------------------------------------------------------------- USAGE: sudo sectorsize /dev/diskX This build is customized to be easily used with the bash/sh scripts ad return the following output: Physical XXX (if the Physical value is aqcuired..) Logical XXX (if the Physical value was not aquired for some reasons) Standard 512 (if no Logical and nor Physical value was aquired for some reasons) XXX can be 512 or 4096 (or any other aquired) as output in bytes. sectorsize exit 0 on success for the cases above. ------------------------------------------------------------------------------- and use the result as argument for bs=n using dd.... only a test to see if everything is ok. In the meantime, I gave an eye to an hard drive from an old laptop I had(2 year), and surprisingly is a WD 512GB with 4K secotrs 1 Link to comment Share on other sites More sharing options...
blackosx Posted November 21, 2014 Share Posted November 21, 2014 I currently read the Device Characteristics from ioreg for DarwinDumper, but maybe I'll add your tool for next revision? Would that be okay? 1 Link to comment Share on other sites More sharing options...
Micky1979 Posted November 21, 2014 Author Share Posted November 21, 2014 Sure, the source is included! I'm going to add a customized version for scripting to the first post.. Link to comment Share on other sites More sharing options...
blackosx Posted November 21, 2014 Share Posted November 21, 2014 Great. Thanks. Not sure when I'll update DarwinDumper but I'll get round to it at some point. 1 Link to comment Share on other sites More sharing options...
Micky1979 Posted November 21, 2014 Author Share Posted November 21, 2014 Added v1.2 with different output Link to comment Share on other sites More sharing options...
blackosx Posted November 21, 2014 Share Posted November 21, 2014 Great. Thanks. EDIT: One benefit of reading the property from ioreg is you don't need root privileges, where as accessing the disk directly does require root privileges. Of course, this won’t be a problem with the Chameleon installer or DarwinDumper as root privileges will have already been granted for those particular actions. Link to comment Share on other sites More sharing options...
Micky1979 Posted November 23, 2014 Author Share Posted November 23, 2014 Great. Thanks. EDIT: One benefit of reading the property from ioreg is you don't need root privileges, where as accessing the disk directly does require root privileges. Of course, this won’t be a problem with the Chameleon installer or DarwinDumper as root privileges will have already been granted for those particular actions. Reading now your EDIT. Yep require Root privileges, otherwise can't be used.....but now I can something like that easily (see at the red arrow): I just finished editing Chamelon and Clover scripts to acquire the real sectors size, and tomorrow I'll do a test on the drives that you see in the picture. Fingers crossed ! Link to comment Share on other sites More sharing options...
Micky1979 Posted November 24, 2014 Author Share Posted November 24, 2014 The first test: Pandora's BOX post-install log InsanelyMac 11/24/14-21:28 -- -- Zeus post-installation Session started -- -- Running from OSx 10.10.1 -------------------------------------------------------------------- ** Enoch ** -------------------------------------------------------------------- =============================================== Main Standard Post-Install Script Darwin/x86 boot v5.0.132 - Enoch (PANDORA) r2472 ********************************* ----------------------------------------------- Check if target folders exist: /Volumes/Lion/usr/local/bin folders exist /Volumes/Lion/usr/standalone/i386 folders exist Clean up old installations files.. Cleaning done Installing new boot files: all the boot files have been copied successfully Running Standard postinstall script Target volume = /Volumes/Lion on /dev/disk1s2 Target disk already has existing Chameleon stage 0 loader - boot0md (boot0workV2). Detected a Windows installation on this volume. =============================================== CheckFatType: Do we have FAT16 or FAT32? **************************************** Written boot0md to /dev/disk1. Physical 4096bytes sector size detected for /dev/rdisk1s2 0+1 records in 0+1 records out 1024 bytes (1,0 kB) copied, 0,000288 s, 3,6 MB/s Written boot1h to /dev/rdisk1s2. Written boot to /Volumes/Lion on /dev/disk1s2. Preparing to check target disk for previous installations. Checking disk1. Nothing found that could cause any problems. Windows is installed so that can remain the active partition /Volumes/Lion already has an Extra folder Standard script complete =============================================== END - Standard Post-Install Script ********************************* "Physical 4096bytes sector size detected for /dev/rdisk1s2" Booted and Writing from that hard disk with 4K sector EDIT, w/o umonting the Volume.. ...need to do a build...soon Link to comment Share on other sites More sharing options...
Onixs Posted November 25, 2014 Share Posted November 25, 2014 Without unmounting? This is great! Thanks Mickey1979 Link to comment Share on other sites More sharing options...
Micky1979 Posted November 25, 2014 Author Share Posted November 25, 2014 Obviously this will require tests .. hoping that this does not happen only to me, ha ha ha. However, there can be two types of 4k drives, and both seem to have different alignments with OSes based on their firmware and the bus where they are connected apparently (yes, this makes difference).. Link to comment Share on other sites More sharing options...
stevsaunders Posted August 14, 2019 Share Posted August 14, 2019 On 11/25/2014 at 8:53 PM, Micky1979 said: Obviously this will require tests .. hoping that this does not happen only to me, ha ha ha. However, there can be two types of 4k drives, and both seem to have different alignments with OSes based on their firmware and the bus where they are connected apparently (yes, this makes difference).. As long as you align your partitions on a multiple of 4KB, you're fine. You don't otherwise have to do anything special for drives with 4KB physical sectors. essay typer Link to comment Share on other sites More sharing options...
Recommended Posts