On 2016/05/06 at 18:56, Pratyush Anand wrote:
On 06/05/2016:05:49:09 PM, Xunlei Pang wrote:
> What about the one in my following reply, calls get_persistent_dev() to do a
conversion on $_target?
That is fine to get new target and file system. But, I was talking about parsing
dracut argument and finding old FS and target. I have just a beginner level
knowledge of shell scripting, however it seems to me that all the complexity of
current patch will shift there, and that would still be complex.
I am not sure if target type and file system type is always at same offset in
dracut arguments. If they aren't then parsing might not be trivial.
kdump adds mount information via add_mount() ----> to_mount()
|
|--->
add_dracut_mount() ---> add_dracut_arg "--mount" "$1"
So, the keyword "--mount" is what we want where follows the filesystem
information.
For example on my laptop:
#lsinitrd initramfs-4.6.0-rc2+kdump.img |grep Arguments
Arguments: --hostonly --hostonly-cmdline --hostonly-i18n -o 'plymouth dash resume
ifcfg' --add 'nfs' --mount '10.66.129.115:/export/nfs
/kdumproot//home/xlpang/nfsmount nfs
rw,relatime,vers=3,rsize=1048576,wsize=1048576,namlen=255,hard,nolock,proto=tcp,timeo=555,retrans=2,sec=sys,mountaddr=10.66.129.115,mountvers=3,mountport=36465,mountproto=udp,local_lock=all,addr=10.66.129.115'
-f
From "man dracut":
--mount "<device> <mountpoint> <filesystem type>
[<filesystem options> [<dump frequency> [<fsck order>]]]"
Mount <device> on <mountpoint> with <filesystem type> in the
initramfs. <filesystem options>, <dump
options> and <fsck order> can be specified, see fstab manpage for the
details. The default <filesystem
options> is "defaults". The default <dump frequency> is
"0". the default <fsck order> is "2".
So, we can get that, "10.66.129.115:/export/nfs" is <device>,
"/kdumproot//home/xlpang/nfsmount" is the kdump-converted <mountpoint>,
"nfs" is <filesystem type>, the remaining is <filesystem options>.
I guess we can safely utilize this.
Regards,
Xunlei
~Pratyush