Solved Using the extra space on a USB device with mfsBSD

Hi folks.

I'm having a brain-dead moment and would appreciate some help.

I've got mfsBSD on an 8GB USB stick (/dev/da1). Since it really only uses around 47MB, I'd like to be able to use the rest of the space on the device for files. The device will only ever be used for FreeBSD.

I've tried creating a partition (partition 1) and format it to UFS, but that just makes the stick unbootable. I can't seem to find anything that turns the light bulb on in man pages or Google results.

Output of fdisk da1:
Code:
******* Working on device /dev/da1 *******
parameters extracted from in-core disklabel are:
cylinders=973 heads=255 sectors/track=63 (16065 blks/cyl)

parameters to be used for BIOS calculations are:
cylinders=973 heads=255 sectors/track=63 (16065 blks/cyl)

Media sector size is 512
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 1 is:
<UNUSED>
The data for partition 2 is:
<UNUSED>
The data for partition 3 is:
<UNUSED>
The data for partition 4 is:
sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
    start 0, size 50000 (24 Meg), flag 80 (active)
        beg: cyl 0/ head 0/ sector 1;
        end: cyl 1023/ head 254/ sector 63

Output of bsdlabel da1:
Code:
# /dev/da1:
8 partitions:
#          size     offset    fstype   [fsize bsize bps/cpg]
  a:      92144         16    unused        0     0
  c:      92160          0    unused        0     0     # "raw" part, don't edit

Output of ls /dev/da1*:
Code:
/dev/da1
/dev/da1a

What do I need to do to use the remaining space?

I should mention that I'm new to UNIX, but I've been using Linux for 15 years (9 years sans-MS at home).

Thanks in advance for your help.

Cheers!
Randall
 
I think that's exactly what I was looking for, thank you!

I'll admit that I'm intimidated by gpart--fdisk I know, but gpart is a new animal to me.

For those looking to do similar...

gpart show da1
Code:
=>       0  15633408  da1  BSD  (7.5G)
         0        16       - free -  (8.0K)
        16     92144    1  !0  (45M)
     92160  15541248       - free -  (7.4G)

Then, gpart add -t freebsd-ufs -a 4k da1
Code:
da1b added
And again with gpart show da1
Code:
=>       0  15633408  da1  BSD  (7.5G)
         0        16       - free -  (8.0K)
        16     92144    1  !0  (45M)
     92160  15541240    2  freebsd-ufs  (7.4G)
  15633400         8       - free -  (4.0K)

Finally, newfs -U /dev/da1b
Code:
/dev/da1b: 7588.5MB (15541248 sectors) block size 32768, fragment size 4096
        using 13 cylinder groups of 626.09MB, 20035 blks, 80256 inodes.
        with soft updates
super-block backups (for fsck_ffs -b #) at:
192, 1282432, 2564672, 3846912, 5129152, 6411392, 7693632, 8975872, 10258112, 11540352, 12822592, 14104832, 15387072

I'll wait until I get home to reboot (and mark as solved), but it looks like that's it.

Cheers!
Randall
 
gpart(8) is a lot easier to use than the older disk partitioning tools. It is generally smarter about the partition schemes, also.

The partition scheme on that USB drive is what is called "dangerously dedicated". It's called that because it is a plain BSD partition tables, and few non-BSD partitioning tools out there understand that format.

You are correct in adding a partition, but the starting location is not needed, gpart(8) will figure that out. So it is simpler: gpart add -t freebsd-ufs da1. If a partition size is not given, the rest of the free space is allocated. A refinement is to ask for alignment to 4K blocks: gpart add -t freebsd-ufs -a 4k da1. On a USB memory stick, that might not make much difference, but improves performance on disks and SSDs with 4K blocks.
 
The partition scheme is generated by mfsBSD. It certainly doesn't look like the partition tables on machines I've installed FreeBSD on so far, which is one of the reasons I think I was having trouble with it.

I've corrected my previous post to reflect the simplified command and 4k blocks. Thank you wblock.

Migrating from Linux has been a bit of a challenge, but I'm loving FreeBSD so far.

Cheers!
Randall
 
Back
Top