Please help setting up partitons with 4096 sector size alignment
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Please help setting up partitons with 4096 sector size alignment
Hi,
my harddrive broke down so I got a new one, and I decided for a new start from scratch and to try to do everything right this time. I tried looking up partition alignment, but couldn't figure it out, sorry, too much contradicting infos out there. Never cared for these things in the past but writing/reading has always been rather slow. So I want to do better this time.
My new drive is a toshiba 2tb and according to gsmartcontrol it uses the following sector sizes at the moment: 512 logical / 4096 physical. So I'd like it to actually use 4096 and properly allign the partitons for it. How do I switch the drive to use 4096 logically?
This is the partiton table I'd like to create:
partition 1: 10 GB Linux (reiserfs) for my Backup and boot/control System
partition 2: 6 GB swap
then use a logical volume for the remaining space of the disk with the following partitons:
partition 5: 50 GB Linux (whatever type) for testing new distros
partition 6: 50 GB Linux (ext4) for productive system (newest Mint)
partition 7: 50 GB Linux (whatever type) for secondary Linux (probably debian but not sure yet)
partiton 8: remaining drive space Linux (reiser) for data storage to symlink (some) home folders to
I've done setups like these often so I know the basic steps, but I never cared for alignment.
Can anyone please tell me how to set this up WITH proper partition alignment and using 4096 sector size?
Use gptfdisk, it will do it automatically for you. You can create GPT partition table with it and it will work fine with BIOS motherboard (as long as Windows is not involved).
You don't try to change the logical sector size. It takes a very new kernel and tool set to even work with 4096 byte logical, and even then it is very much bleeding edge. You just keep the 512 byte logical size and make sure that every partition starts on a logical block address that is a multiple of 8. Modern partitioning tools, such as gparted, default to 1-Megabyte alignment, which is fine. The most likely way to go wrong would be to use an old tool like fdisk and work in "cylinder" units. That's pretty much guaranteed to cause misalignment unless you are very clever. (Recent versions of fdisk default to "sector" units and start the first partition at sector 2048, which is 1 Megabyte into the disk.)
After you've done the partitioning, you can check by running "fdisk -l -u" and verifying that each starting sector number is a multiple of 8.
Not only gptfisk as Emerson told you, but you can use gparted or even the cli parted which is pre-installed in most of current distros
Code:
root@i7:~# parted /dev/sdb
GNU Parted 2.3
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p
Model: ATA WDC WD10EARS-00Y (scsi)
Disk /dev/sdb: 1000GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Number Start End Size File system Name Flags
1 1049kB 734GB 734GB ext4 linux
2 734GB 1000GB 266GB 2
(parted) align-check opt 1
1 aligned
(parted) quit
root@i7:~#
as you can see, partition 1 is aligned in a disk which has physical sectors size of 4096B.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.