If parent mount for test directory is mounted with shared flag,
move mount test fails because kernel rejects mount move operation.
Use another directory level and explicitly make parent mount private.
(All "modern" systems using system have mounts shared for some reason.)
Signed-off-by: Milan Broz <mbroz@redhat.com>
Minix mount test returs failure if kernel have no minix support,
minix: mkfs ... FAILED (minix/mkfs)
ignore test result instead in this case.
Signed-off-by: Milan Broz <mbroz@redhat.com>
cramfs test need explicitly set timezone otherwise
ls diff fails with
cramfs: mkfs checksums ... FAILED (cramfs/mkfs)
Signed-off-by: Milan Broz <mbroz@redhat.com>
The umount optimization (commit 9cc03553f7)
has to be disabled if the umount argument is not a directory.
Reported-by: Milan Broz <mbroz@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
commit f06ec64f dmesg; support level names (e.g. --console-level=alert)
introduced an off-by-one error. The kernel will print messages with
a *higher* level than the console-level. The bug made it impossible to
set the level for debugging, like it is documented in e.g
Documentation/networking/netconsole.txt :
nemi:/tmp# dmesg -n 8
dmesg: unknown level '8'
And attempting to set the "emerg" level would result in an invalid 0 value:
nemi:/tmp# dmesg -n emerg
dmesg: klogctl failed: Invalid argument
Restoring the old behaviour for numeric levels, and mapping the level
names so that "dmesg -n debug" behaves as expected: logging everything
at level "debug" and higher.
[kzak@redhat.com: - add comment to parse_level()]
Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: Karel Zak <kzak@redhat.com>
Add to manual page how to achieve old behavior, just in case someone
relies on buggy behavior of the command.
[kzak@redhat.com: - remove unnecessary info from the man page :-)]
Reported-by: Padraig Brady <P@draigBrady.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
This patch changes interpretation of subsequent delimeter interpretation.
Earlier version merged columns that had null string as content together,
which lead to output as visualized below.
$ printf "a🅱️c\n1::3\n" | column -t -s ':'
a b c
1 3
The number 3 has wrong column, which this patch takes care of, and alters
the output following way.
$ printf "a🅱️c\n1::3\n" | column -t -s ':'
a b c
1 3
This patch does not alter the default case, e.g., subsequent white spaces
are understood as separator of the same field, and the beginning of line
white spaces are being ignored together.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Partitions are incorrectly marked with 'disk' type on
lsblk output while it should be marked as 'part' type.
Before:
$ lsblk /dev/sda
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 128M 0 disk
`-sda1 8:1 0 64M 0 disk
With this patch applied:
$ lsblk /dev/sda
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 128M 0 disk
`-sda1 8:1 0 64M 0 part
Signed-off-by: Peter Rajnoha <prajnoha@redhat.com>
GCC 4.1.2 on SLES 10.4:
sys-utils/ipcrm.c: In function ‘main’:
sys-utils/ipcrm.c:297: warning: ‘what_all’ may be used uninitialized in this function
* sys-utils/ipcrm.c: Initialize what_all to ALL.
Signed-off-by: Bernhard Voelker <mail@bernhard-voelker.de>
blkdiscard is used to discard device sectors. This is useful for
solid-state drivers (SSDs) and thinly-provisioned storage. Unlike
fstrim this command is used directly on the block device.
blkkdiscard uses BLKDISCARD ioctl or BLKSECDISCARD ioctl for the secure
discard.
All data in the discarded region on the device will be lost!
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
This patch allows fdisk to handle GUID partition tables, based on the latest UEFI specifications
version 2.3.1, from June 27th, 2012. The following operations are supported:
- Probing (detects both protective and hybrid MBRs)
- Writing to disk
- Listing used partitions
- Adding partitions
- Deleting partitions
- Data integrity verifications (for both headers and partitions).
A few considerations:
- Currently we do not fix invalid primary headers -- we just abort!
- Header checksums are updated upon every change (ie: add/delete partitions), this allows us
to mathematically verify the changes on-the-fly, and not only when writing to disk, like
most other related tools do.
- We are extremly picky when writing to disk, any error aborts the opeartion.
- When creating a new partition, the following GUIDs are available:
http://en.wikipedia.org/wiki/GUID_Partition_Table#Partition_type_GUIDs
For test cases, the gpt.img from libblkid tests, scsi_debug and my own hard drive (/dev/sda) were used.
For the image, all operations were tested successfully, and for /dev/sda all except write, which
was not tested - hey, I'm not suicidal!
[kzak@redhat.com: - add get/set partition type functions
- use unified on strings based table for partition types
- add partition type to table list function]
Tested-and-reviewed-by: Petr Uzel <petr.uzel@suse.cz>
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
- remove all label specific partition type stuff from fdisk.c to
label files
- add new fdisk_set_partition_type() to API
Signed-off-by: Karel Zak <kzak@redhat.com>
- add flags to fdisk_parttype to store more information about the types
- function for conversion from code to fdisk_parttype
- function for conversion from string to fdisk_parttype
- function for conversion from user input to fdisk_parttype
- support for unknown complex types (e.g. unknown UUIDs)
Signed-off-by: Karel Zak <kzak@redhat.com>
- move MBR partition types to dos_part_types.h
- make dos_part_types.h independent on datetypes to keep it useful in
all fdisks
- add struct fdisk_parrtype
- move label specific partition types to context->label
Signed-off-by: Karel Zak <kzak@redhat.com>
Add to fstrim(8) code to support new discard BLKDISCARD and
BLKSECDISCARD ioctls for block devices. The new command is only
symlink to fstrim(8) as the both utils share some code and the basic
ideas.
Based on patch from Lukas Czerner <lczerner@redhat.com>.
Signed-off-by: Karel Zak <kzak@redhat.com>
create 8000 NFS mountpoints:
#!/bin/bash
mount=/tmp/mount
if [ ! -d $mount ]; then
mkdir -p $mount
fi
for dir in {1..8000}; do
if [ ! -d $mount/$dir ]; then
mkdir -p $mount/$dir
fi
echo mount $dir
mount -t nfs 127.0.0.1:/ $mount/$dir
done
old version:
time ./umount /tmp/mount/2255
real 0m1.254s
user 0m1.002s
sys 0m0.238s
new version:
time ./umount /tmp/mount/2244
real 0m0.332s
user 0m0.111s
sys 0m0.218s
Reported-by: chenditang <chendt.fnst@cn.fujitsu.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
Historically mkswap avoids wiping any signature on "whole disk",
until force option is given.
While the idea is that it should not wipe possible boot loader,
in reality it leads to many situations where e.g. LUKS device
is overwritten but still can be detected as LUKS (but unusable).
Patch chnges behaviour that only if partition table is detected,
signatures are not wiped.
Also it removes check for block device - loop device can now
map partitions in-kernel, so using mkswap on disk image in file
should behave the same as on disk.
Also it adds warning that know signature was wiped.
Signed-off-by: Milan Broz <mbroz@redhat.com>
Child processes that ended with segmentation fault previously
indicated this with return status only. The report is now more
verbose if core dump is allowed.
Improved-by: Pádraig Brady <P@draigBrady.com>
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
As blkid_devno_to_wholedisk returns parent dm device for
a partition mapping, the condition used in lsblk incorrectly
checked the parent-child relationship.
In this particular case, we need to process the dm partition
mapping like any other non-partition device as dm devices always
use proper holders/slaves sysfs hierarchy instead of
/sys/block/<parent>/<name> that is used for real partitions.
Example (test1 is a partition mapping and sdb1 is a real partition):
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 128M 0 disk
`-test (dm-0) 253:0 0 128M 0 dm
`-test1 (dm-1) 253:1 0 127M 0 part
sdb 8:16 0 128M 0 disk
`-sdb1 8:17 0 127M 0 disk
Before this patch (test1 skipped!):
$ lsblk -s /dev/mapper/test1
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
test (dm-0) 253:0 0 128M 0 dm
`-sda 8:0 0 128M 0 disk
$ lsblk -s /dev/sdb1
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sdb1 8:17 0 127M 0 disk
`-sdb 8:16 0 128M 0 disk
With this patch (test1 processed correctly):
$ lsblk -s /dev/mapper/test1
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
test1 (dm-1) 253:1 0 127M 0 part
`-test (dm-0) 253:0 0 128M 0 dm
`-sda 8:0 0 128M 0 disk
$ lsblk -s /dev/sdb1
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sdb1 8:17 0 127M 0 disk
`-sdb 8:16 0 128M 0 disk
Partitions mapped by device-mapper are not like real partitions where
there's a /sys/block/<parent>/<name>/dev sysfs path. We need to look
at /sys/block/<name>/dev like we do for any other non-partition devices.
The mapped partition is not found otherwise.
For example, this bug shows up in lsblk while specifying a device
on command line while that device is a dm mapping over a partition:
$lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 128M 0 disk
`-test (dm-0) 253:0 0 128M 0 dm
`-test1 (dm-1) 253:1 0 127M 0 part
Before this patch:
$lsblk /dev/mapper/test1
lsblk: dm-1: unknown device name
With this patch:
$lsblk /dev/mapper/test1
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
test1 (dm-1) 253:1 0 127M 0 part
If `setterm -dump` fails because of lack of permission to read
/dev/vcsa, it should not report that it couldn't read /dev/vcsa0.
This could be misleading if there is only /dev/vcsa, but not /dev/vcsa0.
Before:
$ ./setterm -dump
setterm: Couldn't read /dev/vcsa0
After:
$ ./setterm -dump
setterm: Couldn't read neither /dev/vcsa0 nor /dev/vcsa
(Note: /dev/vcsa0 does not exist and the user does not have read
permission on /dev/vcsa in this case).
Addresses: https://bugzilla.novell.com/show_bug.cgi?id=780615
Reported-by: Christopher Yeleighton <giecrilj@stegny.2a.pl>
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
The proper specifier for size_t is %zu. %lu will work fine on 64-bit
architectures but not on 32-bit.
Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
A sideeffect of 839be2ba6b is that we now
warp the systemtime according to the timezone, on the first call of
--systz. This is not always the correct thing to do, and causes a
regression for us in Arch Linux.
The behavior is correct if the RTC, and hence the systemtime, is
in localtime. However, if the systemtime is already in UTC we don't
want to touch it when we set the kernel timezone (which we still need to
do as some filesystems use this information).
An almost identical issue was also fixed in systemd commit
72edcff5db936e54cfc322d9392ec46e2428fd9b.
Signed-off-by: Tom Gundersen <teg@jklm.no>
On Sun, Sep 16, 2012 at 02:11:48PM +0800, Queen Adam wrote:
> I'm using Archlinux ARM for my Melo A100 box.
> The hwclock always timeout when using select() in rtc.c.
>
> After I change the timeout from 5 to 10, the problem is solved.
>
> In fact the timeout in my ARM box seems only to be a little larger
> than 5s.
Signed-off-by: Karel Zak <kzak@redhat.com>
The loop option is optional, mount(8) is able to detect that the
source path is regular file (image) with known filesystem -- then a
loop device is automatically created. In this case we have to store
"loop" option to mtab on systems without autoclear loopdev flag.
Signed-off-by: Karel Zak <kzak@redhat.com>
Disable an alarm use the same logic used to enable it: first try RTC_WKALM_SET
with the "enabled" flag set to false, if it fails fall back to RTC_AIE_OFF.
Signed-off-by: Giacomo <giacomo.perale@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>