Solved Cannot resize partition on USB memory stick with FreeBSD installation

IPTRACE

Well-Known Member

Reaction score: 22
Messages: 316

Code:
user@serv:~ % sudo gpart show /dev/da0
=>       1  63012863  da0  MBR  (30G)
         1      1600    1  efi  (800K)
      1601   1904464    2  freebsd  [active]  (930M)
   1906065  61106799       - free -  (29G)

user@serv:~ % sudo gpart resize -i 2 -s 30G -a 4k da0
da0s2 resized

user@serv:~ % sudo growfs /dev/da0s2
growfs: superblock not recognized

user@serv:~ % sudo growfs /dev/da0s2a
growfs: requested size 930MB is not larger than the current filesystem size 930MB

user@serv:~ % sudo gpart show /dev/da0
=>       1  63012863  da0  MBR  (30G)
         1      1600    1  efi  (800K)
      1601  62914559    2  freebsd  [active]  (30G)
  62916160     96704       - free -  (47M)

Filesystem          Size    Used   Avail Capacity iused ifree %iused  Mounted on
/dev/da0s2a         924M    864M    -14M   102%     12k   11k   52%   /mnt
Any suggestions?
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 8,050
Messages: 31,631

This is an MBR partitioned stick, the da0s2 is a slice not a partition. After resizing the slice you'll need to resize the actual partitions inside the slice.
 
OP
OP
IPTRACE

IPTRACE

Well-Known Member

Reaction score: 22
Messages: 316

So, I should resize -i 1 ? If yes, I was trying without success.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 8,050
Messages: 31,631

Resize the partitions inside da0s2.

It looks like the slice is correctly resized:
Code:
1601  62914559    2  freebsd  [active]  (30G)
But your partitions inside that slice are still the old size. gpart show da0s2 should tell you which partition. Typical bsdlabel(8) has the a partition for the root filesystem, b for swap. So you may need to move swap out of the way first.
 
OP
OP
IPTRACE

IPTRACE

Well-Known Member

Reaction score: 22
Messages: 316

user@serv:~ % sudo gpart resize -i 1 -a 4k da0
gpart: autofill: No space left on device
 
OP
OP
IPTRACE

IPTRACE

Well-Known Member

Reaction score: 22
Messages: 316

It worked. Thanks.

user@serv:~ % sudo gpart show da0s2
=> 0 1904464 da0s2 BSD (930M)
0 16 - free - (8.0K)
16 1904448 1 freebsd-ufs (930M)

user@serv:~ % sudo gpart resize -i 2 -a 4k da0
da0s2 resized
user@serv:~ % sudo gpart show da0s2
=> 0 63011263 da0s2 BSD (30G)
0 16 - free - (8.0K)
16 1904448 1 freebsd-ufs (930M)
1904464 61106799 - free - (29G)

user@serv:~ % sudo gpart resize -i 1 -a 4k da0s2
da0s2a resized
user@serv:~ % sudo growfs /dev/da0s2a
It's strongly recommended to make a backup before growing the file system.
OK to grow filesystem on /dev/da0s2a from 930MB to 30GB? [yes/no] yes
super-block backups (for fsck_ffs -b #) at
 
Top