You are on page 1of 2

Recover root password or failed mount on a Centos 7 instance

If you need to set the root password or fix a faulty /etc/fstab for example then this
is the procedure to access the boot disk without a root password.
Reboot the instance and press "e" when the grub 2 boot menu is shown.
Add the following parameters at the end of the linux16 line
rd.break enforcing=0
and remove all parameters starting with "console="
Press Ctrl+x to boot
Remount the root filesystem read write
mount -o remount,rw /sysroot

Now you can edit the root disk files under /sysroot.
If you want to set a new password do a change root and set password.
chroot /sysroot
passwd

When you are done reboot the instance


reboot

Required xfs mount options

We have discovered that using xfs file system without the required mount options
will make the mount fail in case of storage platform rebalance, maintenance or
failover.
When mounting a xfs file system you must mount it with the options
"noatime,discard,nobarrier".
Notice that some cloud images (CentOS 7 for example) have xfs as the default root
file system and if you do not use the latest ELASTX provided images you will have
to modify the mount options.
Add the mount options to /etc/fstab and reboot or add the mount options online.
mount -o remount,noatime,discard,nobarrier /mountpoint
How to log in to your new Linux instance
When you have launched your new instance and made it available for ssh you want to login.
The username is different depending on the Linux flavor you are using but you will always use the keypair and
not a password.
This is the ssh command you will use is you login from a Linux client.
# ssh -l UserName -i /path/to/my-keypair.pem 1.2.3.4
Here is a list of the user names for each Linux dist.
Linux flavor User
CentOS 6 cloud-user
CentOS 7 centos
CoreOS core
Fedora fedora
Redhat cloud-user
Ubuntu ubuntu
Debian debian
Heat instancesec2-user
When using Heat to deploy instances the user name will be ec2-user instead.

You might also like