Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux? |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
07-17-2023, 04:37 AM
|
#1
|
LQ Newbie
Registered: Jul 2023
Posts: 5
Rep:
|
Advice? External USB harddrive accidentally unplugged (no activity at time). Re-plugged, but mountpoint/findmnt/lsblk disagree if mounted?
[ sorry, brand-new user, not sure how to format/tag]
So I just accidentally bumped and and unplugged the cable on an external USB harddrive.
- There was no activity at the time.
- It's btrfs
---
I just plugged it back in, and...
- `mountpoint [[path]]` #=> "`[[path]] is a mountpoint`"
- `lsblk` doesn't show it as having a mountpoint
- `findmnt` #=>
Code:
```
TARGET SOURCE FSTYPE OPTIONS
/ /dev/sda3[/@/.snapshots/1/snapshot] btrfs rw,relatime,ssd,discard=async,space_cache=v2,subvolid=266,subvol=/@/.snapshots/1/snapshot
[...]
[...]
[...]
└─[[path]] /dev/sdb1 btrfs ro,nosuid,nodev,relatime,space_cache,subvolid=5,subvol=/
```
- but
` sudo ls [[path]]`
#=>
`ls: reading directory '[[path]]': Input/output error`
---
What should I do/check?
Like, I am *aware* of `fsck`,
but I don't know anything specific about how/why to use it...?
Basically, what are my unknown-unknowns here?
|
|
|
07-17-2023, 06:17 AM
|
#2
|
LQ Guru
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Distribution: One main distro, & some smaller ones casually.
Posts: 5,773
Rep: 
|
After plugging it in, run
To find what the system has designated it, /dev/sd?
Then hopefully you can just remount it.
(Otherwise, a reboot should remount it.)
|
|
|
07-18-2023, 11:19 PM
|
#3
|
LQ Newbie
Registered: Jul 2023
Posts: 5
Original Poster
Rep:
|
Thank you,
but by the time I got your reply I had already just done `umount [mountpoint]`
and that solved it and everything seems fine.
(Didn't even need to reboot.)
(
Although I think I was a bit less clear than I should've been that I meant to ask like:
I *assume* I can just umount it,
or at the worst reboot,
but I figured I should first check in case someone went like:
Quote:
no! don't reboot yet!
first you should [do X] because [arcane cache/journaling details]!
|
)
|
|
|
07-19-2023, 04:09 AM
|
#4
|
Member
Registered: Jan 2010
Location: Minnesota, USA
Distribution: Slackware 13.37, 14.2, 15.0
Posts: 687
Rep: 
|
When the USB got pulled, the USB system got notified of the loss and udev would have torn down the
the associated system hooks, like a mount.
So it became unmounted.
** It was not cleanly unmounted.
Pending operations may have been sitting in disk cache, and not written out to the drive.
There is a timer on these pending operations, which is set to a few seconds, but they could
be left pending for an unknown amount of time.
If the machine was idle for even a minute since the last use of that drive, it is
likely that all pending operations were actually committed to the drive, at the time
it got unplugged. However, the system does not know this and the drive is still marked as
not being cleanly unmounted.
There is also no guarantee of this, depending on who wrote the btrfs filesystem driver.
Usually the system knows this the next time it is mounted, and will complain at you.
It wants to check the drive filessystem for errors. Especially as some of the pending writes
to the drive can have possibly been directory writes.
I do not have btrfs installed so I was unable to check if it installs all the programs.
Look under /sbin for fsck programs.
>> ls /sbin/fsck*
See if there is one for btrfs (such as fsck.btrfs).
If there is then you unmount your btrfs drive, and then run a fsck on it.
Read the man page for the fschk first, as fsck may ask you questions,
or expect you to give it switches.
>> man fsck
Some of the usual switches
-a : automatic repair, no questions (fsck.msdos)
-p : automatic repair, no questions (fsck.ext2)
-y : answer yes to all questions
-n : make no changes to the filesystem (just checking)
-f : force checking even if the filesystem if marked clean
-v : verbose
If the filesystem has been re-mounted, and marked clean by the system, then fsck will try to skip the checking (which is lengthy).
That is because this fsck may be invoked for all devices on a system, or by other indirections.
There may still be undiscovered inconsistencies.
Use the -f to force it to do the checking, when you know it needs to be checked (like what happened here).
Of course, only root usually has access to files in /sbin, so it is not in the usual user PATH.
But /sbin/fsck might work for drives that are usually mounted by a user, which depends on device permissions, (so just try it).
# For whatever dev your btrfs drive shows up at.
>> /sbin/fsck.btrfs -f -v /dev/sdc4
Otherwise you can check for other btrfs support.
>> man btrfs
>> ls /sbin/*btr*
Last edited by selfprogrammed; 07-19-2023 at 04:17 AM.
|
|
1 members found this post helpful.
|
All times are GMT -5. The time now is 02:04 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|