How to recover root password with ZFS

Today with Gianluca i recovered a root password of a system with ZFS as volume manager.

The procedure is simple and composited by follow steps:

– boot from CDROM or in failsafe mode

– show the available pools to import

zpool import

– identify and import the root pool ( in this case rpool )

zpool import -f -R /tmp/rpool rpool

– configure root dataset as legacy

zfs set mountpoint=legacy rpool/ROOT/solaris

– manually mount it

mount -F zfs rpool/ROOT/solaris /mnt

– change/reset the root password

cd /mnt/etc
vi shadow

for empty password also check the directive PermitEmptyPasswords in /etc/ssh/sshd_config

Remember to reset mountpoint property for root dataset !

Retrieve ZFS zpool history commands

For this purpose i can use “zpool history” command as follow:


oot@global02 # zpool history rootdg_sc111
History for ‘rootdg_sc111’:
2008-09-23.12:00:56 zpool create rootdg_sc111 c16t60060E8005637A000000637A0000011Ed0
2008-09-23.12:01:01 zfs create rootdg_sc111/fs_sc111
2008-09-23.12:01:02 zfs set mountpoint=/mnt_sc111 rootdg_sc111/fs_sc111
2009-02-25.18:18:14 zpool export rootdg_sc111
2009-02-25.18:18:48 zpool import rootdg_sc111
2009-04-09.14:46:31 zfs snapshot rootdg_sc111/fs_sc111@now

This is powerful!
I can see how this pool and filesystem were created!