SlackwareThis Forum is for the discussion of Slackware 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.
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.
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.
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.
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.
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'
Distribution: Slackware64 15.0 (started with 13.37). Testing -current in a spare partition.
Posts: 928
Rep:
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!
Distribution: Slackware64 15.0 (started with 13.37). Testing -current in a spare partition.
Posts: 928
Rep:
Quote:
Originally Posted by business_kid
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
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.