1

How to find details like whether the mounted file-system is read only or read-write?

In addition to it how to find details of the hard disk or partition health status without affecting the data of that mounted disk or partition?

3

Command mount will list all mounted partitions and will indicate whether they are mounted read only (ro) or read-write (rw).

There is no way to tell whether a filesystem is "healty" while mounted in a normal read-write mode. To determine whether a filesystem is healthy you need to use fsck (or a similar tool) and these require either unmounted filesystems or filesystems mounter read-only.

I guess you could look in the kernel log using command dmesg and look for messages like "journal replayed" - they will indicate that the filesystem has been mounted dirty.

1

The file /proc/mounts contains the neccessary information.

For instance, there I have an entry for my jump drive

/dev/sdb1 /media/xieerqi/Lexar vfat rw,nosuid,nodev,relatime,uid=1000,gid=1000,fmask=0022,dmask=0077,codepage=437,iocharset=iso8859-1,shortname=mixed,showexec,utf8,flush,errors=remount-ro 0 0

Coma separated list of options and specificallyrw indicates that this is read-write mounted filesystem. For read-only it would say ro

  • Thanks it was really helpful and answers first part of my question. can you please also let me know a command or something similar which will help me check if the hard disk partition or for that instance hard disk itself is healthy or not without un-mounting and endangering the data on it. – Hrish Aug 20 '15 at 6:09
  • I don't know of disk-testing tools that much. I do know of fsck , however it's recommended not to use it on a mounted partition. Thus , I suggest you boot from a live cd or usb for Ubuntu, and run it through there, without mounting the actual hard drive. Perhaps another user might answer your question in more detail than I am, @Fabby – Sergiy Kolodyazhnyy Aug 20 '15 at 6:18
  • Thanks! No problem at least you tried, so I appreciate it. I hope @Fabby can solve it :) – Hrish Aug 20 '15 at 6:25
1

you'll need a combination of tools, which I believe are bundled in the package smartmontools. This links holds a fairly nice plan.

Your first step should be to evaluate the SMART report of each drive using smartctl. smartctl -a /dev/sdX assuming a standard SATA controller, with X being the actual drive identifier

Your second step should be an extended drive self-test, smartctl is the way to go here as well: smartctl --test=long /dev/sdX and after the test time has passed (between 60 and 240 minutes for most drives), read the results with the command in step 1.

Your third step should be a drive conveyance test, if supported by your drive. You get an error from the following command if it is not supported: smartctl --test=conveyance /dev/sdX. Results: see step 1.

Up to this point, simply writing the whole drive would have been a bad idea, since bad sector remappings are done during write operations. In other words, the evidence of the drive failure might have been covered up.

Assuming that all steps above fail to find a problem, you should now use "badblocks" to scan your drives for write errors:

badblocks -nvs /dev/sdX

The above is a nondestructive test, use -wvs is the destructive alternative, may be a bit faster.

The ones I pay attention to on my laptop (with SSD drive, different disks have different S.M.A.R.T. tests)

5 Reallocated_Sector_Ct
183 Runtime_Bad_Block
184 End-to-End_Error 
233 Media_Wearout_Indicator

Especially the first indicator is nice, as it tells you how many bad sectors/blocks have been remapped on the disk.

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.