~drscream

Debug SmartOS usr files without rebuild usr.lgz

Maybe you’re lazy like I’m? And you wouldn’t like to rebuild SmartOS to debug some changes in /usr? First you will be warned, this is again a workaround and durty hack only for debugging!

You could easy mount /usr from the usr.lgz at the same location without any write protection.

Copy the /usr.lgz file to /opt:

cp /usr.lgz /opt/
cd /opt

Uncompress the data from the file (be sure you’re at /opt):

lofiadm -U usr.lgz

Now we would like to add the file as a block device, again with the logiadm command. The command returns the block device path and name:

BLOCK=$(lofiadm -a usr.lgz)

We mount it again to /usr so all new changes could be made to the block device which is the uncompressed /opt/usr.lgz:

mount -O -F ufs -o nologging ${BLOCK} /usr

These change will be not available after reboot (and shouldn’t be). I also recommend to do an reboot after you’ve debugged all your changes on /usr.


Send your comment by mail.