I was trying to work on some files on my Ubuntu machine, and when I tried to save them, it told me that the disk was read only. I then rebooted the machine, but upon rebooting into Ubuntu it displayed an initramfs command prompt with all my files gone. How do I restore my desktop environment and my files?

  • Welcome to Ask Ubuntu. This advice is general only, but if your file-system went RO (read-only) it was probably because an error was detected, I would have investigated before you shutdown, but the result is probably the same. I'd boot a 'live' system (eg. install media) and fsck (do a file system check) of your system. The command needed may not be fsck, but may be xfs_check so I'm speaking generally (adjust for your chosen file-system). ps: if it was a file system error, once fixed, you can reboot & login normally.
    – guiverc
    Feb 27, 2019 at 5:20
  • @guiverc fyi: please see my answer :-)
    – heynnema
    Feb 27, 2019 at 15:51

1 Answer 1


Probably a disk error(s) caused your disk to become ro.

First, lets check out the file system...

  • boot to a Ubuntu Live DVD/USB
  • open a terminal window
  • type sudo fdisk -l
  • identify the /dev/XXXX device name for your "Linux Filesystem"
  • type sudo fsck -f /dev/XXXX # replacing XXXX with the number you found earlier
  • repeat the fsck command if there were errors
  • type reboot

Then lets check the SMART Data...

  • open the Disks application
  • select SMART Data & Tests from the hamburger icon
  • review the data, looking for parameters with "sector" in the name
  • take a screenshot and edit it into your question
  • run the SMART Tests
  • Running the first part and using fsck fixed everything for me. Thank you!
    – achandra03
    Feb 27, 2019 at 23:56
  • @xXGETREKTXx glad it's working for you now!
    – heynnema
    Feb 28, 2019 at 4:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.