Skip to main content

Questions tagged [sfdisk]

A script-oriented tool for partitioning block devices.

6 votes
2 answers
802 views

How can I list partitions in storage order?

After telling general information (capacity, sector size and the like) fdisk shows 8 columns: sdXY, Boot, begin, end, # of sectors, size, flags, type. The partitions get sorted by Y in their sdXY ...
Adalbert Hanßen's user avatar
1 vote
1 answer
146 views

fdisk partition type shown as empy when type is an UUID

I have two systems with same versions (Debian 11.7, util-linux 2.36.1-8+deb11u1). Why one system shows partition types as UUIDS and the second doesn't and also doesn't recognize that types showing &...
Noman_1's user avatar
  • 121
1 vote
1 answer
4k views

How can you give a disk and a new UUID?

I just used sfdisk to clone my partition table to a new disk, sudo sfdisk -d /dev/nvme0n1 > /tmp/part.txt sudo sfdisk /dev/nvme1n1 < /tmp/part.txt However, now both drives have the same uuid. ...
Evan Carroll's user avatar
  • 35.1k
2 votes
2 answers
1k views

Are UUIDs and PTUUIDs important for MBR disks? If so, how do I create them on my own?

I'm studying partitioning under Linux, starting with sfdisk. If I copy a partition table from one drive to another, it'll copy the device UUID and the PTUUIDs for each partition, but if I'm creating a ...
Tango's user avatar
  • 373
1 vote
1 answer
1k views

Copying a partition table with sfdisk from a larger device to a smaller one

I'm testing a Python script intended for use on Raspberry Pi systems for reformatting and copying partition info and partition data. To get the information from the first device (often a USB memory ...
Tango's user avatar
  • 373
7 votes
1 answer
15k views

Move a partition to the right using command line tools

I have a partition, say 190 GB, followed by 100 GB of unpartitioned disk free space. I want to move this partition 100GB "to the right" (towards a higher sector number), so that the free ...
Totor's user avatar
  • 21.1k
0 votes
0 answers
171 views

Will sfdisk partition copy touch RAID data

A recent Ubuntu server reboot caused two of the SOFT RAID5 disk (/dev/sdd and /dev/sdf) losing its partition table (/dev/sdd1 and /dev/sdf1), I have tried to use R-Studio that can directly connect to ...
Twinkiestar's user avatar
2 votes
1 answer
281 views

How to replace linux distro ISO on bootable USB keeping extra data partition intact and accessible?

USB sticks are getting larger. I'd like to store data in addition to having USB bootable. And I know how: 1. write ISO to USB stick 2. Add partition via Gnome-disks (both GUI). Now I want to be able ...
Martian2020's user avatar
  • 1,483
0 votes
1 answer
2k views

Looking for a way to correct Hard Drive geometry. # of cylinders is not correct

I have 2 hard drives that have become corrupted as in the # of cylinders is no longer correct. Not sure how this is happening, but have same hard drive model that I have verified the correct # of ...
Ronnie_g's user avatar
0 votes
1 answer
766 views

Sfdisk NVME issue, No such device or address

I have custom LFS installer which contains sfdisk, I am trying to add support for NVME disks on it. When I make partitions with sfdisk on a normal SATA disk, things go as expected but when I do the ...
Bart's user avatar
  • 101
0 votes
0 answers
198 views

Why are uuid and ptuuid different for different commands

I get the following results for the 3 commands blkid, lsblk and sfdisk on an Arch Linux system $ lsblk --json -p -b -o+PTUUID,UUID /dev/sda1 { "blockdevices": [ { "...
wasp256's user avatar
  • 209
2 votes
1 answer
3k views

fdisk or sfdisk + how to show the disks size in GIB and not in GB

we can print all disks by the following ( on our RHEL machine ) fdisk -lu | grep "Disk /dev" Disk /dev/sda: 247.0 GB, 246960619520 bytes, 482344960 sectors Disk /dev/sdb: 4294 MB, 4294967296 ...
yael's user avatar
  • 14k
0 votes
1 answer
829 views

Scripting the partition shrinking

I have some disk image, taken with dd if=/dev/somedevice of=filename.img. I was able to shrink them following this tutorial. Now I would like to script all the procedure, and I managed to perform ...
ErniBrown's user avatar
  • 111
0 votes
1 answer
347 views

Heredoc not working in bash script

I made a bash script that was working in Ubuntu mate but now it won't work in Manjaro. It fails on this method: #!/bin/bash dev_block="/dev/sdb" createPartitions(){ echo "...
FlexMcMurphy's user avatar
2 votes
1 answer
237 views

Redirecting output from within disk operations does not work

I am not able to successfully redirect STDOUT+STDERR on commands that operates with disks. Standard redirecting which always works, is somehow now catching the output. Two practical examples: Example ...
Josef Komjati's user avatar

15 30 50 per page