LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 11-04-2021, 04:44 PM   #1
John Stockton
LQ Newbie
 
Registered: Oct 2021
Posts: 6

Rep: Reputation: Disabled
Slackware_mount_md5sum


hi, could anyone this explain to me...

If mount sdc2 partition: mount -t ext4 -o ro /dev/sdc2 /mnt/bob2 then try to write file tihi 1.txt with command (of course unsuccessfully):
touch /mnt/bob 2/tihi 1.txt

when I do md5sum /dev/sdc2 /

I get a different md5 hash than before, although my partition can only Read-only, I don't why?

best,
John
 
Old 11-04-2021, 04:58 PM   #2
marav
LQ Sage
 
Registered: Sep 2018
Location: Gironde
Distribution: Slackware
Posts: 5,397

Rep: Reputation: 4127Reputation: 4127Reputation: 4127Reputation: 4127Reputation: 4127Reputation: 4127Reputation: 4127Reputation: 4127Reputation: 4127Reputation: 4127Reputation: 4127
Quote:
Originally Posted by John Stockton View Post
hi, could anyone this explain to me...

If mount sdc2 partition: mount -t ext4 -o ro /dev/sdc2 /mnt/bob2 then try to write file tihi 1.txt with command (of course unsuccessfully):
touch /mnt/bob 2/tihi 1.txt

when I do md5sum /dev/sdc2 /

I get a different md5 hash than before, although my partition can only Read-only, I don't why?

best,
John
-o ro means read only
 
Old 11-04-2021, 05:02 PM   #3
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,269
Blog Entries: 24

Rep: Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196
Quote:
Originally Posted by John Stockton View Post
I get a different md5 hash than before, although my partition can only Read-only, I don't why?
Than before what? Before mounting or before attempting to write?
 
Old 11-04-2021, 06:11 PM   #4
StreamThreader
Member
 
Registered: Mar 2012
Location: Ukraine/Odesa
Distribution: Slackware
Posts: 152

Rep: Reputation: 64
Quote:
Originally Posted by John Stockton View Post
hi, could anyone this explain to me...

If mount sdc2 partition: mount -t ext4 -o ro /dev/sdc2 /mnt/bob2 then try to write file tihi 1.txt with command (of course unsuccessfully):
touch /mnt/bob 2/tihi 1.txt

when I do md5sum /dev/sdc2 /

I get a different md5 hash than before, although my partition can only Read-only, I don't why?

best,
John
I think checksum different because, on partition every time write information about last mount
Or fsck write information about checking filesystem

Last edited by StreamThreader; 11-04-2021 at 06:26 PM.
 
1 members found this post helpful.
Old 11-05-2021, 03:39 AM   #5
John Stockton
LQ Newbie
 
Registered: Oct 2021
Posts: 6

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by astrogeek View Post
Than before what? Before mounting or before attempting to write?
hi,

before mounting!
 
Old 11-05-2021, 05:34 AM   #6
ctrlaltca
Member
 
Registered: May 2019
Location: Italy
Distribution: Slackware
Posts: 332

Rep: Reputation: 388Reputation: 388Reputation: 388Reputation: 388
Quote:
Originally Posted by StreamThreader View Post
I think checksum different because, on partition every time write information about last mount
Or fsck write information about checking filesystem
Exactly, even if you mount a filesystem in read-only mode, this only means that files inside the filesystem can't be modified.
The filesystem itself (and so the content of the partition) are modified during a mount, eg. the superblock last mount timestamp gets updated.

You can check it with the following command:
Code:
# tune2fs -l /dev/sdc2 | grep time
Last mount time:          Fri Nov  5 09:07:47 2021
Last write time:          Wed Apr 28 14:47:26 2021
Lifetime writes:          2765 GB
In computer forensics there are hardware "forensics bridges" that blocks write commands to the destination drives.
Some forensics linux live distro (eg. Caine) use the trick of removing write permission on the device itself to avoid writes, and it seems to work:

Code:
blockdev --setro -/dev/sdc*

Last edited by ctrlaltca; 11-05-2021 at 05:37 AM.
 
Old 11-05-2021, 10:32 AM   #7
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,269
Blog Entries: 24

Rep: Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196
Quote:
Originally Posted by John Stockton View Post
hi,

before mounting!
Then clearly the difference is just the change due to the mount, not the attempted write. To demonstrate that simply omit the write operation and you will see the sum changes depending on whether the partition is mounted or not, and the write operation is a red herring.

The reason, as noted by others, is that mount parameters in the partition's table are updated by the mount action itself.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 09:16 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration