This patch enables creating a new, empty, GPT disklabel from either
an empty disk or one that already has a disklabel. For this
purpose, a 'g' option is added to the main menu and is visible to all
labels. Here's an example for a scsi_debug device (/dev/sdb):
...
Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0x20a614c8.
3696: fdisk: CONTEXT: zeroize in-memory first sector buffer
Command (m for help): g
3696: fdisk: LABEL: changing to gpt label
3696: fdisk: CONTEXT: zeroize in-memory first sector buffer
3696: fdisk: LABEL: created new empty GPT disklabel (GUID: D4EA0706-F011-46DC-B7DE-6A72C7090AF8)
Command (m for help): w
The partition table has been altered!
...
Acked-by: Petr Uzel <petr.uzel@suse.cz>
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
We were writing only 1 byte in LBA0, and GPT requires dealing with an entire
sector. This bug wasn't affecting when dealing with already existing devices
with GPT as we weren't writing an important part of the first sector, thus
leaving it unchanged. Also use write_all() wrapper from all-io.h
Acked-by: Petr Uzel <petr.uzel@suse.cz>
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Patch adds "SCSI transport layer" similar attribute to "lsscsi -t".
This is useful for script where you want to distinguish e.g. FC, iSCSI
or USB devices from local disks.
Detection logic is quite simplified in comparison to lsscsi but it
should provide the same output (except detailed transport attributes).
Signed-off-by: Milan Broz <mbroz@redhat.com>
For block devices it is sometimes useful to print SCSI device ID"
Host:Channel:Target:LUN.
Patch adds column name HCTL which can be used in lsblk.
Signed-off-by: Milan Broz <mbroz@redhat.com>
For raw output used in scripts it is sometimes necessary
to reconstruct tree of devices.
Parent kernel name (PKNAME) provides needed information
to do that easily.
Signed-off-by: Milan Broz <mbroz@redhat.com>
It's probably unnecessary paranoia, but let's check if we're able to
restore the original IDs after ~/.hushlogin file check.
Signed-off-by: Karel Zak <kzak@redhat.com>
Using sysconf(_SC_HOST_NAME_MAX) does not work everywhere. At such even
header values for hostname length should be preferred, and if nothing
else works guess the maxium being 64 bytes.
Based-on-code-by: Karel Zak <kzak@redhat.com>
CC: Mike Frysinger <vapier@gentoo.org>
References: http://www.spinics.net/lists/util-linux-ng/msg07050.html
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
The generic fdisk_delete_partition() function returns 0 when a partition
is correctly deleted, otherwise it's corresponding error (negative values).
This, however, does not include problems that can occur in actual label
specific contexts, so we need to propagate the corresponding return code,
back to the user visible api.
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
The goal is to consolidate the very basic linux commands and minimize
dependence on another packages (e.g. shadow-utils). It seems better to
keep newgrp, vipw and vigr as non-deprecated for now. Maybe we will
found a way how to improve the code. We will see... :-)
Signed-off-by: Karel Zak <kzak@redhat.com>
The current loopdev code prefers /sys to get information about
loop devices. The old methods like scan /dev are fallback solution
only. Unfortunately, the code does not check if /sys is mounted.
Addresses: http://blog.flameeyes.eu/2012/10/sophistication-can-be-bad
Signed-off-by: Karel Zak <kzak@redhat.com>
[kzak@redhat.com: - split from dmesg patch
- add more colors]
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
The -L and -U flags both have long options too (--label and --uuid).
The usage() function will show them but the man page didn't list them.
Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
The --no-canonicalize option can also be set using -c. The --help for
mount shows this option but the man page did not. Add -c to the man
page.
Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>