diff options
author | Karel Zak | 2009-11-03 12:09:36 +0100 |
---|---|---|
committer | Karel Zak | 2009-11-18 11:25:10 +0100 |
commit | 8e23f2d20f7dd21a318c070b14b45075c8170d4f (patch) | |
tree | 310c96d674cf7f0918e41825e3fa81ac30125a16 /fdisk/fdisk.c | |
parent | fdisk: print info and recommendations about alignment (diff) | |
download | kernel-qcow2-util-linux-8e23f2d20f7dd21a318c070b14b45075c8170d4f.tar.gz kernel-qcow2-util-linux-8e23f2d20f7dd21a318c070b14b45075c8170d4f.tar.xz kernel-qcow2-util-linux-8e23f2d20f7dd21a318c070b14b45075c8170d4f.zip |
fdisk: check for partition boundary
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>
Diffstat (limited to 'fdisk/fdisk.c')
-rw-r--r-- | fdisk/fdisk.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/fdisk/fdisk.c b/fdisk/fdisk.c index f269164c1..424ad0d40 100644 --- a/fdisk/fdisk.c +++ b/fdisk/fdisk.c @@ -1033,6 +1033,7 @@ get_partition_table_geometry(void) { } } + /* * Sets LBA of the first partition */ @@ -1797,6 +1798,14 @@ static void check_consistency(struct partition *p, int partition) { } static void +check_alignment(struct partition *p, int partition) +{ + if (!lba_is_aligned(get_start_sect(p))) + printf(_("Partition %i does not start on physical block boundary.\n"), + partition + 1); +} + +static void list_disk_geometry(void) { long long bytes = (total_number_of_sectors << 9); long megabytes = bytes/1000000; @@ -2031,6 +2040,7 @@ list_table(int xtra) { /* type name */ (type = partition_type(p->sys_ind)) ? type : _("Unknown")); check_consistency(p, i); + check_alignment(p, i); } } @@ -2063,8 +2073,10 @@ x_list_table(int extend) { cylinder(p->end_sector, p->end_cyl), (unsigned long) get_start_sect(p), (unsigned long) get_nr_sects(p), p->sys_ind); - if (p->sys_ind) + if (p->sys_ind) { check_consistency(p, i); + check_alignment(p, i); + } } } } @@ -2141,6 +2153,7 @@ verify(void) { p = pe->part_table; if (p->sys_ind && !IS_EXTENDED (p->sys_ind)) { check_consistency(p, i); + check_alignment(p, i); if (get_partition_start(pe) < first[i]) printf(_("Warning: bad start-of-data in " "partition %d\n"), i + 1); |