Age | Commit message (Collapse) | Author | Files | Lines |
|
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>
|
|
* 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>
|
|
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=565946
Signed-off-by: Bryn M. Reeves <bmr@errorists.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
It would be nice to minimize dependence between the disk layout and
disk topology. We have to follow disk topology for alignment_offset
and huge (> 1MiB) I/O sizes only. For all others disks we can use 1MiB
grain and 1MiB offset.
Reported-by: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
* add -c to allows to switch off DOS mode from command line
* recommend sectors (command 'u' or option -u)
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
of '[Help]'.
Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
|
|
Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
|
|
* don't print:
The number of cylinders for this disk is set to 12161.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
we really don't care about MS-DOS or extremely old LILO.
* inform users that DOS-compatible mode is bad and deprecated thing
(It's difficult to use 2048 sectors grain or 4KiB sectors or
alignment_offset in DOS mode where all is based on cylinders...)
* don't check for cylinders boundary in non-DOS mode
* inform about sector and I/O sizes
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
The previous release 2.17 introduces aligned defaults for the first
and last sectors on the partition. Unfortunately, there is endless
loop when the code looks for first unused aligned sector.
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
* add heuristic to detect that the device does not provide
topology information. We can use topology if:
- alignment_offset is not 0
- or optimal_io_size is not 0
- or minimal_io_size is not power of 2
* default to 1MiB offset for the start of the first partition
if topology is unknown. This (2048 512-byte sectors)
is Windows Vista default.
* use optimal_io_size, minimal_io_size or 1MiB as a grain for
partitions alignment
Note that this all is used when DOS-compatible mode is disabled.
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
The old version of check_alignment() does not work with extended
partitions.
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
The alignment_offset is compensation for DOS compatible partitioning.
It usually matches with disk geometry (e.g. 63 sectors), but the
offset is also exported from phy.disks to RAIDs there the geometry
don't match with the offset. So.. don't print unnecessary warning.
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
Conflicts:
tests/ts/blkid/images-fs/adaptec-raid.img.bz2
tests/ts/blkid/images-fs/ddf-raid.img.bz2
tests/ts/blkid/images-fs/gfs2.img.bz2
tests/ts/blkid/images-fs/hpt37x-raid.img.bz2
tests/ts/blkid/images-fs/isw-raid.img.bz2
tests/ts/blkid/images-fs/jbd.img.bz2
tests/ts/blkid/images-fs/jmicron-raid.img.bz2
tests/ts/blkid/images-fs/lvm2.img.bz2
tests/ts/blkid/images-fs/nvidia-raid.img.bz2
tests/ts/blkid/images-fs/ocfs2.img.bz2
tests/ts/blkid/images-fs/promise-raid.img.bz2
tests/ts/blkid/images-fs/reiser4.img.bz2
tests/ts/blkid/images-fs/romfs.img.bz2
tests/ts/blkid/images-fs/silicon-raid.img.bz2
tests/ts/blkid/images-fs/swap0.img.bz2
tests/ts/blkid/images-fs/swap1.img.bz2
tests/ts/blkid/images-fs/via-raid.img.bz2
tests/ts/blkid/images-fs/vmfs_volume.img.bz2
tests/ts/blkid/images-fs/zfs.img.bz2
|
|
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
* rename the minimum_io_size variable to io_size
* use blkid_topology_get_optimal_io_size() for io_size initialization
* use blkid_topology_get_minimum_io_size() as a fallback solution for
io_size initialization
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
Let cfdisk use the internal libblkid if available to get the filesystem
type and label.
[kzak@redhat.com: - remove old FS probing code from cfdisk
- remove "Linux" prefix for filesystem names
- enlarge fstype field in partition_info
- restrict probing area by partition size]
Signed-off-by: Matthias König <mk@phasorlab.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
The fdisksunlabel.c header file is unnecessary for fdisk/fdisksunlabel.h.
Reported-by: Thomas Stalder <thomas@netsolux.ch>
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
It seems that sleep() after sync() is unnecessary legacy. It's very
probably unnecessary since kernel 1.3.20. For example the libparted
does not to use sleep() at all.
It seems that more important is fsync() usage in fdisks. For more
details see
http://marc.theaimsgroup.com/?l=linux-kernel&m=105545785306867&w=3
http://marc.theaimsgroup.com/?l=linux-kernel&m=105545848607353&w=3
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=276369
Currently we use fsync() in fdisk only. This patch also add fsync() to
sfdisk and cfdisk.
Addresses: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=276369
Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=502639
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
The size of disk in the sfdisk command is based on number of cylinders
(this is probably legacy from CHS epoch). That's wrong because
partitions are addressed in sectors (LBA), so cylinders don't provide
necessary resolution (granularity).
On Sat, Jan 02, 2010 at 01:01:16PM +0100, Giulio wrote:
> $ cat /sys/block/sda/size
> 184549376
>
> $ sfdisk -d /dev/sda > part.dump
> $ cat part.dump
> # partition table of /dev/sda
> unit: sectors
>
> /dev/sda1 : start= 2048, size= 2097152, Id=83
> /dev/sda2 : start= 2099200, size= 12582912, Id=83
> /dev/sda3 : start= 14682112, size= 84934656, Id=83
> /dev/sda4 : start= 99616768, size= 84932608, Id=83
>
>
> $ sfdisk -L /dev/sda < part.dump
> Checking that no-one is using this disk right now ...
> OK
>
> Disk /dev/sda: 11487 cylinders, 255 heads, 63 sectors/track
> Old situation:
> Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0
>
> Device Boot Start End #cyls #blocks Id System
> /dev/sda1 0+ 130- 131- 1048576 83 Linux
> /dev/sda2 130+ 913- 784- 6291456 83 Linux
> /dev/sda3 913+ 6200- 5287- 42467328 83 Linux
> /dev/sda4 6200+ 11487- 5287- 42466304 83 Linux
> Warning: given size (84932608) exceeds max allowable size (84921887)
disk size:
based on number of cylinders: 11487 * 8225280 = 94483791360 bytes
based on number of sectors: 184549376 * 512 = 94489280512 bytes
end of 4th partition (LBA in bytes):
(99616768 + 84932608) * 512 = 94489280512
Reported-by: Giulio <giulioo@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
Reported-by: Petr Pisar <petr.pisar@atlas.cz>
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
Typical "new partition" dialog looks like:
Partition number (1-4): 1
First sector (4-818687, default 4):
^^^^^^^^^
The range (e.g. 4-818687) depends on fdisk mode (DOS/non-DOS), but the
default value should be always aligned.
For example RAID5 device in the DOS mode:
Disk /dev/md0: 419 MB, 419168256 bytes
2 heads, 4 sectors/track, 102336 cylinders, total 818688 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 65536 bytes
Disk identifier: 0x081479c3
....
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First sector (4-818687, default 128): <---- !!!
Using default value 128
Last sector, +sectors or +size{K,M,G} (128-818687, default 818687): +10M
Command (m for help): p
....
Device Boot Start End Blocks Id System
/dev/md0p1 128 20607 10240 83 Linux
For non-DOS mode the range will be:
First sector (128-818687, default 128):
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
It's better to have disks without gaps between partitions, so it's
better to align ends of partitions.
Note, we don't care about end of partitions when the last sector has
been explicitly requested by user.
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
Disk /dev/md0: 419 MB, 419168256 bytes
2 heads, 4 sectors/track, 102336 cylinders, total 818688 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 65536 bytes
Disk identifier: 0x081479c3
Device Boot Start End Blocks Id System
/dev/md0p1 200 818687 409244 83 Linux
Partition 1 does not start on physical block boundary.
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
* inform user that phy.sector > log.sector
* warn user when alignment_offset is not provided does, DOS-compatible
mode is enabled and the default geo.sectors are not aligned
* suggest to change display units to sectors (oh yes, fdisk
default are cylinders...)
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
and print ('p' command) info about logical and physical sectors and
alignment_offset.
minimum_io_size
we don't use physical sector size directly, because on RAIDs is
better to use minimum_io_size (aka stripe chunk size). For disk drives
is minimum_io_size the same value as physical sector size.
alignment_offset
For compatibility with legacy operating systems some vendors provide
disks where logical and physical sectors are aligned at sector 63
(= geometry.sectors). In other words the physical 4KB sectors
start at LBA -1. Then the physical boundary is at:
alignment_offset + N * phy_sector_size
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
It was really stupid idea to use *_LDFLAGS for some global variable.
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
Conflicts:
mount/lomount.c
|
|
gcc 4.4 produces tons of
"dereferencing type-punned pointer will break strict-aliasing rules"
warnings for fdisk code where is
char buffer[BUFSIZ];
((struct disklabel *) MBRBuffer)->foo
There are two ways how fix the problem:
1/ union {
char buffer[BUFSIZ], struct disklabel label
} MBRBuffer;
2/ use allocated buffer, this way seems less invasive.
This patch implements 2/.
Old version:
$ make -C fdisk | grep -c warning
236
New version:
$ make -C fdisk | grep -c warning
0
About aliasing:
- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40665
- http://cellperformance.beyond3d.com/articles/2006/06/understanding-strict-aliasing.html
- C99
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
Those became unused with the switch to the blkdev functions.
Signed-off-by: Guillem Jover <guillem@hadrons.org>
|
|
|