You are not logged in.

#1 2023-05-14 11:29:24

newsboost
Member
Registered: 2016-07-24
Posts: 157

[SOLVED] sfdisk-partition: Sector xxx already used. Failed to add p...

Hi

I'm trying to do something I consider "semi"-advanced: I have a clonezilla-backup of a 1 TB disk and want to restore most of the partitions to a smaller disk. But I cannot partition the new disk's /dev/sda5-partition which is really really weird I think because that should be exactly the same as on the old disk. If you look at this screenshot (click https://ibb.co/yB9s43C if the image isn't shown):

sfdisk partition info

To the left you see the original "sfdisk" partition data and to the right I manually edited some things:

  • I deleted the "last-lba", because it didn't work when I used the "number of sectors"-value from "fdisk -lu /dev/sda | head -1" and also not if I subtracted 1 from that value (error message: "Last LBA specified by script is out of range").

  • I deleted the /dev/sda{7,9,10}-partitions because they shouldn't be on the new smaller disk.

  • I then tried to manually calculate the last (sda6 and sda7) "start="-values based on the "size="-values.

  • I apply the partition data using "sfdisk /dev/sda < partition_data.sf".

But I get this error "Sector XXX already used" (click https://ibb.co/f0bFq8k if the image isn't shown):

sfdisk partition error

I thought the problem was because I wasn't booted into UEFI-mode (as in the screenshot). But then I took a good old Arch Linux USB-stick and booted up in UEFI-mode and I still got the same error: "Sector xxx already used. Failed to add #5 partition: Numerical result out of range" - which is really weird, because it's only /dev/sda{6,7} that I manually fiddled with?

Can anyone help/explain how to fix this? I don't understand it, but would be grateful if anyone knows the solution or have good ideas, thanks!

Last edited by newsboost (2023-05-14 16:40:23)

Offline

#2 2023-05-14 11:52:22

Raynman
Member
Registered: 2011-10-22
Posts: 1,539

Re: [SOLVED] sfdisk-partition: Sector xxx already used. Failed to add p...

The smaller disk simply doesn't have enough sectors?

Offline

#3 2023-05-14 16:38:58

newsboost
Member
Registered: 2016-07-24
Posts: 157

Re: [SOLVED] sfdisk-partition: Sector xxx already used. Failed to add p...

Raynman wrote:

The smaller disk simply doesn't have enough sectors?

Oh, stupid me... You're right! I had to boot up the Windows-pc and the partition-tool shows there's a huge unallocated chunk as seen here (link: https://ibb.co/rMCfrXN):

Windows partition tool

"Ideally" I would have to move all data to the left, but that takes time and I prefer not to mess around with the original disk. I have a new idea: I just change the "start"-sector of the /dev/sda5-partition (and those after that) on the new drive and then try to restore the old partition, to the new location... I've never tried this - hopefully it'll work... Here's my updated partition boundary list (hopefully I did it right, I'll check a bit later tonight - link: https://ibb.co/LhhvLbf):

Updated partition boundaries (UN-TESTED)

Thanks a lot @Raynman, I forgot this stupid little thing and just couldn't see it and almost gave up!

Offline

Board footer

Powered by FluxBB