1

I made a bad mistake .I mounted a /dev/sda2 as /tmp folder in Ubuntu 20.04 LTS.

I think this filesystem /dev/sda2 is a part of logical partition.

lsblk result before mount:

lsblk result before mount

then Ubuntu won't boot again.

Is /dev/sda2 content has been deleted? if not how can i undo mount command

  • 1
    You have to look if there is anything left on /dev/sda2 by mounting it again (but not again at /tmp !) – TheEagle Jan 10 '21 at 12:19
  • 1
    In the future, instead of mounting inside /tmp mount inside /mnt. Files inside of /tmp usually get blown away on boot. – WinEunuuchs2Unix Jan 10 '21 at 12:23
  • @frederic are you suggest mount /dev/sda2 to another directory? but as I have showing in lsblk result this filesystem was not mounted to any directory. – Mohamed Okasha Jan 10 '21 at 12:51
  • Before you can see what is on /dev/sda2, you have to mount it. Chances are indeed that it has been erased if it has been mounted to /tmp. The /tmp folder is deleted between boots. – vanadium Jan 10 '21 at 12:56

1 Answers1

1

The directory /tmp is periodically deleted. Therefore, there is a chance that the contents of your /dev/sda2 has been deleted.

You can inspect the contents of your /dev/sda2 partition by mounting it, obviously not again under a critical system folder. The easiest way will be to click the icon of the drive in your file manager. From the terminal, you could temporarily mount under /mnt with the command

sudo mount /dev/sda2 /mnt

after which the command

ls /mnt

will show the contents. Again, if you persistently mounted the partition on /tmp and rebooted, the contents of /dev/sda2 may be gone. If this are personal data, it is hoped that you have a backup. Otherwise, your only hope is file recovery, but that is a difficult process where full recovery is not always possible.

vanadium
  • 88,010