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 02-18-2019, 11:59 AM   #1
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,260

Rep: Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321
Bug in mke2fs or e2fsck man page?


I tried something here and came unstuck. What has the bug? This is in the e2fsck man page
Quote:
-b superblock
Instead of using the normal superblock, use an alternative superblock specified by superblock. This option is normally used
when the primary superblock has been corrupted. The location of backup superblocks is dependent on the filesystem's block‐
size, the number of blocks per group, and features such as sparse_super.

Additional backup superblocks can be determined by using the mke2fs program using the -n option to print out where the
superblocks exist,
supposing mke2fs is supplied with arguments that are consistent with the filesystem's layout (e.g. block‐
size, blocks per group, sparse_super, etc.).

If an alternative superblock is specified and the filesystem is not opened read-only, e2fsck will make sure that the primary
superblock is updated appropriately upon completion of the filesystem check.
So I ran 'mke2fs -n' on a partition as root to find out where the superblocks were, and overwrote it with a new filesystem, destroying all the data. The data loss is of no consequence at all to me, because it is a data partition, I am well backed up, and I am currently restoring it. But it may upset others!!

Which is wrong? mke2fs -n overwriting a filesystem? The e2fsck man page? I'd better report the bug.
 
Old 02-18-2019, 12:53 PM   #2
crts
Senior Member
 
Registered: Jan 2010
Posts: 2,020

Rep: Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757
Quote:
Originally Posted by business_kid View Post
I tried something here and came unstuck. What has the bug? This is in the e2fsck man page

So I ran 'mke2fs -n' on a partition as root to find out where the superblocks were, and overwrote it with a new filesystem, destroying all the data. The data loss is of no consequence at all to me, because it is a data partition, I am well backed up, and I am currently restoring it. But it may upset others!!

Which is wrong? mke2fs -n overwriting a filesystem? The e2fsck man page? I'd better report the bug.
From the manpage of mke2fs:
Code:
-n     Causes  mke2fs  to not actually create a filesystem, but display
       what it would do if it were to create a filesystem.  This can be
       used  to  determine the location of the backup superblocks for a
       particular filesystem, so long as  the  mke2fs  parameters  that
       were  passed when the filesystem was originally created are used
       again.  (With the -n option added, of course!)
using the -n option should definitely not damage the filesystem, at least that is how I understand it. Which version of mke2fs are you using? I would like to try and reproduce the bug.

Last edited by crts; 02-18-2019 at 12:54 PM.
 
Old 02-18-2019, 02:06 PM   #3
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,260

Original Poster
Rep: Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321
That's where I thought the bug was, but the manpage was a bit woolly, so I wasn't 100% positive.

Code:
bash-4.4$ mke2fs -V
mke2fs 1.44.4 (18-Aug-2018)
	Using EXT2FS Library version 1.44.4
Installed from Slackware64's current iso of December last. My mileage has varied (a lot!) with current, so I have not updated since.

The exact line was
Code:
mke2fs 1.44.4 (18-Aug-2018)
/dev/sda7 contains a ext2 file system


	last mounted on /mnt/virtual on Mon Feb 18 17:43:57 2019
Proceed anyway? (y,N)
If I say 'n' it exits. If I say 'y' it overwrites. I don't think I should be getting that question at all.

EDIT: I can attach the exact package if you need it.

Last edited by business_kid; 02-18-2019 at 02:08 PM.
 
Old 02-18-2019, 04:11 PM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,120

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
FWIW I have regularly used "-n" successfully to find the backup superblocks for fsck. Never had a problem - open a bug.
 
Old 02-18-2019, 04:42 PM   #5
crts
Senior Member
 
Registered: Jan 2010
Posts: 2,020

Rep: Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757
I have tested with 'mke2fs 1.43.1' since I do not use 'current' but just "regular" Slackware64 14.2. I used an image file to test, so not an actual device. There were no damages. After I ran the command I could loop-mount the image and the testfile I had created was still intact. I checked with 'stat' and it had the same modification times, size, inode etc. The content was also intact. I repeated the this procedure several times.

I also get the 'Proceed' question with the '-n' option, the only difference is:
Code:
Proceed anyway? (y,n)
I get a lower-case 'n' for the 'no' option. Not sure if this is of any importance. I would also suggest that you file a bug report. It would be nice if you could provide a link to it afterwards.
 
Old 02-19-2019, 05:35 AM   #6
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,260

Original Poster
Rep: Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321
OK. First, a warning.

First of all, if anyone is using Slackware's e2fsprogs-1.44.4, compiled Aug 19 2018, and perhaps later versions watch out!
Code:
bash-4.4$ md5sum e2fsprogs-1.44.4-x86_64-1.txz
f7835ebe9bbf51517d1392772dae9fbe  e2fsprogs-1.44.4-x86_64-1.txz
2nd there's a download of e2fsprogs-1.44.4-x86_64-1.txz HERE if anyone wants to play with it.

I would imagine the (y,n) or (y,N) thing was a hint not to proceed, as it had just pointed out the thing had just been mounted (ergo, there was a functional filesystem on it). In my case, no was the default. Pressing return would have selected 'N'

Here's the bug report. Please confirm if you replicate
 
Old 02-19-2019, 07:28 AM   #7
Paulo2
Member
 
Registered: Aug 2012
Distribution: Slackware64 15.0 (started with 13.37). Testing -current in a spare partition.
Posts: 928

Rep: Reputation: 515Reputation: 515Reputation: 515Reputation: 515Reputation: 515Reputation: 515
It seems that the 1.44.5 version
Code:
Mon Dec 17 23:02:56 UTC 2018
a/e2fsprogs-1.44.5-x86_64-1.txz:  Upgraded.
doesn't erase the partition, I tested in a VirtualBox vm.

But if you read the messages, it looks like mke2fs really
would erase the partition.
Code:
# mke2fs -n /dev/sda1
mke2fs 1.44.5 (15-Dec-2018)
/dev/sda1 contains a ext4 file system
        last mounted on / on Tue Feb 19 13:12:26 2019
Proceed anyway? (y,N) y
/dev/sda1 is mounted; will not make a filesystem here!
 
Old 02-19-2019, 01:20 PM   #8
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,260

Original Poster
Rep: Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321
Yep, it sure looks as if it would erase that partition, except you had yours mounted. Lucky you.
 
Old 02-19-2019, 07:01 PM   #9
Paulo2
Member
 
Registered: Aug 2012
Distribution: Slackware64 15.0 (started with 13.37). Testing -current in a spare partition.
Posts: 928

Rep: Reputation: 515Reputation: 515Reputation: 515Reputation: 515Reputation: 515Reputation: 515
Quote:
Originally Posted by business_kid View Post
Yep, it sure looks as if it would erase that partition, except you had yours mounted. Lucky you.
Excuse me, I forgot to post the unmounted test.
With unmounted partition it doesn't erase the file system,
despite what the message says.

I think even in a mounted partition it should give a different message.

Output from a test with a Debian partition.
Code:
mke2fs -n /dev/sda3
mke2fs 1.44.5 (15-Dec-2018)
/dev/sda3 contains a ext4 file system labelled 'Debian'
        last mounted on /mnt/Debian on Sat Feb 16 20:02:32 2019
Proceed anyway? (y,N) y
Creating filesystem with 8160768 4k blocks and 2044000 inodes
Filesystem UUID: cf5ad65e-d4ee-40e7-a92b-0004a6445f8d
Superblock backups stored on blocks: 
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
        4096000, 7962624

# mount /dev/sda3 /mnt/Debian/
# ls /mnt/Debian/
bin                           home            lost+found  root  tmp
boot                          initrd.img      media       run   usr
debian-9.4.0-amd64-DVD-1.iso  initrd.img.old  mnt         sbin  var
dev                           lib             opt         srv   vmlinuz
etc                           lib64           proc        sys   vmlinuz.old

Last edited by Paulo2; 02-19-2019 at 07:03 PM.
 
Old 02-21-2019, 10:14 AM   #10
tytso
LQ Newbie
 
Registered: Apr 2007
Location: Medford, MA
Distribution: Debian, Ubuntu
Posts: 9

Rep: Reputation: 4
Not reproducible

Hi, e2fsprogs maintainer here.

I'm not able to reproduce it either.

We should change mke2fs so it doesn't ask for confirmation for mounted file systems and the messages printed by it to be clear that it didn't actually create a file system, so it's less confusing. But I see no problem here.
 
3 members found this post helpful.
Old 02-22-2019, 04:09 AM   #11
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,260

Original Poster
Rep: Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321
So I'm left wondering why, but I accept that it's not a bug.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
man page is not found although $MANPATH and man.conf changed Abbraxas Linux - Newbie 3 09-05-2011 06:40 PM
HELP: mke2fs done instead of e2fsck :-( tkmbe Linux - General 3 05-04-2008 09:48 AM
man alsamixer not showing the man page nosaku Slackware 1 12-20-2004 08:52 AM
Is there a man page on how to use man page? jdruin Linux - Software 2 10-30-2004 09:29 AM
fsck, e2fsck, mke2fs ?'s - RH9 blackx Linux - Newbie 6 05-23-2003 02:02 PM

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

All times are GMT -5. The time now is 07:26 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