[SOLUTION]
Realised I was doing this on a machine with quite an old install (FreeBSD 10)
When tried on a machine with a more modern version it works as expected. I guess it's a bug that was fixed.
I'll leave the text here in case someone else happens to come across the same issue.
=============
I'm trying to extend the last partition on a MicroSD card. There's already data on the card, so it's vital that partition offsets remain exactly the same.
I want the first partition to start at LBA 2048, but for some reason gpart places it at LBA 2079.
Original layout before any changes:
And here's the config used by gpart backup, with the size of the last partition enlarged:
But when I do
I also tried deleting the partitions, and manually creating the first, with the same result:
I also tried adding "-a 512b" and "-a 1" in case it was trying to align to something larger than a sector, but that does not change the behaviour.
Why does gpart ignore my explicit request to start at LBA 2048?
Realised I was doing this on a machine with quite an old install (FreeBSD 10)
When tried on a machine with a more modern version it works as expected. I guess it's a bug that was fixed.
I'll leave the text here in case someone else happens to come across the same issue.
=============
I'm trying to extend the last partition on a MicroSD card. There's already data on the card, so it's vital that partition offsets remain exactly the same.
I want the first partition to start at LBA 2048, but for some reason gpart places it at LBA 2079.
Original layout before any changes:
Code:
# gpart show da0
=> 63 124735425 da0 MBR (59G)
63 1985 - free - (993K)
2048 262144 1 !12 (128M)
264192 30851073 2 linux-data (15G)
31115265 93620223 - free - (45G)
And here's the config used by gpart backup, with the size of the last partition enlarged:
Code:
# gpart backup da0 > config.txt
<edit config.txt>
# cat config.txt
MBR 4
1 !12 2048 262144
2 linux-data 264192 123731968
But when I do
cat config.txt | gpart restore -F da0
, gpart sets the first partition to start at LBA 2079 instead of LBA 2048:
Code:
# cat config.txt | gpart restore -F da0
# gpart show da0
=> 63 124735425 da0 MBR (59G)
63 2016 - free - (1.0M)
2079 262080 1 !12 (128M)
264159 63 - free - (32K)
264222 123731937 2 linux-data (59G)
123996159 739329 - free - (361M)
I also tried deleting the partitions, and manually creating the first, with the same result:
Code:
# gpart delete -i 2 da0
# gpart delete -i 1 da0
# gpart add -t \!12 -i 1 -b 2048 -s 262144 da0
# gpart show da0
=> 63 124735425 da0 MBR (59G)
63 2016 - free - (1.0M)
2079 262080 1 !12 (128M)
264159 124471329 - free - (59G)
I also tried adding "-a 512b" and "-a 1" in case it was trying to align to something larger than a sector, but that does not change the behaviour.
Why does gpart ignore my explicit request to start at LBA 2048?
Last edited by a moderator: