sfdisk: -X option doesn't work

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I've a disk that been GPT-formatted before, but now there's just MBR:

	$ sudo sfdisk -l /dev/sdc     
	Disk /dev/sdc: 14.9 GiB, 16025444352 bytes, 31299696 sectors
	Units: sectors of 1 * 512 = 512 bytes
	Sector size (logical/physical): 512 bytes / 512 bytes
	I/O size (minimum/optimal): 512 bytes / 512 bytes
	Disklabel type: dos
	Disk identifier: 0x79215d34

	Device     Boot Start      End  Sectors  Size Id Type
	/dev/sdc1        2048 31299695 31297648 14.9G 83 Linux

Fine, but magically, both "/dev/disk/by-label/" and lsblk shows names/labels that been there before the disk reformatted into MBR!

	$ sudo lsblk -o name,mountpoint,label,size,uuid /dev/sdc
	NAME   MOUNTPOINT LABEL               SIZE UUID
	sdc               Ubuntu 15.10 amd64 14.9G 2015-10-21-16-17-40-00
	└─sdc1            Ubuntu 15.10 amd64 14.9G 502229b0-6d02-46ee-8fd1-b3321f11e53f

It causes errors with grub-install like "Attempting to install GRUB to a disk with multiple partition labels.  This is not supported yet..". So I want to just remove those names. But "sgdisk" sees that GPT table is invalid, and tries to reconstruct it from MBR, whilst I'd need to force it into thinking like it is valid, so that it see the damn names.

Thankfully, there's sfdisk with -X option:

	$ sudo sfdisk -lX gpt /dev/sdc 
	Disk /dev/sdc: 14.9 GiB, 16025444352 bytes, 31299696 sectors
	Units: sectors of 1 * 512 = 512 bytes
	Sector size (logical/physical): 512 bytes / 512 bytes
	I/O size (minimum/optimal): 512 bytes / 512 bytes
	Disklabel type: dos
	Disk identifier: 0x79215d34

	Device     Boot Start      End  Sectors  Size Id Type
	/dev/sdc1        2048 31299695 31297648 14.9G 83 Linux

It worked… Or not? "Disklabel" says "dos", and most importantly, I see no partition names.

Turns out, sfdisk would print the same information for pretty much anything, i.e. even for "sfdisk -X foo", so the option just doesn't work.
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux