[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Can't detect filesystems in devices with 4096-byte sector size
From: |
Jim Meyering |
Subject: |
Re: Can't detect filesystems in devices with 4096-byte sector size |
Date: |
Tue, 10 Apr 2012 20:28:26 +0200 |
Joan Lledó wrote:
> Hello, I imagine this is not the first email you receive informing of
> this problem, but I haven't found any bug tracker for libparted to
> make sure.
>
> In my debian squeeze with libparted 2.3, the parted command can't
> detect the filesystems in the partitions inside a disk with 4096-byte
> sector size.
>
> You can reproduce the error by generating a ramdisk drive using
> scsi_debug as follows:
>
> #!/bin/bash
>
> modprobe scsi_debug dev_size_mb=100 sector_size=4096
...
> Number Start End Size Type File system Flags
>
> 1 262kB 55,1MB 54,8MB primary
>
> 2 55,1MB 105MB 49,8MB primary
>
> As you can see, the File system column is empty, which does not happen
> if we work with 512-byte sectors.
Thanks for the report.
Back in 2007 I disabled all file-system probe-related code
for any sector size > 512:
commit fff559b4e987d9404a788a817630c394af89db48
Author: Jim Meyering <address@hidden>
Date: Tue Dec 18 16:17:06 2007 +0100
disable some file-system-related probe tests for sector size > 512
These changes keep us from recognizing most file systems
when the sector size is larger than 512. However, for now (while
concentrating on getting partition table support right) that's not
a problem. Besides, the code we're avoiding would inevitably make
parted smash its stack.
* libparted/fs/linux_swap/linux_swap.c (_generic_swap_probe): Fail
the swap-file-system-recognizing test when sector size is not 512.
* libparted/filesys.c (ped_file_system_probe_specific): Fail all
fs-specific probe-related tests when sector size is not 512.
* libparted/fs/jfs/jfs.c (jfs_probe): For now, don't even try to
deal with larger sector size.
* libparted/label.c: Skip tests of problematic file system types.
* tests/t0100-print.sh: Print with units of sectors, and adjust
expected output accordingly.
* tests/t1000-mkpartfs.sh: Use a smaller test file.
That was back when parted's _partition table_ support was
smashing stack and heap whenever it tried to operate on anything
with sector size > 512.
That change added the following "if" statement:
PedGeometry*
ped_file_system_probe_specific (
const PedFileSystemType* fs_type, PedGeometry* geom)
{
PedGeometry* result;
PED_ASSERT (fs_type != NULL);
PED_ASSERT (fs_type->ops->probe != NULL);
PED_ASSERT (geom != NULL);
/* Fail all fs-specific probe-related tests when sector size
is not the default. */
if (geom->dev->sector_size != PED_SECTOR_SIZE_DEFAULT)
return 0;
it makes parted unlikely to hit bugs in its crufty FS-related back-ends
that would otherwise surely be exposed by >512-byte sector disks.
Just to see, I tried removing it and recompiled. That provokes segfaults
in the t1000-label.sh test the root-only t9010-big-sector.sh test, and in
your own test case outlined above. And that's without even running the
tests that simulate sector sizes larger than 512.
To summarize: the "File system" column that you want depends on code that
would misbehave badly if exposed to a device with sector size > 512.
At the moment, it seems not to be worth the trouble of trying to repair,
especially considering that only a few file system types are covered.
If someone can point to a nice FS-probing library, maybe we'll make time
to convert parted to use that.