17
votes
Script to gdisk /dev/sdX and enter expert commands: x, z, y, y - how?
Per the author of gdisk, Rod Smith, the proper tool for this kind of job is sgdisk — a command-line program intended for use in scripts or by experts who need quick and direct access to a specific ...
6
votes
Optimal partition sizes with Gparted and Gdisk
It's not possible to make partitions at byte resolution. Even if you could, it would leave you with no end of alignment issues.
Sector size is either 512 or 4096, all partition sizes must be multiples ...
5
votes
How to renumber GPT partitions on an umounted disk?
To sort partitions on /dev/sdX:
#sgdisk -s /dev/sdX
5
votes
Remove all traces of GPT disk label
You could do it with wipefs:
wipefs can erase filesystem, raid or partition-table signatures (magic strings) from the
specified device to make the signatures invisible for libblkid. wipefs does ...
5
votes
Accepted
Change disk type from Microsoft Basic to Linux filesystem
Yes, for Linux that is entirely cosmetic.
The Type field is based on the partition type GUIDs in your GPT partition table, and there is a lot of possible types.
Changing the partition type GUID ...
5
votes
Accepted
Partitioning and formatting a 4k-emulated (512e) HDD
A physical sector size of 4096 means that the data on the drive is laid out in units of 4096 bytes, i.e. disk comprised of sequential "compartments" of 4096 bytes, that have to be written atomically. ...
4
votes
Accepted
Wrong sector size in NVMe
If you go to Sabrent's download page for your SSD, you'll find a package named "SSC software" - that is a Sector Size Converter.
With it, you can switch the block size presented to the system by the ...
4
votes
Resize partition table using gdisk
x = expert mode
e = move backup data to new end of disk
m = main menu
then delete / add partitions as you wish
d,n,p
w = save
it's not about re-calculating, but about where the backup data exists, ...
4
votes
Accepted
Remove all traces of GPT disk label
If you want a single command, instead of navigating interactive menus in gdisk, try:
$ sudo sgdisk -Z /dev/sdx
substituting sdx with the name of your disk in question.
(obviously - don't wipe out the ...
4
votes
Optimal partition sizes with Gparted and Gdisk
It's not advisable for partitions sizes to be multiples of 1'000'000'000 - this number is not divisable by 4096 which is crucial for proper performance of many Linux subsystems. If I were you, I'd use ...
4
votes
unable to dd, smartmon, fdisk or anything on a working external Western Digital Hard Drive
I think it is write-protected as external HDDs commonly has this feature, 'SR0' is probably OEM partition with software of this hdd.
I would suggest to download/install WDs proprietary software on ...
3
votes
How to renumber GPT partitions on an umounted disk?
Here a solution with using fdisk over gdisk, which I just tested:
According to this:
To reorder the Linux drive partition numbers for device sdc, all we
need to do is open a terminal…
type
sudo ...
3
votes
Accepted
Repository or documentation for gdisk error codes?
When gdisk outputs “Error is ...”, the error is an errno value. To see what they correspond to, run errno -l (at least on Linux systems).
Error 2 means “No such file or directory”, which makes sense ...
3
votes
Accepted
Where does the "Physical size" information come from?
Where does this "Physical size" value come from? Is it part of the partition table?
Yes.
See GUID Partition Table - Wikipedia
Is there any way for me to modify it so as to get rid of the &...
2
votes
Accepted
How to re-order partitions safely? Safe to use gdisk 'sort' option? Edit fstab + grub.cfg necessary?
To confirm, using 'sudo gdisk' and performing the (s)ort option works brilliantly with UUID disks under GPT disk type.
Running 'sudo grub-install /dev/sda' and then 'sudo update-grub' took care of ...
2
votes
Accepted
gdisk, make a non-permanent fix to a corrupted GPT table
You don't need your OS to recognize the partition. You can (try to) mount the entire device with proper offset. E.g. if you suspect (or if any tool tells you) the partition started at sector 2048 (...
2
votes
Why does resizing my raid to “max” cause a GPT error and is this dangerous?
The backup GPT table is corrupt, but the primary appears OK, so that will be used
This is expected. The backup GPT table lies at the end of your disk. If you grow (or shrink) your disk, its end mill ...
2
votes
Accepted
Recover partition table from running system and encrypted disk
Finally I've used testdisk to solve the issue I've identify my other partition :
#main partition
/sys/class/block/nvme0n1p2/start ...
2
votes
Accepted
script to gdisk to create a new partition
You can use sgdisk (it should be available from the same package as gdisk and it's the same tool just non-interactive). For your case you should be able to use something similar to
sgdisk -n $...
2
votes
KDE Partition Manager not seeing full disk size after cloning Windows 10 (UEFI) to larger SSD: how to move the secondary GPT table?
I found the solution to move the secondary GPT table to the end of the drive after cloning to a larger drive. Here, the example for a NVMe SSD.
run gdisk /dev/nvmen0
(or gdisk /dev/sda for a SATA ...
1
vote
Accepted
How to determine sizes using sgdisk partitioning in bash script
The following will work:
sgdisk --clear /dev/vda --set-alignment=1 --new 1:34:2047 --typecode 1:EF02 -c 1:"grub" -g /dev/vda
sgdisk --new 2:0:-2G --typecode 2:8300 -g /dev/vda
sgdisk --new 3:0:0 --...
1
vote
Accepted
How to mount a sparsed disk image
Your image is likely corrupt due to the flags you used on dd. If you can repeat the process never use dd. Instead,
gzip </dev/sdd >/.../sdd.img.gz
zcat /.../sdd.img.gz | cp --sparse=always /dev/...
1
vote
Accepted
Does gdisk partition and format it with xfs?
No, gdisk doesn't format newly created partitions to XFS so there are two options:
The disk wasn't empty. If there was a partition table and a partition with XFS previously that wasn't wiped before ...
1
vote
sas drive i/o error 5 via raid card - sed locked partition table
I am trying to find a better way to access my newly purchased SAS
drives ...
While trying to find information on how to recover a SAS drive to which I (inexplicably) wrote an *.ISO file, I came ...
1
vote
Accepted
Will I lose all mounts and symbolic links if I resize partitions with gdisk in Linux/Android?
Expanding the internal partition is easy, expanding the filesystem on that partition will not cause data loss. You will have to delete the "sdcard" partition to do so (which you will then re-...
1
vote
Accepted
Why does resizing my raid to “max” cause a GPT error and is this dangerous?
The problem was related with my using a 32bit kernel. In version 4 kernel the RAID maximum accessible size with a 32 bits kernel is RealSize modulo 16TiB, and in version 5, the maximum size is a ...
1
vote
unable to dd, smartmon, fdisk or anything on a working external Western Digital Hard Drive
To all intents and purposes this is a dead disk. The original owner has locked it in some way and so it's no longer a working or useful device.
Recommendation? Don't waste any more time on it but ...
1
vote
Changing HFSPlus UUID from PartedMagic
gdisk can only change the partition UUID (in the GPT). The volume ID of the HFS+ volume is something different. It comes from a 64-bit VSDB volume id in the FinderInfo. macOS converts that into a ...
1
vote
How to renumber GPT partitions on an umounted disk?
What about using sfdisk?
Backup:
sfdisk -d /dev/sdb > disc1.sfdisk # Create also a backup file too
Edit the text file like this:
Rearrange the entries as you wish
then finally renumber the ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
gdisk × 39partition × 15
fdisk × 8
gpt × 8
linux × 6
mount × 5
partition-table × 5
hard-disk × 4
data-recovery × 4
parted × 4
filesystems × 3
dd × 3
sgdisk × 3
disk × 2
raid × 2
mdadm × 2
gparted × 2
mbr × 2
mkfs × 2
ddrescue × 2
testdisk × 2
bash × 1
shell-script × 1
ubuntu × 1
arch-linux × 1