LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   fdisk: Partition 2 does not start on physical sector boundary. (http://www.linuxquestions.org/questions/slackware-14/fdisk-partition-2-does-not-start-on-physical-sector-boundary-4175442802/)

stf92 12-24-2012 10:58 AM

fdisk: Partition 2 does not start on physical sector boundary.
 
Hi:
I have just installed slackware 14.0 (32 bits). When I run fdisk I get the following:
Code:

root@darkstar:~# fdisk -l /dev/sda

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x4cf30742

  Device Boot      Start        End      Blocks  Id  System
/dev/sda1  *          63    40965749    20482843+  7  HPFS/NTFS/exFAT
Partition 1 does not start on physical sector boundary.
/dev/sda2        40965750    80035829    19535040  83  Linux
Partition 2 does not start on physical sector boundary.
/dev/sda3        80035830    97610939    8787555  82  Linux swap
Partition 3 does not start on physical sector boundary.
/dev/sda4        97610940  976773167  439581114    7  HPFS/NTFS/exFAT
Partition 4 does not start on physical sector boundary.
root@darkstar:~#

However, everything seems to be running correctly. What can be the cause of that weird message? I partitioned the disk with cfdisk. I've have read other posts in LQ and google on this issue but haven't been able to get a clear picture of the nature of this problem.

I'll be replacing the 32-bit version of 14.0 by the 64-bit one in a few days. So, what options could I give cfdisk to avoid this problem?


kernel 3.2.29, slackware 14.0

Ser Olmy 12-24-2012 11:14 AM

Quote:

Originally Posted by stf92 (Post 4856139)
Code:

Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes


Your hard drive has a physical sector size of 4096 bytes, but for compatibility reasons, it reports a logical sector size of 512 bytes.

If your partitions don't start at 4k sector boundaries, write performance will suffer. You could repartition and reinstall, but if you're dual-booting between Windows and Linux (I noticed your first primary partition is NTFS), make sure your Windows version can handle a boot partition that starts somewhere other than at sector 63 (XP can't).

stf92 12-24-2012 01:25 PM

How do I do to make the partition start at 4k sector boundaries? Has cfdisk/fdisk any option to do that?

Ser Olmy 12-25-2012 08:40 PM

Newer versions of fdisk have a setting called "DOS Compatibility Flag", and if not set, the 1st partition starts at sector 2048. 2048 is divisible by 8 and thus aligned to a 4k sector boundary (if the drive has 4k physical sectors but reports 512 byte logical sectors). I think you still need to make sure other partitions start at a 4k boundary.

A quick Google search revealed that parted has an --align optimal parameter that supposedly aligns partitions on "advanced format" drives. As for other partitioning tools, I'm afraid I don't know.

stf92 12-27-2012 08:41 PM

Quote:

Originally Posted by stf92 (Post 4856139)
Hi:
I have just installed slackware 14.0 (32 bits). When I run fdisk I get the following:
Code:

root@darkstar:~# fdisk -l /dev/sda

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x4cf30742

  Device Boot      Start        End      Blocks  Id  System
/dev/sda1  *          63    40965749    20482843+  7  HPFS/NTFS/exFAT
Partition 1 does not start on physical sector boundary.
/dev/sda2        40965750    80035829    19535040  83  Linux
Partition 2 does not start on physical sector boundary.
/dev/sda3        80035830    97610939    8787555  82  Linux swap
Partition 3 does not start on physical sector boundary.
/dev/sda4        97610940  976773167  439581114    7  HPFS/NTFS/exFAT
Partition 4 does not start on physical sector boundary.
root@darkstar:~#


I have two questions:
(a) I know partition 1 is 20GB long. Therefore, 'start' and 'end' are given in 512-byte sectors (logical sectors). From this, the quantity under 'blocks' is given in 1024-byte units. I.e., 1 block = 1024 bytes. Am I right? (Although the man page says that sizes are shown in sectors by default, it does not say what size a block is.)

(b) How are logical sectors counted? Is the first sector on a track sector 0? In DOS sectors were counted from 1. If first sector = sector 0 it makes sense, for then partition 1 starts at the beginning of a track, because 1 track = 63 sectors.

EDIT: One other question. Partition 1 starts at sector 63 and 64 * 512 = 32768. Therefore the partition 1 starts at a 4K boundary because 32768 is divisible by 4098! What is the problem then? Why does fdisk report 'Partition does not start at pphysical sector boundary'?

Ser Olmy 12-27-2012 09:25 PM

Quote:

Originally Posted by stf92 (Post 4858105)
I have two questions:
(a) I know partition 1 is 20GB long. Therefore, 'start' and 'end' are given in 512-byte sectors (logical sectors). From this, the quantity under 'blocks' is given in 1024-byte units. I.e., 1 block = 1024 bytes. Am I right? (Although the man page says that sizes are shown in sectors by default, it does not say what size a block is.)

Yes, that is correct.
Quote:

Originally Posted by stf92 (Post 4858105)
(b) How are logical sectors counted? Is the first sector on a track sector 0? In DOS sectors were counted from 1. If first sector = sector 0 it makes sense, for then partition 1 starts at the beginning of a track, because 1 track = 63 sectors.

The first sector is sector 0. The concept of "tracks" or "cylinders" are no longer used. Instead, LBA addressing simply counts sectors from the start of the disk.
Quote:

Originally Posted by stf92 (Post 4858105)
EDIT: One other question. Partition 1 starts at sector 63 and 64 * 512 = 32768. Therefore the partition 1 starts at a 4K boundary because 32768 is divisible by 4098! What is the problem then? Why does fdisk report 'Partition does not start at pphysical sector boundary'?

Since the first sector is sector 0 and each sector is 512 bytes (0.5 kb), logical sectors 0, 8, 24, 32 etc. represent the start of a 4k physical sector.

Sector 63 is the 64th logical sector on the drive, and the last logical sector (out of 8) of the 8th physical 4k sector. So no, a partition starting at logical sector 63 does not start at a physical sector boundary.

stf92 12-27-2012 09:41 PM

I understand. However, sector 63 is the first sector of the second track, and it makes sense that a partition starts at the beginning of a track! But you're right. 63 * 512 is not divisible by 4096.

However I understand the division into secs, heads, cylinders has no meaning for modern disks. Otherwise, it would be odd that a disk has 63 secs per track instead of a power of 2.

Ser Olmy 12-27-2012 09:48 PM

Quote:

Originally Posted by stf92 (Post 4858135)
I understand. However, sector 63 is the first sector of the second track, and it makes sense that a partition starts at the beginning of a track!

Except it doesn't really start at the beginning of a track.

It's been years (if not decades) since the "track" number represented an actual, physical track on the disk. Modern drives have very few platters/heads and a godawful number of tracks with a variable numbers of sectors on each track.

The Cylinder-Head-Sector (CHS) numbering scheme assumes a fixed number of sectors on each track and no more than 63, so the a modern drive compensates by reporting fewer tracks with fewer sectors and a ridiculous number of heads.

stf92 12-27-2012 10:05 PM

The fdisk man page says

Code:


      -c[=mode]
              Specify the compatiblity mode, 'dos' or 'nondos'.  The  default
              is  non-DOS mode.  For backward compatibility, it is possible to
              use the option without the <mode> argument -- then  the  default
              is used.  Note that the optional <mode> argument cannot be sepa-
              rated from the -c option by a space, the  correct  form  is  for
              example '-c=dos'.

which is, I think, the compatibility flag you referred to in post #4. Cfdisk, instead has this command:
Code:

      m      Maximize disk usage of the current partition.  This command will
              recover  the  unused  space  between the partition table and the
              beginning of the partition, but at the cost of making the parti-
              tion  incompatible  with  DOS, OS/2 and possibly other operating
              systems.  This option will toggle between maximal disk usage and
              DOS,  OS/2, etc. compatible disk usage.  The default when creat-
              ing a partition is to create DOS, OS/2, etc.  compatible  parti-
              tions.

If the fdisk -c option does the same as cfdisk m command, then using fdisk with the -c=nondos option wouldn't do.

On the other hand, fdisk man page recommends using cfdisk instead of fdisk. There are two other programs in slackware 14, sfdisk and parted. Perhaps one of these could solve my problem.

EDIT: sorry, you posted as I was writing.

jasmines 03-03-2013 02:24 PM

http://askubuntu.com/q/156994/32230

rknichols 03-03-2013 05:46 PM

Hopefully the OP has fixed his issue some time in the past 2 months.

stf92 03-04-2013 08:47 AM

I'm afraid, although the problem is now solved, I did not documented the procedure I followed, and if I did it, I do not find the file or papers. However, I do remember I finally used the parted command to partition and, if everything turns about the new 4096-byte sector size, I do not think I'll have a problem when faced with the task of partitioning an advanced format drive again. Thanks.


All times are GMT -5. The time now is 02:56 PM.