[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190702173301.GA3032@mit.edu>
Date: Tue, 2 Jul 2019 13:33:01 -0400
From: "Theodore Ts'o" <tytso@....edu>
To: James Bottomley <James.Bottomley@...senPartnership.com>
Cc: linux-ext4@...r.kernel.org, linux-fsdevel@...r.kernel.org,
Parisc List <linux-parisc@...r.kernel.org>
Subject: Re: [BUG] mke2fs produces corrupt filesystem if badblock list
contains a block under 251
On Mon, Jul 01, 2019 at 05:53:34PM -0700, James Bottomley wrote:
>
> Actually, we control the location of the IPL, so as long as mke2fs
> errors out if we get it wrong I can add an offset so it begins at
> sector 258. Palo actually executed mke2fs when you initialize the
> partition so it can add any options it likes. I was also thinking I
> should update palo to support ext4 as well.
If you never going to resize the boot partition, because it's fixed
size, you might as we not waste space on the reserving blocks for
online resize. So having the palo bootloader be very restrictive
about what features it enables probably makes sense.
> Well, we don't have to use badblocks to achieve this, but we would like
> a way to make an inode cover the reserved physical area of the IPL.
> Effectively it's a single contiguous area on disk with specific
> absolute alignment constraints. It doesn't actually matter if it
> appears in the directory tree.
If you don't mind that it is visible in the namespace, you could take
advantage of the existing mk_hugefile feature[1][2]
[1] http://man7.org/linux/man-pages/man5/mke2fs.conf.5.html
[2] https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git/tree/misc/mk_hugefiles.c
# cat >> /etc/mke2fs.conf < EOF
[fs_types]
palo_boot = {
features = ^resize_inode
blocksize = 1024
make_hugefiles = true
num_hugefiles = 1
hugefiles_dir = /palo
hugefiles_name = IPL
hugefiles_size = 214k
hugefiles_align = 256k
hugefiles_align_disk = true
}
EOF
# mke2fs -T palo_boot /dev/sda1
Something like this will create a 1k block file system, containing a
zero-filled /palo/IPL which is 214k long, aligned with respect to the
beginning of the disk at an 256k boundary. (This feature was
sponsored by the letters, 'S', 'M', and 'R'. :-)
If you wanted it to be hidden from the file system you could just drop
the hugefiles_dir line above, and then after mounting the file system
run open the /IPL file and then execute the EXT4_IOC_SWAP_BOOT ioctl
on it. This will move those blocks so they are owned by inode #5, an
inode reserved for the boot loader.
Cheers,
- Ted
Powered by blists - more mailing lists