Can't access sda1 partition (Linux Mint 20.1)

IrieSmile

New Member
Credits
28
Hi all, and thank you in advance for your help !

So, here's what happened : I recently installed Linux Mint on my computer (total newbie here, I'm afraid...) and so far, everything was running smoothly. But earlier today, my computer froze, so I rebooted it using the power button. When I turned it back on, one of the partitions (sda1) was no longer accessible. The df -h command does not list it, as though it had never existed, which would seem to indicate a hardware issue.

However, when I run lsblk, the sda1 partition in question gets listed, probably meaning that the hard drive works correctly, though I cannot access it using the GUI's file browser or the df -h command line.

So, my questions are : how do I check if the data that was on this partition still exist ? And, if it's still there, how do I retrieve access to it ?

Many thanks for taking the time to read this
 


dos2unix

Well-Known Member
Credits
3,599
mount /dev/sda1 /mnt

You may have to add the -t (type) option, for example if it is a ext4 filesystem.

mount -t ext4 /dev/sda1 /mnt

cd /mnt

ls
 

IrieSmile

New Member
Credits
28
Worked like a charm, it now shows up again in the df -h list and my data is on there, thanks a lot !

A couple follow-up questions if you have a spare minute :
- prior to the bug I described earlier, this directory appeared as a separate drive (it is now in a folder named "mnt" next to the system files. Any way I can revert back to that ?
- if I understand correctly, what the command line you just gave me did is it mounted the sda1 partition back on. Does it mean it got "unmounted" somehow ? Any ideas on what exactly did happen ?

(these are just so I can understand a little better this new OS I'm trying my hand at, but as far as the practical issue I was facing, you solved it instantly, so : many thanks !)
 

dos2unix

Well-Known Member
Credits
3,599
In linux hard drives "usually" show up as sda or sdb or something similar.
"Usually" the disk you boot from is sda (there are always exceptions, I use nvme drives
which show up differently) The partitions on that disk
will show up sda1, sda2, sda3, and so on. If you had a second disk, they would show up as sdb1 sdb2, and so on.

The fact that this is sda1 makes me suspect it isn't a different disk, just another partition on your boot disk.

You have about a million options here.
This is the way I would do it, but you can do it anyway you like.

cd /
mkdir /partition1
(you could name this anything)
mount /dev/sda1 /partition1

Now this will umount everytime you reboot your computer. So how do we make it permanent?

You need to edit your /etc/fstab file. You'll need root privileges or sudo to do this.

Add this line at the bottom of your fstab file.

/dev/sda1 /partition1 ext4 defaults 0 0

You'll need to change "partition1" to whatever you named the directory above.
You'll also need to change "ext4" to xfs, or jfs, or whatever filesystem type is on the disk.

This is the "quick and dirty" way. The recommended way is...

blkid /dev/sda1

This will give a long string of information, look for the part that looks like this.

UUID="e230ba2a-6512-47da-835e-6f32662c7fe7

(Obviously the ID string will be different)
But look for the UUID. Now copy and paste this into your /etc/fstab file.

This is almost the same as the fstab file above with a slight difference.

UUID=e230ba2a-6512-47da-835e-6f32662c7fe7 /partition1 ext4 defaults 0 0

Just replace /dev/sda1 with the UUID string.
I have noticed some flavors of Linux don't like the quotes around the ID string.
You may have to remove them.
 
$100 Digital Ocean Credit
Get a free VM to test out Linux!

Members online


Top