Skip to content

Instantly share code, notes, and snippets.

@SOHELAHMED7
Created September 1, 2024 12:46
Show Gist options
  • Save SOHELAHMED7/68729c0a44c77a4d88cf1a07a67be5b5 to your computer and use it in GitHub Desktop.
Save SOHELAHMED7/68729c0a44c77a4d88cf1a07a67be5b5 to your computer and use it in GitHub Desktop.
Mount a disk partition in Ubuntu with read-write permission

Given that you have a disk partition pointed at /mnt/01DAB4...

sudo mount -o remount,rw /mnt/01DAB4...

will mount the partition with read and write permission.

This helps in fixing below issue

unable to open /var/lib/...: Read-only file system
@SOHELAHMED7
Copy link
Author

SOHELAHMED7 commented Sep 2, 2024

If you have dual boot (Windows + Ubuntu) and if the Windows did not shut down properly or shut down all of a sudden (electricity outage) while some apps are used/files are read/written then you might face above or below error.

Cannot remove /path/to/dir: Directory is not empty

There are multiple solution to this problem. You can choose any one at time.

  1. Shut down Ubuntu + Turn on computer and open Windows. Ensure all apps are closed and shut it down and then turn on computer and choose Ubuntu
  2. Follow https://askubuntu.com/a/935301
  3. Follow https://gist.github.com/SOHELAHMED7/68729c0a44c77a4d88cf1a07a67be5b5?permalink_comment_id=5175500#gistcomment-5175500

@SOHELAHMED7
Copy link
Author

Continuing from https://gist.github.com/SOHELAHMED7/68729c0a44c77a4d88cf1a07a67be5b5?permalink_comment_id=5175496#gistcomment-5175496

  1. Go to Disks desktop app in Ubuntu
    Screenshot from 2024-09-01 20-33-04

  2. Select/click your storage disk

  3. Select the partition you are facing errors with in Volumes section

  4. Click on settings icon (bottom left corner in Volumes section)
    Screenshot from 2024-09-01 20-36-05

  5. Click "Repair Filesystem"

  6. Mount the partition

The problem is solved. Here you don't need to switch back to Windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment