LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Partition does not start on physical sector boundary (https://www.linuxquestions.org/questions/slackware-14/partition-does-not-start-on-physical-sector-boundary-4175426683/)

czezz 09-11-2012 06:54 AM

Partition does not start on physical sector boundary
 
I have installed Slackware 14 RC2.
I have used regular procedure and on the beginning created partition with fdisk, then installed system.

After system was up and running I have noticed that fdisk shows me some problem with just created partitions:
Code:

# 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: 0x1a0c9604

  Device Boot      Start        End      Blocks  Id  System
/dev/sda1  *          63    19535039    9767488+  83  Linux
Partition 1 does not start on physical sector boundary.
/dev/sda2      968772798  976773167    4000185  82  Linux swap
Partition 2 does not start on physical sector boundary.
/dev/sda3        19535040  968772797  474618879  83  Linux

As far as I can see it is because of this:
Code:

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

My questions:
1. How can I correct it now ? (I have remote access with SSH only).
2. Why the heck fdisk set sectore size like this ? I have never before had to pay attention for that. (I was just using defaults).


Please note:
/dev/sda3 was created later; Not during OS installation process.

pan64 09-11-2012 07:26 AM

I do not think you need to do anything. Probably it is not nice or surprising, but it is still ok.

Fred-1.2.13 09-11-2012 08:22 AM

Seems to be a fairly common problem.

Google for this: linux partition 1 does not start on physical sector boundary

You will get many results! Good luck!

w1k0 09-11-2012 03:50 PM

In the BUGS section of man fdisk you can read the following information:

Quote:

There are several *fdisk programs around. Each has its problems and strengths. Try them in the order cfdisk, fdisk, sfdisk. (Indeed, cfdisk is a beautiful program that has strict requirements on the partition tables it accepts, and produces high quality partition tables. Use it if you can. fdisk is a buggy program that does fuzzy things - usually it happens to produce reasonable results.
So fdisk authors advise to use cfdisk rather than fdisk.

Now you installed the system so you can’t redefine the partition boundaries. The next time you’ll decide to install the system prepare the partition table using cfdisk.

TobiSGD 09-11-2012 04:12 PM

Quote:

Originally Posted by pan64 (Post 4777628)
I do not think you need to do anything. Probably it is not nice or surprising, but it is still ok.

As fdisk shows, the OP has a disk with 4k physical sectors. Unaligned partitions will cause a major performance impact on these partitions (the same is true for partitions on SSDs). So it is not OK.
What surprises me is that newer fdisk versions shouldn't create the first partition at sector 63 by default, as it happened to you, for exactly this reason, the first partition should have been created at sector 2048.
I would recommend to delete those partitions and re-install the OS, this time using cfdisk instead. Have a look at partition alignment before starting the installation of the OS.

gazj 09-11-2012 04:49 PM

Dang it, my 2tb home drive is partitioned like this :S This is going to take some serious time to backup repartition and restore!

TobiSGD 09-11-2012 05:02 PM

Quote:

Originally Posted by gazj (Post 4777970)
Dang it, my 2tb home drive is partitioned like this :S This is going to take some serious time to backup repartition and restore!

Before doing that action make sure that you really have a disk with 4k physical sectors. On disks with 512 byte sectors this type of partitioning is OK.

gazj 09-11-2012 05:24 PM

Well this is what I get, so I guess I need to sort it out?

Code:

gary@Slacker ~ $ sudo /sbin/fdisk -l /dev/sdb

Disk /dev/sdb: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders, total 3907029168 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: 0x0007ad01

  Device Boot      Start        End      Blocks  Id  System
/dev/sdb1              63  3907024064  1953512001  83  Linux
Partition 1 does not start on physical sector boundary.


TobiSGD 09-11-2012 05:57 PM

Seems so. Which OS/version/tool did you use to partition that disk?

MQMan 09-11-2012 06:55 PM

Quote:

Originally Posted by TobiSGD (Post 4777954)
the first partition should have been created at sector 2048.

Why 2048. Isn't any sector, divisible by 8 sufficient, like 64.

Cheers.

TobiSGD 09-11-2012 07:01 PM

The problem with a start sector at 63 comes up with the 4K drives, but SSDs also have the same problem, only with different sector sizes (usually between 128K and 512K). To have some room for future devices the developers came up with 2048 logical sectors, which resemble 1M physical sectors.

jtsn 09-11-2012 10:20 PM

SSDs have the same 4K physical sectors as HDDs. The 1M alignment is due to the erase-block size of simpler flash media (like SD cards and USB flash drives) and doesn't affect SSDs, which use a 4K-sector-based wear-leveling.

gazj 09-12-2012 01:51 AM

Quote:

Originally Posted by TobiSGD (Post 4778002)
Seems so. Which OS/version/tool did you use to partition that disk?

Hmm, no telling I have had this home partition around for sometime. It could of been Slackware, Arch or maybe even Gentoo. I tend to us cfdisk of fdisk however. But that is not even a certainty. Sorry that doesn't really help much does it?

TobiSGD 09-12-2012 03:16 AM

Quote:

Originally Posted by jtsn (Post 4778125)
SSDs have the same 4K physical sectors as HDDs. The 1M alignment is due to the erase-block size of simpler flash media (like SD cards and USB flash drives) and doesn't affect SSDs, which use a 4K-sector-based wear-leveling.

OK, I shouldn't have said physical sector size, but flash block erase boundaries. Those are usually between 128K-512K and are those that have the performance impact when writing to the SSD. Partitions should be aligned to this erase boundaries and since 1M is a multiple of the usual sizes 2048 logical sectors is a save bet to start with.

Martinus2u 09-12-2012 03:34 PM

Quote:

Originally Posted by TobiSGD (Post 4778241)
since 1M is a multiple of the usual sizes 2048 logical sectors is a save bet to start with.

another reason may be compatibility with a commercial operating system by a vendor based in Redmond.


All times are GMT -5. The time now is 04:14 AM.