Solved Resizing a partition

I'm trying to increase the size of FreeBSD partition to make use of the free space beyond the partition. Having looked at The Handbook the only examples show what to do with a GPT disk. In my case I have an MBR disk.

gpart show:-
Code:
=>       63  117210177  da0  MBR  (56G)
         63       1985       - free -  (993K)
       2048     204800    1  ntfs  (100M)
     206848   76040192    2  ntfs  (36G)
   76247040   20971520    3  freebsd  [active]  (10G)
   97218560   19991680       - free -  (9.5G)

=>       0  20971520  da0s3  BSD  (10G)
         0  19920896      1  freebsd-ufs  (9.5G)
  19920896   1048576      2  freebsd-swap  (512M)
  20969472      2048         - free -  (1.0M)

How do I go about adding the 9.5G to the 10G partition so that I have a freebsd-ufs of 27.5G and the remainder as freebsd-swap?

Can't get my head around how to do this.
 
You're going to need to, temporarily, remove that freebsd-swap partition, it's in the way and is going to prevent you from resizing the freebsd-ufs partition. The basic idea is to resize the slice first, then remove the swap, resize the freebsd-ufs partition and create a new swap partition.
 
1. Make a full backup
2. Boot using livecd
3. Identify if you are working with the correct disk using camcontrol devlist and gpart show example below is for da0
4. resize da0s3 from 10G to 19G
gpart resize -i 3 -a 4k -s 19G da0
5. Delete the swap
gpart delete -i 2 da0s3
6. resize the da0s3a to 18G
gpart resize -i 1 -a 4k -s 18G da0s3
7. add new swap
gpart add -t freebsd-swap -s 1G da0s3
8. Expand an UFS
growfs /dev/da0s3a

p.s.
I assume that this disk is with 4k stripesize
 
backup is really import, last time I resize my nvme HD,I got some inode issue, I have to reinstall freebsd on my laptop. I do resize everything like freebsd handbook, I can go into freebsd after resizing it, but my laptop got down when I run some programs. you have to backup your everything before resizing
 
I see that this thread is marked resolved but seems to be a good one to add onto the discussion.

I am soon gonna shrink my freebsd-ufs from +900GB down to about 100GB. While I will increase the size of the freebsd-swap a few more GB I will use the empty space to create new partitions for virtualization purposes. I am guessing after I am done shrinking freebsd-ufs and growing freebsd-swap there will be significant space between those two partitions. My questions are: (1) is my guess correct, that indeed there will be significant space between those two partitions? (2) Or does gpart automatically 'pack' the partitions together? (I don't think so.) (3) What gpart command options (and/or flags) would I use to 'pack' the existing partitions (after they have been resized) so that they are contiguous with no unused space in between?

I realize the easy option would be to just destroy and create a newer swap but I'd like to learn how to 'wiggle' partitions around too, without having to destroy.

EDIT: Hmmmmm, maybe this too is very relevant:
FreeBSD move partition

EDIT2: Never mind. Some older posts from Mr. W Block have set me straight.
 
Back
Top