change hostid for solaris X86 system:
Step 1:take the backup of current hostid
echo `hostid` > /etc/hostid_bkp
Step2: Change the new hostid hex value in decimal.
http://easycalculation.com/hex-converter.php
exp : 1dd01266
5001 7546 2
Step 3: Change decimal string in to ascii/hexa
http://easycalculation.com/hex-converter.php
exp :
35 30 30 31
37 35 34 36
32 00 0
Step 4: Run below command
exp : echo "hw_serial/v 35 30 30 31 37 35 34 36 32 00 0" | mdb –kw
Step 4:
Add above command in /etc/rc2.d/S20sysetup
Step 5: Reboot the server
Step 1:take the backup of current hostid
echo `hostid` > /etc/hostid_bkp
Step2: Change the new hostid hex value in decimal.
http://easycalculation.com/hex-converter.php
exp : 1dd01266
5001 7546 2
Step 3: Change decimal string in to ascii/hexa
http://easycalculation.com/hex-converter.php
exp :
35 30 30 31
37 35 34 36
32 00 0
Step 4: Run below command
exp : echo "hw_serial/v 35 30 30 31 37 35 34 36 32 00 0" | mdb –kw
Step 4:
Add above command in /etc/rc2.d/S20sysetup
Step 5: Reboot the server
I could not get the changes done, I have even used the same commands as mentioned above in the example with the same values to test but the hostid kept appearing the same.
ReplyDeleteecho "hw_serial/v 35 30 30 31 37 35 34 36 32 00 0"
mdb –kw
echo "hw_serial/v 35 30 30 31 37 35 34 36 32 00 0" | mdb –kw
Deleterun this command you have missed | between both command
Here's a script to do the whole thing. Thanks for providing this info.
ReplyDelete#!/usr/bin/bash
if [ $# -ne 1 ]
then
echo "Usage: changehostid NEWHOSTID"
exit 1
fi
ascii=`echo $((0x$1)) | od -t x1 | head -1 | cut -f2-100 -d" "`
echo "hw_serial/v "${ascii:0:$((${#ascii}-2))}"00 0" | mdb -kw
echo "hostid is now set to: "`hostid`;echo " "
"bash-3.2# echo "hw_serial/v 35 30 30 31 37 35 34 36 32 00 0" | mdb –kw
ReplyDeletemdb: failed to open –kw: No such file or directory"
When i run your command, it have a fail message like this.
How could i make it take effect?
I tried again, although this command couldn't run in the console but after add it to /etc/rc2.d/S20sysetup and run ./S20sysetup, it works!
ReplyDeleteThanks!
Welocme anytime
ReplyDeleteNice sir.
ReplyDeletePlacing descibed above hostid modification into rc.d scripts didn't work for me.
ReplyDeletezpool was complaining that hostid is different anyway. I think zpool was starting before the rc.d script.
I placed hosid modification script into /lib/svc/method/svc-hostid
Now everything works fine. zpool doesn't complain.