# USB image won't boot after resize



## mike99 (Oct 27, 2014)

I want to do a headless install on PC Engine APU but since there is no space left on the USB stick after writing with dd to the USB stick, I must resize the partition to be able to add loader.conf to the USB stick.

So, I use gpart and growfs to resize the USB stick to 8 GB.

`gpart resize -i 1 -a 4k -s 8G da0
growfs -s 8G /dev/da0a`

But the stick won't boot anymore. I must specify the partition to mount at boot.

`ufs:/dev/da0a`

Can anywone explain me how to fix the boot of the USB stick without changing the stick's fstab to /dev/da0a?

Thanks


----------



## wblock@ (Oct 27, 2014)

What does `tunefs -p /dev/da0a` show before and after growfs()?  Maybe it removes or corrupts the label, the -L parameter.


----------



## mike99 (Feb 11, 2016)

Just encounter the same problem and remembered about I already started a thread about this on the forum. The label seem fine after `growfs`.

After `growfs`:

```
tunefs -p /dev/da0a
tunefs: POSIX.1e ACLs: (-a)                                disabled
tunefs: NFSv4 ACLs: (-N)                                   disabled
tunefs: MAC multilabel: (-l)                               disabled
tunefs: soft updates: (-n)                                 disabled
tunefs: soft update journaling: (-j)                       disabled
tunefs: gjournal: (-J)                                     disabled
tunefs: trim: (-t)                                         disabled
tunefs: maximum blocks per file in a cylinder group: (-e)  2048
tunefs: average file size: (-f)                            16384
tunefs: average number of files in a directory: (-s)       64
tunefs: minimum percentage of free space: (-m)             8%
tunefs: space to hold for metadata blocks: (-k)            0
tunefs: optimization preference: (-o)                      time
tunefs: volume label: (-L)                                 FreeBSD_Install
```

Before `growfs`:

```
tunefs -p /dev/da0a
tunefs: POSIX.1e ACLs: (-a)                                disabled
tunefs: NFSv4 ACLs: (-N)                                   disabled
tunefs: MAC multilabel: (-l)                               disabled
tunefs: soft updates: (-n)                                 disabled
tunefs: soft update journaling: (-j)                       disabled
tunefs: gjournal: (-J)                                     disabled
tunefs: trim: (-t)                                         disabled
tunefs: maximum blocks per file in a cylinder group: (-e)  2048
tunefs: average file size: (-f)                            16384
tunefs: average number of files in a directory: (-s)       64
tunefs: minimum percentage of free space: (-m)             8%
tunefs: space to hold for metadata blocks: (-k)            0
tunefs: optimization preference: (-o)                      time
tunefs: volume label: (-L)                                 FreeBSD_Install
```

The error I get is

```
Trying to mount root from ufs:/dev/usf/FreeBSD_Install [ro,noatime]
mountroot: waiting for device /dev/ufs/FreeBSD_Install
Mounting from ufs:/dev/usf/FreeBSD_Install failed with error 19

Loder variables:
  vfs.root.mountfrom=ufs:/dev/ufs/FreeBSD_Install
  vfs.root.mountfrom.options=ro,noatime
```

Even after booting via

```
mountroot> ufs:/dev/da0a
```

If I check with `tunefs`, the label still seem fine.


----------



## Juha Nurmela (Feb 11, 2016)

`gpart recover da0` before and after the partition stretch ? `growfs da0a` without the explicit size ?

Juha


----------



## mike99 (Feb 11, 2016)

After growfs:
`gpart recover da0`

```
da0 recovering is not needed
```

I have already try `growfs` without explicit size and also `gpart` without the -a 4k option.


----------



## wblock@ (Feb 11, 2016)

What is "typefs"?


----------



## mike99 (Feb 11, 2016)

Oups, sorry, `tunefs`, not typefs. I edited the post to fix this.


----------



## mike99 (Feb 11, 2016)

Seem like `glabel` info is missing for da0 while using `glabel status` after resizing disk. I'm testing it right now and will write back tomorrow if it's work.


----------



## mike99 (Feb 12, 2016)

Before growing partition:



```
glabel status
                                      Name  Status  Components
gptid/f2a15f25-d033-11e5-b1ee-90e2ba1f75c0     N/A  ada0p1
              diskid/DISK-070D5836C00C7814     N/A  da0
                    ufsid/55cb6aa66b8b4567     N/A  da0a
                       ufs/FreeBSD_Install     N/A  da0a
```
After growing partition:


```
glabel status
                                    Name  Status  Components
gptid/f2a15f25-d033-11e5-b1ee-90e2ba1f75c0     N/A  ada0p1
              diskid/DISK-070D5836C00C7814     N/A  da0
```

Now, I reading `glabel` man page but can't find a way to set ufs/ or ufsid/ before the name of the device, even less both at the same time



```
glabel label FreeBSD_Install da0a
glabel status
                                      Name  Status  Components
gptid/f2a15f25-d033-11e5-b1ee-90e2ba1f75c0     N/A  ada0p1
              diskid/DISK-070D5836C00C7814     N/A  da0
                     label/FreeBSD_Install     N/A  da0a
```


```
glabel label ufs/FreeBSD_Install da0a
glabel status
                                      Name  Status  Components
gptid/f2a15f25-d033-11e5-b1ee-90e2ba1f75c0     N/A  ada0p1
              diskid/DISK-070D5836C00C7814     N/A  da0
                     label/ufs/FreeBSD_Ins     N/A  da0a
```

Anybody know how to set ufs and ufsid label name ?

Thanks

Edit: It's clear in `glabel` doc that those are configured via `tunefs`. I will continue to search in tunefs man page.

Edit2: I misread, automatic label are set via `glabel` but I don't see on man page how to set ufs and ufsid label.


----------



## wblock@ (Feb 12, 2016)

When filesystems or partitions have built-in labels, it is used automatically.  Editing those labels is done with whatever specific utility set them in the first place.

Do not use glabel(8) on existing filesystems.  It will overwrite the last block of them and create a new device.


----------

