Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Other Things Gentoo
  • Search

zram-init mkfs option issue [Solved]

Still need help with Gentoo, and your question doesn't fit in the above forums? Here is your last bastion of hope.
Post Reply
Advanced search
15 posts • Page 1 of 1
Author
Message
grknight
Retired Dev
Retired Dev
Posts: 2556
Joined: Fri Feb 20, 2015 9:36 pm

zram-init mkfs option issue [Solved]

  • Quote

Post by grknight » Thu Feb 12, 2026 3:22 pm

I need zram-init to pass an option to mkfs.xfs but it is not working properly.

I've tried

Code: Select all

args0="-K '-c options=/usr/share/xfsprogs/mkfs/lts_6.6.conf'"
When used mkfs.xfs says "Unknown option: -c options=/usr/share/xfsprogs/mkfs/lts_6.6.conf", but if I run it from the command-line, e.g. mkfs.xfs -c options=/usr/share/xfsprogs/mkfs/lts_6.6.conf /dev/zram0 it works perfectly.

I know this is some eval shenanigans but no idea how to solve it.
Last edited by grknight on Thu Feb 12, 2026 7:36 pm, edited 1 time in total.
Top
pingtoo
Advocate
Advocate
User avatar
Posts: 2180
Joined: Fri Sep 10, 2021 8:37 pm
Location: Richmond Hill, Canada

Re: zram-init mkfs option issue

  • Quote

Post by pingtoo » Thu Feb 12, 2026 4:12 pm

grknight wrote:I need zram-init to pass an option to mkfs.xfs but it is not working properly.

I've tried

Code: Select all

args0="-K '-c options=/usr/share/xfsprogs/mkfs/lts_6.6.conf'"
When used mkfs.xfs says "Unknown option: -c options=/usr/share/xfsprogs/mkfs/lts_6.6.conf", but if I run it from the command-line, e.g. mkfs.xfs -c options=/usr/share/xfsprogs/mkfs/lts_6.6.conf /dev/zram0 it works perfectly.

I know this is some eval shenanigans but no idea how to solve it.
What happen if you take out the single quote (') in from of "-c" and after "...conf"?
Top
grknight
Retired Dev
Retired Dev
Posts: 2556
Joined: Fri Feb 20, 2015 9:36 pm

  • Quote

Post by grknight » Thu Feb 12, 2026 4:19 pm

pingtoo wrote:What happen if you take out the single quote (') in from of "-c" and after "...conf"?

Code: Select all

zram-init           | * Loading zram module...                                                                                                  [ ok ]
zram-init           | * Mount zram0 /var/tmp/portage
zram-init           |Usage: zram-init [options] SIZE|write [DIR]
zram-init           |Prepare a zRAM device and use it as swap (resp. mount it under DIR).
zram-init           |SIZE is the maximal size in megabytes.
zram-init           |For umounting/freeing the zRAM device, use SIZE=0.
zram-init           |When using "write" (or anything else starting with "w") an idle writeback
zram-init           |is forced (only makes sense if previously initialized with "-w" or "-W LIMIT").
zram-init           |If DIR is - then only a filesystem is created in /dev/zram$DEV (or the device
zram-init           |is removed if SIZE is 0) but it is not mounted
zram-init           |(options "-o", "-c", "-m", and "-T" take no effect in this case, of course).
zram-init           |The latter can be useful e.g. for Btrfs if multiple devices should be mounted
zram-init           |jointly afterwards.
zram-init           |The following options are available.
zram-init           |An empty argument means the same as if the option is not specified.
zram-init           |-d DEV     Use zRAM device DEV. If not specified, DEV=0 is assumed.
zram-init           |           Make sure to use the matching value for umounting (SIZE=0)!
zram-init           |-D NUM     If modprobe needs to be used, require NUM devices. This is not
zram-init           |           recommended. Rely instead on /etc/modprobe.d/zram.conf with the line
zram-init           |           "options zram num_devices=NUM"
zram-init           |-s NUM     Use up to NUM parallel compression streams for the device
zram-init           |-S MAX     Use maximally MAX megabytes of uncompressed memory for the device
zram-init           |-b DEV     Use DEV as backing device
zram-init           |-I         If combined with "-b DEV", store incompressible pages to
zram-init           |           backing device
zram-init           |-w         If combined with "-b DEV", enable idle writeback to backing device
zram-init           |-W LIMIT   As "-w" but additionally set writeback_limit to LIMIT * 4kB.
zram-init           |-a ALGO    Set compression algorithm to ALGO (e.g. zstd, lz4, or lzo)
zram-init           |-A PARAM   Set algorithm parameters to PARAM (e.g. "algo=zstd level=22")
zram-init           |-c OWNER   If specified, chown to OWNER (resp. OWNER:GROUP) after mounting.
zram-init           |           If not specified, the default owner (root:root) is not changed.
zram-init           |-m MODE    If specified, chmod DIR to MODE after mounting.
zram-init           |-o OPTS    If specified, mount DIR with "-o OPTS".
zram-init           |-p PRIO    Use priority PRIO for the swap device.
zram-init           |           If not specified, PRIO=16383 is assumed.
zram-init           |           Use PRIO=- if you want to keep the default priority (-1).
zram-init           |-t TYPE    Use a filesystem of type TYPE if DIR is specified.
zram-init           |           TYPE can be either ext2, ext4, btrfs or xfs
zram-init           |           If not specified, TYPE=ext4 is assumed.
zram-init           |-B BSIZE   Override default blocksize (ext2, ext4) (BSIZE=1024|2048|4096)
zram-init           |-i IRATIO  If specified override default bytes/inodes in fs (ext2, ext4)
zram-init           |-N INODES  If specified override inode count (ext2, ext4)
zram-init           |-L LABEL   Specify the label LABEL for the new filesystem
zram-init           |-U UUID    Specify the uuid UUID for the new filesystem
zram-init           |-T         If specified, do not use the discard (TRIM) feature of ext4/swap.
zram-init           |           Use this option with linux-3.14 or earlier or when you want a slight
zram-init           |           speed increase at the cost of possibly wasting a lot of memory
zram-init           |-l         Do not use zramctl even if available
zram-init           |-k         Do no attempt to umount/free a previously used zRAM under this
zram-init           |           device
zram-init           |
zram-init           |If you have push.sh in $PATH, you can also use accumulatively:
zram-init           |-K ARG     Pass ARG to the respective mkswap or mkfs.* call
zram-init           |-M ARG     Pass ARG to the respective swapon/mount call
zram-init           |-2 ARG     Pass ARG to the tune2fs call (ignored unless for ext2 or ext4)
zram-init           |-Z ARG     Pass ARG to the zramctl call
zram-init           |
zram-init           |Call with LANG=C to disable translations                                                                                   [ !! ]
Top
grknight
Retired Dev
Retired Dev
Posts: 2556
Joined: Fri Feb 20, 2015 9:36 pm

  • Quote

Post by grknight » Thu Feb 12, 2026 4:21 pm

Error from my original try:

Code: Select all

zram-init           | * Loading zram module...                                                                                                  [ ok ]
zram-init           | * Mount zram0 /var/tmp/portage
zram-init           |unknown option -c  options=/usr/share/xfsprogs/mkfs/lts_6.6.conf
zram-init           |Usage: mkfs.xfs
zram-init           |/* blocksize */            [-b size=num]
zram-init           |/* config file */  [-c options=xxx]
zram-init           |/* metadata */             [-m crc=0|1,finobt=0|1,uuid=xxx,rmapbt=0|1,reflink=0|1,
zram-init           |                       inobtcount=0|1,bigtime=0|1,autofsck=xxx,
zram-init           |                       metadir=0|1]
zram-init           |/* quota */                [-m uquota|uqnoenforce,gquota|gqnoenforce,
zram-init           |                       pquota|pqnoenforce]
zram-init           |/* data subvol */  [-d agcount=n,agsize=n,file,name=xxx,size=num,
zram-init           |                       (sunit=value,swidth=value|su=num,sw=num|noalign),
zram-init           |                       sectsize=num,concurrency=num]
zram-init           |/* force overwrite */      [-f]
zram-init           |/* inode size */   [-i perblock=n|size=num,maxpct=n,attr=0|1|2,
zram-init           |                       projid32bit=0|1,sparse=0|1,nrext64=0|1,
zram-init           |                       exchange=0|1,max_atomic_write=n]
zram-init           |/* no discard */   [-K]
zram-init           |/* log subvol */   [-l agnum=n,internal,size=num,logdev=xxx,version=n
zram-init           |                       sunit=value|su=num,sectsize=num,lazy-count=0|1,
zram-init           |                       concurrency=num]
zram-init           |/* label */                [-L label (maximum 12 characters)]
zram-init           |/* naming */               [-n size=num,version=2|ci,ftype=0|1,parent=0|1]]
zram-init           |/* no-op info only */      [-N]
zram-init           |/* prototype file */       [-p fname]
zram-init           |/* populate from directory */      [-p dirname,atime=0|1]
zram-init           |/* quiet */                [-q]
zram-init           |/* realtime subvol */      [-r extsize=num,size=num,rtdev=xxx,rgcount=n,rgsize=n,
zram-init           |                       concurrency=num,zoned=0|1,start=n,reserved=n]
zram-init           |/* sectorsize */   [-s size=num]
zram-init           |/* version */              [-V]
zram-init           |                   devicename
zram-init           |<devicename> is required unless -d name=xxx is given.
zram-init           |<num> is xxx (bytes), xxxs (sectors), xxxb (fs blocks), xxxk (xxx KiB),
zram-init           |      xxxm (xxx MiB), xxxg (xxx GiB), xxxt (xxx TiB) or xxxp (xxx PiB).
zram-init           |<value> is xxx (512 byte blocks).
zram-init           |zram-init:
zram-init           |mkfs.xfs /dev/zram0 failed                                                                                                 [ !! ]
Top
Hu
Administrator
Administrator
Posts: 24385
Joined: Tue Mar 06, 2007 5:38 am

Re: zram-init mkfs option issue

  • Quote

Post by Hu » Thu Feb 12, 2026 4:26 pm

It looks like whatever is passed to -K is forwarded as a single argument. Since the help text says you can repeat -K, what about using this?

Code: Select all

args0="-K -c -K options=/usr/share/xfsprogs/mkfs/lts_6.6.conf"
Top
pingtoo
Advocate
Advocate
User avatar
Posts: 2180
Joined: Fri Sep 10, 2021 8:37 pm
Location: Richmond Hill, Canada

  • Quote

Post by pingtoo » Thu Feb 12, 2026 4:39 pm

grknight wrote:
pingtoo wrote:What happen if you take out the single quote (') in from of "-c" and after "...conf"?

Code: Select all

zram-init           | * Loading zram module...                                                                                                  [ ok ]
...
zram-init           |
zram-init           |If you have push.sh in $PATH, you can also use accumulatively:
zram-init           |-K ARG     Pass ARG to the respective mkswap or mkfs.* call
zram-init           |-M ARG     Pass ARG to the respective swapon/mount call
zram-init           |-2 ARG     Pass ARG to the tune2fs call (ignored unless for ext2 or ext4)
zram-init           |-Z ARG     Pass ARG to the zramctl call
zram-init           |
zram-init           |Call with LANG=C to disable translations                                                                                   [ !! ]
Notice it say you need "push.sh" in your PATH, do you have that?

I found it on Github:vaeth/push
Top
grknight
Retired Dev
Retired Dev
Posts: 2556
Joined: Fri Feb 20, 2015 9:36 pm

  • Quote

Post by grknight » Thu Feb 12, 2026 4:46 pm

pingtoo wrote:Notice it say you need "push.sh" in your PATH, do you have that?

I found it on Github:vaeth/push
Yes, it is installed and in the PATH (added with env.d file)
Top
pingtoo
Advocate
Advocate
User avatar
Posts: 2180
Joined: Fri Sep 10, 2021 8:37 pm
Location: Richmond Hill, Canada

  • Quote

Post by pingtoo » Thu Feb 12, 2026 4:59 pm

grknight wrote:
pingtoo wrote:Notice it say you need "push.sh" in your PATH, do you have that?

I found it on Github:vaeth/push
Yes, it is installed and in the PATH (added with env.d file)
Sorry, Not very good at shell substitution, can only suggest try out.

So what if in steads double quote the args0, change it to single quite? like this

Code: Select all

args0='-K -c options=/usr/share/xfsprogs/mkfs/lts_6.6.conf'
From what I saw on github:/vaeth/zram-init/sbin/zram-init.in when entire options K take this form

Code: Select all

	K)	Push mkfs_opt "$OPTARG";;
So I am guess the "getopts" option parser will take everything from the $OPTARG"
Top
grknight
Retired Dev
Retired Dev
Posts: 2556
Joined: Fri Feb 20, 2015 9:36 pm

  • Quote

Post by grknight » Thu Feb 12, 2026 5:04 pm

pingtoo wrote:So what if in steads double quote the args0, change it to single quite? like this

Code: Select all

args0='-K -c options=/usr/share/xfsprogs/mkfs/lts_6.6.conf'
Same error as your first suggestion.
Top
pingtoo
Advocate
Advocate
User avatar
Posts: 2180
Joined: Fri Sep 10, 2021 8:37 pm
Location: Richmond Hill, Canada

  • Quote

Post by pingtoo » Thu Feb 12, 2026 7:19 pm

Here is my test script

Code: Select all

getopts K: opt
case $opt in
 K) echo OPTARG="$OPTARG"
esac

source /home/me/Downloads/push.sh

Push mkfs_opt "$OPTARG"

eval "set -- a $mkfs_opt"
 shift
echo \>Using ${1+"$@"}\<

echo \$1=$1
echo \$2=$2
echo \$3=$3

mkfs.xfs ${1+"$@"} -- /dev/zram0
This seems to work

Code: Select all

bash -x ./gg "-K-coptions=/usr/share/xfsprogs/mkfs/lts_6.6.conf"

Code: Select all

+ getopts K: opt
+ case $opt in
+ echo OPTARG=-coptions=/usr/share/xfsprogs/mkfs/lts_6.6.conf
OPTARG=-coptions=/usr/share/xfsprogs/mkfs/lts_6.6.conf
+ source /home/me/Downloads/push.sh
+ Push mkfs_opt -coptions=/usr/share/xfsprogs/mkfs/lts_6.6.conf
+ case $1 in
+ eval 'PushA_=$mkfs_opt'
++ PushA_=
+ PushB_=mkfs_opt
+ shift
+ for PushE_ in "$@"
+ '[' -z '' ']'
+ unset PushF_
+ case ${PushE_:-=} in
+ PushC_=-coptions=/usr/share/xfsprogs/mkfs/lts_6.6.conf
+ PushD_=-coptions=/usr/share/xfsprogs/mkfs/lts_6.6.conf
+ :
+ case $PushD_ in
+ PushA_=-coptions=/usr/share/xfsprogs/mkfs/lts_6.6.conf
+ '[' x-coptions=/usr/share/xfsprogs/mkfs/lts_6.6.conf = x-coptions=/usr/share/xfsprogs/mkfs/lts_6.6.conf ']'
+ break
+ eval 'mkfs_opt=$PushA_
	unset PushA_ PushB_ PushC_ PushD_ PushE_
	[ -n "${mkfs_opt:++}" ]'
++ mkfs_opt=-coptions=/usr/share/xfsprogs/mkfs/lts_6.6.conf
++ unset PushA_ PushB_ PushC_ PushD_ PushE_
++ '[' -n + ']'
+ eval 'set -- a -coptions=/usr/share/xfsprogs/mkfs/lts_6.6.conf'
++ set -- a -coptions=/usr/share/xfsprogs/mkfs/lts_6.6.conf
+ shift
+ echo '>Using' '-coptions=/usr/share/xfsprogs/mkfs/lts_6.6.conf<'
>Using -coptions=/usr/share/xfsprogs/mkfs/lts_6.6.conf<
+ echo '$1=-coptions=/usr/share/xfsprogs/mkfs/lts_6.6.conf'
$1=-coptions=/usr/share/xfsprogs/mkfs/lts_6.6.conf
+ echo '$2='
$2=
+ echo '$3='
$3=
+ mkfs.xfs -coptions=/usr/share/xfsprogs/mkfs/lts_6.6.conf -- /dev/zram0
Parameters parsed from config file /usr/share/xfsprogs/mkfs/lts_6.6.conf successfully
specified blocksize 4096 is less than device physical sector size 16384
switching to logical sector size 4096
can't get size of data subvolume
Usage: mkfs.xfs
/* blocksize */		[-b size=num]
/* config file */	[-c options=xxx]
/* metadata */		[-m crc=0|1,finobt=0|1,uuid=xxx,rmapbt=0|1,reflink=0|1,
			    inobtcount=0|1,bigtime=0|1]
/* data subvol */	[-d agcount=n,agsize=n,file,name=xxx,size=num,
			    (sunit=value,swidth=value|su=num,sw=num|noalign),
			    sectsize=num
/* force overwrite */	[-f]
/* inode size */	[-i perblock=n|size=num,maxpct=n,attr=0|1|2,
			    projid32bit=0|1,sparse=0|1,nrext64=0|1]
/* no discard */	[-K]
/* log subvol */	[-l agnum=n,internal,size=num,logdev=xxx,version=n
			    sunit=value|su=num,sectsize=num,lazy-count=0|1]
/* label */		[-L label (maximum 12 characters)]
/* naming */		[-n size=num,version=2|ci,ftype=0|1]
/* no-op info only */	[-N]
/* prototype file */	[-p fname]
/* quiet */		[-q]
/* realtime subvol */	[-r extsize=num,size=num,rtdev=xxx]
/* sectorsize */	[-s size=num]
/* version */		[-V]
			devicename
<devicename> is required unless -d name=xxx is given.
<num> is xxx (bytes), xxxs (sectors), xxxb (fs blocks), xxxk (xxx KiB),
      xxxm (xxx MiB), xxxg (xxx GiB), xxxt (xxx TiB) or xxxp (xxx PiB).
<value> is xxx (512 byte blocks).
Don't ask why, I just keep trying with different string combination. this one come back OK. so someone know shell better can explain.
Top
Hu
Administrator
Administrator
Posts: 24385
Joined: Tue Mar 06, 2007 5:38 am

  • Quote

Post by Hu » Thu Feb 12, 2026 7:33 pm

You found a syntax where mkfs.xfs allowed everything to be in one parameter, so -K keeping everything together worked. I'm still curious whether my suggestion would work.
Top
grknight
Retired Dev
Retired Dev
Posts: 2556
Joined: Fri Feb 20, 2015 9:36 pm

  • Quote

Post by grknight » Thu Feb 12, 2026 7:35 pm

Thanks.. This works:

Code: Select all

args0='-K-coptions=/usr/share/xfsprogs/mkfs/lts_6.6.conf'
Guess spacing is optional.
Top
grknight
Retired Dev
Retired Dev
Posts: 2556
Joined: Fri Feb 20, 2015 9:36 pm

  • Quote

Post by grknight » Thu Feb 12, 2026 7:39 pm

Hu wrote:You found a syntax where mkfs.xfs allowed everything to be in one parameter, so -K keeping everything together worked. I'm still curious whether my suggestion would work.
This seems like it works as well. I guess the -K option isn't apparent and limited.

So both can work.

Code: Select all

args0='-K -c -K options=/usr/share/xfsprogs/mkfs/lts_6.6.conf'
Top
Hu
Administrator
Administrator
Posts: 24385
Joined: Tue Mar 06, 2007 5:38 am

  • Quote

Post by Hu » Thu Feb 12, 2026 8:00 pm

My approach has the benefit that it passes -c and options=... as separate parameters, so if the called tool required that -c be its own option, then my approach would work, whereas -K-coptions=... would not. If the tool accepts both, then use whichever seems most convenient.
Top
pingtoo
Advocate
Advocate
User avatar
Posts: 2180
Joined: Fri Sep 10, 2021 8:37 pm
Location: Richmond Hill, Canada

  • Quote

Post by pingtoo » Thu Feb 12, 2026 8:37 pm

Hu wrote:My approach has the benefit that it passes -c and options=... as separate parameters, so if the called tool required that -c be its own option, then my approach would work, whereas -K-coptions=... would not. If the tool accepts both, then use whichever seems most convenient.
My mental state apperently pretty weak today 8O Could not even understand why it work, so I test it myself. (Need to modify my initial /tmp/gg to do a loop on command line arguments)

Code: Select all

source /home/me/Downloads/push.sh

while getopts K: opt; do
case $opt in
 K) Push mkfs_opt "$OPTARG"
esac
done

eval "set -- a $mkfs_opt"
 shift
echo \>Using ${1+"$@"}\<

echo \$1=$1
echo \$2=$2
echo \$3=$3

mkfs.xfs ${1+"$@"} -- /dev/zram0
Test command

Code: Select all

bash -x ./gg -K -c -K options=/usr/share/xfsprogs/mkfs/lts_6.6.conf

Code: Select all

+ source /home/me/Downloads/push.sh
+ getopts K: opt
+ case $opt in
+ Push mkfs_opt -c
+ case $1 in
+ eval 'PushA_=$mkfs_opt'
++ PushA_=
+ PushB_=mkfs_opt
+ shift
+ for PushE_ in "$@"
+ '[' -z '' ']'
+ unset PushF_
+ case ${PushE_:-=} in
+ PushC_=-c
+ PushD_=-c
+ :
+ case $PushD_ in
+ PushA_=-c
+ '[' x-c = x-c ']'
+ break
+ eval 'mkfs_opt=$PushA_
	unset PushA_ PushB_ PushC_ PushD_ PushE_
	[ -n "${mkfs_opt:++}" ]'
++ mkfs_opt=-c
++ unset PushA_ PushB_ PushC_ PushD_ PushE_
++ '[' -n + ']'
+ getopts K: opt
+ case $opt in
+ Push mkfs_opt options=/usr/share/xfsprogs/mkfs/lts_6.6.conf
+ case $1 in
+ eval 'PushA_=$mkfs_opt'
++ PushA_=-c
+ PushB_=mkfs_opt
+ shift
+ for PushE_ in "$@"
+ '[' -z + ']'
+ PushA_='-c '
+ unset PushF_
+ case ${PushE_:-=} in
+ PushC_=options=/usr/share/xfsprogs/mkfs/lts_6.6.conf
+ PushD_=options=/usr/share/xfsprogs/mkfs/lts_6.6.conf
+ :
+ case $PushD_ in
+ PushA_='-c options=/usr/share/xfsprogs/mkfs/lts_6.6.conf'
+ '[' xoptions=/usr/share/xfsprogs/mkfs/lts_6.6.conf = xoptions=/usr/share/xfsprogs/mkfs/lts_6.6.conf ']'
+ break
+ eval 'mkfs_opt=$PushA_
	unset PushA_ PushB_ PushC_ PushD_ PushE_
	[ -n "${mkfs_opt:++}" ]'
++ mkfs_opt='-c options=/usr/share/xfsprogs/mkfs/lts_6.6.conf'
++ unset PushA_ PushB_ PushC_ PushD_ PushE_
++ '[' -n + ']'
+ getopts K: opt
+ eval 'set -- a -c options=/usr/share/xfsprogs/mkfs/lts_6.6.conf'
++ set -- a -c options=/usr/share/xfsprogs/mkfs/lts_6.6.conf
+ shift
+ echo '>Using' -c 'options=/usr/share/xfsprogs/mkfs/lts_6.6.conf<'
>Using -c options=/usr/share/xfsprogs/mkfs/lts_6.6.conf<
+ echo '$1=-c'
$1=-c
+ echo '$2=options=/usr/share/xfsprogs/mkfs/lts_6.6.conf'
$2=options=/usr/share/xfsprogs/mkfs/lts_6.6.conf
+ echo '$3='
$3=
+ mkfs.xfs -c options=/usr/share/xfsprogs/mkfs/lts_6.6.conf -- /dev/zram0
Parameters parsed from config file /usr/share/xfsprogs/mkfs/lts_6.6.conf successfully
specified blocksize 4096 is less than device physical sector size 16384
switching to logical sector size 4096
can't get size of data subvolume
Usage: mkfs.xfs
/* blocksize */		[-b size=num]
/* config file */	[-c options=xxx]
/* metadata */		[-m crc=0|1,finobt=0|1,uuid=xxx,rmapbt=0|1,reflink=0|1,
			    inobtcount=0|1,bigtime=0|1]
/* data subvol */	[-d agcount=n,agsize=n,file,name=xxx,size=num,
			    (sunit=value,swidth=value|su=num,sw=num|noalign),
			    sectsize=num
/* force overwrite */	[-f]
/* inode size */	[-i perblock=n|size=num,maxpct=n,attr=0|1|2,
			    projid32bit=0|1,sparse=0|1,nrext64=0|1]
/* no discard */	[-K]
/* log subvol */	[-l agnum=n,internal,size=num,logdev=xxx,version=n
			    sunit=value|su=num,sectsize=num,lazy-count=0|1]
/* label */		[-L label (maximum 12 characters)]
/* naming */		[-n size=num,version=2|ci,ftype=0|1]
/* no-op info only */	[-N]
/* prototype file */	[-p fname]
/* quiet */		[-q]
/* realtime subvol */	[-r extsize=num,size=num,rtdev=xxx]
/* sectorsize */	[-s size=num]
/* version */		[-V]
			devicename
<devicename> is required unless -d name=xxx is given.
<num> is xxx (bytes), xxxs (sectors), xxxb (fs blocks), xxxk (xxx KiB),
      xxxm (xxx MiB), xxxg (xxx GiB), xxxt (xxx TiB) or xxxp (xxx PiB).
<value> is xxx (512 byte blocks).
So the "Push" function from "push.sh" append value to variable "mkfs_opt" and the getopts-loop took out the "-K". that is how at end of getopts-loop the $mkfs_opt become "-c options=/usr/share/xfsprogs/mkfs/lts_6.6.conf"

However this format would not work

Code: Select all

bash -x ./gg '-K -c -K options=/usr/share/xfsprogs/mkfs/lts_6.6.conf'
Because the getopts-loop parse '-K' into

Code: Select all

' -c -K options=/usr/share/xfsprogs/mkfs/lts_6.6.conf'
which in turn let mkfs.xfs see one string option

Code: Select all

mkfs.xfs ' -c -K options=/usr/share/xfsprogs/mkfs/lts_6.6.conf' -- /dev/zram0
This lead mkfs.xfs thinking too many arguments passed.
Top
Post Reply

15 posts • Page 1 of 1

Return to “Other Things Gentoo”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic