Comments (9)
This is contradicting the original message of this PR: #362
The following command:
sgdisk --new=4:0:-0 /dev/xda
will work but unless the overall disk size is aligned to 4k, the new partition will not be > aligned to 4k.
--set-alignment=2048 --align-end
aligns new partitions to 1 MiB (2048 sectors). This enables for example--sector-size=4096
forcryptsetup luksFormat
.
from disko.
Is there a way to specify bytes instead of sectors?
from disko.
This is contradicting the original message of this PR
I believe what matters for the goal described in #362 is --align-end
, not --set-alignment 2048
:
# truncate -s 123456789 test.img
# losetup -f --show test.img
/dev/loop1
losetup: test.img: Warning: file does not fit into a 512-byte sector; the end of the file will be ignored.
# sgdisk --align-end --new=4:0:-0 /dev/loop1
Creating new GPT entries in memory.
Warning: The kernel is still using the old partition table.
The new table will be used at the next reboot or after you
run partprobe(8) or kpartx(8)
The operation has completed successfully.
# gdisk -l /dev/loop1
GPT fdisk (gdisk) version 1.0.9.1
Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present
Found valid GPT with protective MBR; using GPT.
Disk /dev/loop1: 241126 sectors, 117.7 MiB
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): 254E2E19-9744-46F6-9DC9-3D6B761DA635
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 241092
Partitions will be aligned on 2048-sector boundaries
Total free space is 3491 sectors (1.7 MiB)
Number Start (sector) End (sector) Size Code Name
4 2048 239615 116.0 MiB 8300
# bc <<< "(239615+1-2048)/2048"
116.00000000000000000000
Is there a way to specify bytes instead of sectors?
Not in sgdisk per se. This can be done with blockdev --getss
and a bit of shell arithmetic (e. g. $(( 1048576 / $(blockdev --getss) ))
), but per the above I don't think that's necessary.
from disko.
from disko.
I guess than we should drop --set-alignment
and only keep --align-end
.
from disko.
for 4K-native disks this results in 8 MiB alignment which is excessive
I completely agree that 8 MiB is excessive. Btw. @intelfx , do you have an example of a cloud provider / hardware that shows up on Linux as 4k? All modern SSDs are 4k or more inside (physically) but outside (on Linux) they still show up as 512.
I guess than we should drop --set-alignment and only keep --align-end.
I found this: https://www.rodsbooks.com/gdisk/advice.html
When you specify a partition size in MiB or larger units, the partition-size end-alignment is automatic. It's only the last partition that might be affected by this policy, which is automatic in gdisk and cgdisk but must be activated by the new -I/--align-end option to sgdisk. You can override the feature by specifying an exact end sector in sgdisk, including by copying the end sector specified on the prompt line that shows the valid end sector values.
So dropping --set-alignment
should work and @intelfx tested that on a loop device above (thank you for testing).
@intelfx :
Could you please confirm that the alignment with --align-end
is in MiB regardless if you give sgdisk a specific size in MiB or no size at all?
from disko.
I guess than we should drop
--set-alignment
and only keep--align-end
.
Yes, that's my impression as well. I'll make a PR.
from disko.
Yes, that's my impression as well. I'll make a PR.
@intelfx Did you see my questions?
from disko.
@rudolfvesely No, sorry, the GitHub app didn't load the comment for some reason and my mail is broken atm.
do you have an example of a cloud provider / hardware that shows up on Linux as 4k? All modern SSDs are 4k or more inside (physically) but outside (on Linux) they still show up as 512.
Lots of hardware is 4Kn-capable, just not configured that way by default. For example, all my hardware is like that (Seagate Exos X16 ST16000NM001G-2KK103 and WD_BLACK SN850 WDS200T1X0E-00AFY0).
You can also easily virtualize some yourself with qemu/KVM (on libvirt, saying <blockio logical_block_size='4096' physical_block_size='4096'/>
is enough).
Could you please confirm that the alignment with --align-end is in MiB regardless if you give sgdisk a specific size in MiB or no size at all?
Yes --new=1:0:3M
, --new-1:0:+3M
and --new:1:0
all end up in 1 MiB alignment on both 4Kn and 512e hardware.
It does create a misaligned end, though, if you explicitly give it a misaligned size, a misaligned end OR a misaligned start and an aligned size:
--new=1:0:12345K
--new=1:0:+12345K
--new=1:12345K:+1M
But these behave the same way with or without --set-alignment=2048
.
from disko.
Related Issues (20)
- Using disko to generate raspberry pi sd card images
- Random boot failues due to partition confusion because disko now relies on `by-partlabel` HOT 12
- ZFS Features Support: Dataset property inheritance HOT 2
- Converting an existing system to use disko? HOT 5
- GRUB Mirrored boot entries with disko HOT 2
- zpool create error: one or more vdevs refer to the same device HOT 1
- How to test luks setup with `--vm-test` HOT 5
- device already has a partition, skipping creating zpool zroot HOT 1
- Can't automount ZFS dataset without using mountpoint="legacy" HOT 3
- `disko-install` should error out immediately if it was invoked without `sudo` HOT 1
- [DOC] add demo/example config for subvolumes on btrfs on lvm on luks HOT 1
- Add docs for upgrade from legacy table to gpt HOT 5
- QUESTION: neededForBoot option HOT 2
- Random Boot failures due to failing to mount /usr/bin HOT 4
- Size range HOT 1
- encrypted swap and hibernation HOT 2
- Generate an .iso unattended install image HOT 17
- typo in the docs?
- how to to pass flake `self` using `specialArgs`? HOT 2
- disko-install: error: infinite recursion encountered HOT 13
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from disko.