gpart resize always return "Invalid argument"? reddit / freebsd ---------------------------------------------------------------------- anyracetam · 2023-06-29 19:24 I tried to combine/merge the unused space "3" to the "4" like below, but gpart was unable to resize. Do you guys have a solution? [root@Masternode-3 /www]# gpart show => 3 125829109 da0 GPT (60G) 3 127 1 freebsd-boot (64K) 130 66584 2 efi (33M) 66714 2097152 - free - (1.0G) 2163866 123665246 4 freebsd-ufs (59G) [root@Masternode-3 /www]# gpart resize -i 4 -s 60G -a 4k da0 gpart: size '125829118': Invalid argument ​ ---------------------------------------------------------------------- grahamperrin · 2023-06-29 21:50 I guess, resizing a partition with a UFS file system does not involve moving; does not involve changing the start position (in your case `2163866`, and so on. You have no free space *after* `123665246`. ---------------------------------------------------------------------- OwnPomegranate5906 · 2023-07-09 18:06 You can’t change the start position of the partition without seriously freaking out your file system on there. The simplest thing to do is boot up on a FreeBSD USB disk and have another usb disk with enough free space to hold the contents of partition 4. dd the contents of partition 4 to an IMG file on the usb disk with free space, then delete 4, make a new 3 that takes up all the space of both 3 and 4, then dd the img file to 3, then grow the file system so it uses the whole partition ---------------------------------------------------------------------- grahamperrin · 2023-07-11 05:04 > You can’t change the start position of the partition without seriously freaking out your file system on there. … GParted (on Linux) should be capable of moving the partition and its UFS file system – – I used the utility many times, over the years, albeit never with FFS/UFS. ---------------------------------------------------------------------- OwnPomegranate5906 · 2023-07-11 05:11 Not to my knowledge. If you move the start position, you have to copy all the blocks inside the partition so that they start at the new start position. If you just change the start position to be 1GB closer to the start of the disk, the file system doesn't start until a GB after the partition starts, and all the block pointers will be wrong. Essentially, the partition will look blank unless you have some way of telling the file system driver to skip the first GB of blocks, but that still doesn't fix all the block pointers being wrong. It's not such a simple thing to just change the start position of a partition. ---------------------------------------------------------------------- grahamperrin · 2023-07-11 21:12 > If you move the start position, you have to copy all the blocks inside the partition so that they start at the new start position. That's what I expect with _moving the partition_. ---------------------------------------------------------------------- OwnPomegranate5906 · 2023-07-11 21:45 *Moving the partition* implies copying the contents to its new location. *Moving the start position* is literally updating a record in the GPT partition map to say the partition now starts at a different location. They sound similar (and hence the confusion), but they are not the same thing. ---------------------------------------------------------------------- OwnPomegranate5906 · 2023-07-11 21:52 > https://en.wikipedia.org/wiki/GParted#Supported_features That very well may be on Linux, however, this is FreeBSD, and it very well may be supported on FreeBSD as well, however, I simply wouldn't trust it to safely do the right thing, as there's no simple way to do it in a recoverable manner if a failure were to happen mid-operation. I personally would never even consider such an operation unless I had that partition backed up somewhere first, and if I had that, then it'd be easier to do what I've already suggested. ---------------------------------------------------------------------- grahamperrin · 2023-07-19 01:51 Thanks, but I wasn't confused; when I wrote *moving the partition* it was deliberate. ---------------------------------------------------------------------- grahamperrin · 2023-07-19 02:01 > this is FreeBSD, and it very well may be supported on FreeBSD as well, There is no GParted for FreeBSD; that's why I wrote _on Linux_. Sorry for not making this clear. Not yet listed as wanted at , however: * it's *nice to have* at * it was [mentioned in a topic](https://forums.freebsd.org/posts/550989) that was begun by a member of The FreeBSD Foundation. ---------------------------------------------------------------------- OwnPomegranate5906 · 2023-07-19 05:37 > There is no GParted for FreeBSD; that's why I wrote > on Linux. Sorry for not making this clear. No, but FreeBSD has gpart built in, though it's functionality is pretty basic compared to gparted, but if you have a spare USB disk that has enough space to dd the partition 3 to it, you can use gpart to drop index 2 and index 3, then make a new index 2 using all the free space, then dd the image file back onto the new partition, the grow the ufs file system. This is still the path I recommend as it's completely recoverable in the event that the operation is interrupted mid way through. Copying the contents of the partition forward in place won't be recoverable in the event it gets interrupted mid-way through (like loss of power, etc).