Linux kernel ignores empty partitions, but partition number is always
allocated for the partition. (This rule is used for primary partitions
only.)
For example:
part 1. size=12345
part 2. size=0
part 3. size=24567
the final list of partitions:
sda1 sda3
'sda2' is not defined and partno=2 is not used for any other
partitions.
The libblkid library has to be compatible with this rule.
Signed-off-by: Karel Zak <kzak@redhat.com>
Print or change the label / UUID of a swap area.
[kzak@redhat.com: - code refactoring
- add long options
- clean up Makefile.am]
Signed-off-by: Jason Borden <jborden@bluehost.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
RAID probing of CD/DVD can yield errors because of well-known problem
in reading the end of the disk with some disk/drive combinations.
Borrow CD detection method from udev and skip the RAID tests for
these devices.
[kzak@redhat.com: - check for linux/cdrom.h in ./configure
- add #ifdef around the ioctl call
- call the ioctl for block devices only]
Signed-off-by: Mark Colclough <m.s.colclough@bham.ac.uk>
Signed-off-by: Karel Zak <kzak@redhat.com>
Use spaces in usage text instead of tabs and reduce the distance between
option names and descriptions.
This helps to minimize problems due to limited number of columns and
translated texts which take up more space than English.
Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
With glibc 2.10 on a 32bits system, fallocate64() function is not
exported. This a problem, since _FILE_OFFSET_BITS is set to 64 and
fallocate() is redirected to fallocate64().
Sadly, AC_CHECK_FUNC() doesn't catch such problem, since it's overriding
the function prototype.
See this for references:
http://sources.redhat.com/ml/libc-hacker/2009-05/msg00003.html
Signed-off-by: Yann Droneaud <yann@droneaud.fr>
Since not everyone have en_US.UTF-8 locale, default to POSIX locale.
This changes default sort order, so some expected results were updated.
Signed-off-by: Yann Droneaud <yann@droneaud.fr>
On Wed, Mar 24, 2010 at 04:39:35PM -0400, Phillip Susi wrote:
> I noticed that running partx -d /dev/sda hangs so I looked into it
> and it seems that it keeps trying to delete partitions forever.
Reported-By: Phillip Susi <psusi@cfl.rr.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
This simple patch fixes partx -a to not add nonexistent zero length
partitions for unused primary partition slots to to the kernel. This
makes partx conform to the usual kernel behavior.
Signed-off-by: Phillip Susi <psusi@cfl.rr.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
Note that the offset= and sizelimit= values in /etc/mtab are
always in the final format -- it means without suffix).
Signed-off-by: Karel Zak <kzak@redhat.com>
This function
int strtosize(const char *str, uintmax_t *res)
supports {K,M,G,T,E,P}iB and {K,M,G,T,E,P}B suffixes.
Signed-off-by: Karel Zak <kzak@redhat.com>
Implement new option --predict that predicts what the RTC will read
at a time given by the --date option. This is useful for example if
you need to setup an RTC wakeup time to distant future and want to
account for the RTC drift.
Signed-off-by: Timo Juhani Lindfors <timo.lindfors@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
This option allows to restrict low-level probing to the defined list
of superbocks (filesystems or RAIDs). For example:
blkid -p -n ext3,ext4,vfat /dev/sda1
or
blkid -p -n novfat /dev/sda1
Signed-off-by: Karel Zak <kzak@redhat.com>
The old fdisk (<2.17) does not differentiate between logical and
physical sector size, it uses the <sectorsize> for everything.
Now, we have logical and physical sectors size, but the -b option
changes the logical size only. The second bug is that "fdisk -b <sz>"
does not read topology information (it means that all I/O limits and
physical sector size are 512 (default).
The backwardly compatible bug fix is to override both sizes, logical
and physical if "-b" is used.
In future we can add a special option for physical size only.
Signed-off-by: Karel Zak <kzak@redhat.com>
The libblkid library uses stat.st_mtine to detect changes on the
device. The last update time of of the device in the cache is stored
as TIME= tag in the /etc/blkid.tab file.
Linux since 2.5.48 supports nanosecond resolution and more precise
time is available in the stat.st_mtim timespec struct.
This patch add microsecond precision to TIME= tag in the cache file,
old format:
TIME="<sec>"
the new format:
TIME="<sec>.<usec>"
This change is backwardly compatible.
Now, the blkid_verify() function checks stat.st_mtime and
stat.st_mtim.tv_nsec/1000.
Test:
# e2label /dev/sdb1 AAAA
old version:
# blkid -s LABEL /dev/sdb1; e2label /dev/sdb1 BBBB; blkid -s LABEL /dev/sdb1
/dev/sdb1: LABEL="AAAA"
/dev/sdb1: LABEL="AAAA"
new version:
# blkid -s LABEL /dev/sdb1; e2label /dev/sdb1 BBBB; blkid -s LABEL /dev/sdb1
/dev/sdb1: LABEL="AAAA"
/dev/sdb1: LABEL="BBBB"
Signed-off-by: Karel Zak <kzak@redhat.com>
echo l | fdisk/fdisk /dev/zero
FYI that however now spins forever doing:
offset=3074457345618258603)
at ../lib/blkdev.c:31
at ../lib/blkdev.c:151
at ../lib/blkdev.c:161
Reported-by: Pádraig Brady <P@draigBrady.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk/Makefile.am: Depend on the mbsalign module.
* fdisk/fdisk.c: Align using mbsalign rather than printf.
[kzak@redhat.com: - use size_t for width to fix gcc warning]
Reported-by: Makoto Kato <m_kato@ga2.so-net.ne.jp>
Signed-off-by: Pádraig Brady <P@draigBrady.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
This patch allows to automatically create a loop device from a regular
file if a filesystem type is not specified, for example:
mount /path/disk.img /mnt
If the filesystem type is specified than "-o loop" is required.
Note that there is not a restriction (on kernel side) that prevents
regular file as a mount(2) source argument. A filesystem that is able
to mount regular files could be implemented.
Based on a patch from Adam Jackson <ajax@redhat.com>.
Signed-off-by: Karel Zak <kzak@redhat.com>
The ambivalent probing result should be properly reported and user
should be informed that the problem is possible to bypass by "-t
<type>" or resolved by wipefs(8).
The mount(8) command uses a brute force stage (calls mount(2) for all
/{proc,etc}/fylesystems) if there is not any other way how to detect
the filesystem type. The brute force stage should not be restricted by
libblkid. It's possible that libblkid is not able to detect slightly
corrupted filesystem, but kernel is able to mount such filesystem.
Note that the brute force stage should not be used if libblkid returns
ambivalent probing result. In this case user's intervention is required
(e.g. mount -t <type>).
Reported-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
The superblocks probe bails out early with no results in some cases. If
this happens, blkid_do_probe needs to go to the next chain, rather than
entering an infinite loop calling superblocks_probe over and over again.
[kzak@redhat.com: - print debug message always when leaving
superblocks_probe()]
Addresses: https://bugs.launchpad.net/bugs/528073
Signed-off-by: Colin Watson <cjwatson@canonical.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
Improve ZFS uberblock detection to loop over multiple uberblocks,
and detect at least 4 magic values, to avoid random collisions.
It doesn't yet probe the VDEV LABEL at the end of the device, though
it wouldn't be too hard to add it at this point if needed.
Add extraction of the pool name (as LABEL), the VDEV (block device)
guid as UUID_SUB, and pool_guid (volume) as UUID from the nvlist in
the VDEV LABEL. Do simple sanity checking on the nvlist data values
to avoid overflowing the buffer if they are corrupt in any way.
[kzak@redhat.com: - use %PRIu64 instead %llu]
Signed-off-by: Andreas Dilger <adilger@sun.com>
Signed-off-by: Karel Zak <kzak@redhat.com>