Is it possible to run gpart and newfs on file without root access (without mdconfig)?

Andriy Gapon avg at FreeBSD.org
Mon Jan 21 14:08:32 UTC 2013


on 21/01/2013 08:48 Lev Serebryakov said the following:
> Hello, Xin.
> You wrote 20 января 2013 г., 12:32:06:
> 
> XL> makefs?
>  It is second step. Here are several problems:
> 
>   (1) makefs doesn't create any partition tables / labels.
>   (2) makefs could not "inject" its image into file with partition
>   tables / labels.
> 
> makefs is good to create FS and make permission fixups (by mtree
> file,generated with root-less install) in one step, but it doesn't
> solve whole problem of full disk image creation, as far as I
> understand.
> 

I once used the following trick to create a simple partition table (dangerously
dedicated?) inside a makefs built image:

makefs -b '10%' -o label="${LABEL}",version=1 base.ufs R/
bsdlabel -w -B -b R/boot/boot -f base.ufs
_label_file=$(mktemp labelXXXXXX)
bsdlabel -f base.ufs | sed -e '/  a:/s/unused/4.2BSD/' -e '/  a:/s/ 16 /  0 /' >
${_label_file}
bsdlabel -R -f base.ufs ${_label_file}
rm -f ${_label_file}

I would be more happy to have gpart-in-userland :-)

-- 
Andriy Gapon


More information about the freebsd-geom mailing list