Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
SSD: the resulting partition is not properly aligned
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
Spanik
Guru
Guru


Joined: 12 Dec 2003
Posts: 457
Location: Belgium

PostPosted: Fri May 02, 2014 3:36 pm    Post subject: SSD: the resulting partition is not properly aligned Reply with quote

I'm trying to partition a new SSD for a gentoo install. The old install is on /dev/sdc and working but after a couple wrong manipulations it doesn't want to update any more. So I going to install a new version.

I started following the handbook and used parted 3.0.

Code:
parted /dev/sde
GNU Parted 3.0
Using /dev/sde
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p                                                               
Model: ATA SanDisk SDSSDP12 (scsi)
Disk /dev/sde: 126GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name  Flags
 1      1049kB  3146kB  2098kB               grub  bios_grub


Making the first partition is ok, no errors or remarks. But the second partition gives

Code:
(parted) mkpart primary 3 131                                             
Warning: You requested a partition from 3.00MiB to 131MiB.               
The closest location we can manage is 3.00MiB to 131MiB.
Is this still acceptable to you?
Yes/No? y                                                                 
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel?   


What is happening here? I did use optimal but it seems that that doesn't work.
_________________
Expert in non-working solutions
Back to top
View user's profile Send private message
aCOSwt
Bodhisattva
Bodhisattva


Joined: 19 Oct 2007
Posts: 2537
Location: Hilbert space

PostPosted: Fri May 02, 2014 4:31 pm    Post subject: Reply with quote

What does
Code:
# cat /sys/block/sde/queue/optimal_io_size

and
Code:
# cat /sys/block/sde/alignment_offset

and
Code:
# cat /sys/block/sde/queue/minimum_io_size

say ?
_________________
Back to top
View user's profile Send private message
frostschutz
Advocate
Advocate


Joined: 22 Feb 2005
Posts: 2970
Location: Germany

PostPosted: Fri May 02, 2014 5:19 pm    Post subject: Reply with quote

what is "3 131" supposed to be, exactly?

parted works with strange unit by default; I suggest you start each parted session with either "unit mib" or "unit s" (use multiple of 2048 then), then follow it up with a 'print free' to see what free space you can use for the next mkpart.

bios_grub is the one partition where alignment does not really matter and size has to be really really small. You can squeeze it in before the first real partition that starts at 1MiB (mkpart primary 64s 2047s)

Example:

Code:

(parted) mklabel gpt
(parted) unit mib                                                         
(parted) print free                                                       
Model: Loopback device (loopback)
Disk /dev/loop0: 20480MiB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start    End       Size      File system  Name  Flags
        0.02MiB  20480MiB  20480MiB  Free Space
(parted) mkpart primary 64s 2047s
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel? Ignore                                                     
(parted) toggle 1 bios_grub
(parted) print free                                                       
Model: Loopback device (loopback)
Disk /dev/loop0: 20480MiB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start    End       Size      File system  Name     Flags
        0.02MiB  0.03MiB   0.01MiB   Free Space
 1      0.03MiB  1.00MiB   0.97MiB                primary  bios_grub
        1.00MiB  20480MiB  20479MiB  Free Space

(parted) mkpart primary 1 1024
(parted) mkpart primary 1024 4096
(parted) mkpart primary 4096 16384
(parted) print free                                                       
Model: Loopback device (loopback)
Disk /dev/loop0: 20480MiB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start     End       Size      File system  Name     Flags
        0.02MiB   0.03MiB   0.01MiB   Free Space
 1      0.03MiB   1.00MiB   0.97MiB                primary  bios_grub
 2      1.00MiB   1024MiB   1023MiB                primary
 3      1024MiB   4096MiB   3072MiB                primary
 4      4096MiB   16384MiB  12288MiB               primary
        16384MiB  20480MiB  4096MiB   Free Space

(parted) unit s                                                           
(parted) print free                                                       
Model: Loopback device (loopback)
Disk /dev/loop0: 41943040s
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start      End        Size       File system  Name     Flags
        34s        63s        30s        Free Space
 1      64s        2047s      1984s                   primary  bios_grub
 2      2048s      2097151s   2095104s                primary
 3      2097152s   8388607s   6291456s                primary
 4      8388608s   33554431s  25165824s               primary
        33554432s  41943006s  8388575s   Free Space



Please ignore the alignment io size and blockdev --getalignoff stuff - most drives report the wrong values there anyway; just align everything to MiB, that works for every device so far...

EDIT: I usually 'toggle lvm' for all Linux partitions, as by default, Windows might try to format them if you are on a multiboot system. And Linux still doesn't care about those flags one way or another, except for the biosgrub. Aaand maybe the raid autodetect, but no one uses that anymore, right?
Back to top
View user's profile Send private message
Spanik
Guru
Guru


Joined: 12 Dec 2003
Posts: 457
Location: Belgium

PostPosted: Fri May 02, 2014 6:29 pm    Post subject: Reply with quote

aCOSwt wrote:
What does
Code:
# cat /sys/block/sde/queue/optimal_io_size

and
Code:
# cat /sys/block/sde/alignment_offset

and
Code:
# cat /sys/block/sde/queue/minimum_io_size

say ?


Gives this:
Code:
daw ~ # cat /sys/block/sde/queue/optimal_io_size
0
daw ~ # cat /sys/block/sde/alignment_offset
0
daw ~ # cat /sys/block/sde/queue/minimum_io_size
512



Quote:
what is "3 131" supposed to be, exactly?

parted works with strange unit by default; I suggest you start each parted session with either "unit mib"


I'm following the manual to the letter. So I did use "unit mib" and I entered just like in the manual a size of 100MB for the /boot. So going from 3MB to 103MB. It is parted no following the optimise flag at all. Yes, I mistyped 103 but it doesn't change a thing, parted doesn'"t align at a boundary.

The previous install on the first ssd used parted as well and then I didn't get it to find the alignment either. It looks like it doesn't work at all (the alignment, partitioning and formating works fine). Now I could amuse myself to calculate everything again, but this is just going backward.

No multiboot, no windows on this pc. It has been running Gentoo since 2003 but each time I re-install it becomes harder and harder. The stage 1 took longer but all said and done it was faster than getting it even install right now. And don't get me started on grub2 which is at least 3 steps backward (you can't even edit the config file and have to use something as retarded as EDLIN)
_________________
Expert in non-working solutions
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 13845

PostPosted: Fri May 02, 2014 10:37 pm    Post subject: Reply with quote

You may want to try sgdisk from sys-apps/gptfdisk for partition management and sys-boot/syslinux for a bootloader. sgdisk is a GPT-aware variant of sfdisk. Syslinux includes bootloaders for GPT based systems and follows a fairly minimal configuration file format.
Back to top
View user's profile Send private message
Spanik
Guru
Guru


Joined: 12 Dec 2003
Posts: 457
Location: Belgium

PostPosted: Sat May 03, 2014 10:52 am    Post subject: Reply with quote

Can't emerge it...
Code:
daw ~ # emerge --search sgdisk
!!! Unable to parse profile: '/etc/make.profile'
!!! ParseError: Profile contains unsupported EAPI '5': '/usr/portage/profiles/default/linux/amd64/13.0/eapi'
Searching...   
[ Results for search key : sgdisk ]
[ Applications found : 0 ]


That's the reason I re-install, I messed up the profile.
_________________
Expert in non-working solutions
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 13845

PostPosted: Sat May 03, 2014 2:47 pm    Post subject: Reply with quote

You cannot emerge it because you did not read my message carefully. The program is named sgdisk. The package is sys-apps/gptfdisk, which I wrote in blue because it is a package name with category. You searched for a package named sgdisk with unspecified category.

Your unsupported profile problem has been encountered by others and can be fixed, albeit with a somewhat ugly workaround. It was discussed on the forum within the last few months. I do not have a ready link available.
Back to top
View user's profile Send private message
aCOSwt
Bodhisattva
Bodhisattva


Joined: 19 Oct 2007
Posts: 2537
Location: Hilbert space

PostPosted: Sat May 03, 2014 3:01 pm    Post subject: Reply with quote

Hu wrote:
Your unsupported profile problem has been encountered by others and can be fixed, albeit with a somewhat ugly workaround. It was discussed on the forum within the last few months. I do not have a ready link available.

https://forums.gentoo.org/viewtopic-t-950762-highlight-unsupported+profile.html
_________________
Back to top
View user's profile Send private message
Spanik
Guru
Guru


Joined: 12 Dec 2003
Posts: 457
Location: Belgium

PostPosted: Sat May 03, 2014 3:13 pm    Post subject: Reply with quote

Hu wrote:
You cannot emerge it because you did not read my message carefully. The program is named sgdisk. The package is sys-apps/gptfdisk, which I wrote in blue because it is a package name with category. You searched for a package named sgdisk with unspecified category.

Your unsupported profile problem has been encountered by others and can be fixed, albeit with a somewhat ugly workaround. It was discussed on the forum within the last few months. I do not have a ready link available.


Your right, I made a mistake there, too hasty. Try again this evening when I have more time (package is masked).

Maybe I can clean up the profile mess, but as it is some time since I updated it will probably be just as fast to re-install. Certainly as kde is up several versions and even incremental version can be a pain to update. So I'll go for the new install.
_________________
Expert in non-working solutions
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


Joined: 09 Dec 2006
Posts: 7552
Location: Goose Creek SC

PostPosted: Sat May 03, 2014 4:05 pm    Post subject: Reply with quote

The author of sgdisk provides the following cautionary note:

Before beginning, I wish to emphasize the fact that sgdisk is intended for use in scripts or by experts. The program is unforgiving of user error—if you tell it to delete a partition, empty the partition table, or perform some other destructive operation, the program will do so without asking for confirmation. It will immediately save changes to disk, so recovering from an error can be difficult. If you intend to manually partition a disk, I strongly recommend you use gdisk rather than sgdisk, since gdisk is more interactive in nature, warns you when you're about to do something dangerous, and provides the opportunity to back out of any changes you make before saving them to disk.

For error prone non-experts like me, gdisk is provided in the same gptfdisk package.
_________________
Defund the FCC.
Back to top
View user's profile Send private message
frostschutz
Advocate
Advocate


Joined: 22 Feb 2005
Posts: 2970
Location: Germany

PostPosted: Sun May 04, 2014 6:01 pm    Post subject: Reply with quote

Spanik wrote:
It is parted no following the optimise flag at all.


The optimize is useless anyhow. The disks themselves do not report what would be optimal for them, so - alignment is a manual process.

I prefer parted over the alternatives because - it just works, with less cryptic commands than fdisk (and its clones), for both msdos and gpt...

If you use parted the way I showed; does it work or not?
Back to top
View user's profile Send private message
Spanik
Guru
Guru


Joined: 12 Dec 2003
Posts: 457
Location: Belgium

PostPosted: Tue May 06, 2014 6:57 pm    Post subject: Reply with quote

Quote:
The optimize is useless anyhow. The disks themselves do not report what would be optimal for them, so - alignment is a manual process.


Ok, can live with that. I'll calculate it like the previous time.

I'll try your system but I'm trying to understand what you're doing before actually comitting to it.
_________________
Expert in non-working solutions
Back to top
View user's profile Send private message
Spanik
Guru
Guru


Joined: 12 Dec 2003
Posts: 457
Location: Belgium

PostPosted: Tue May 06, 2014 7:25 pm    Post subject: Reply with quote

OK, typed something not very kosher and now when I try to access the ssd with parted I get this:

Code:
daw ~ # parted /dev/sde
GNU Parted 3.0
Using /dev/sde
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p                                                               
Warning: /dev/sde contains GPT signatures, indicating that it has a GPT table.  However, it does not have a valid fake msdos partition table, as it should.  Perhaps it was corrupted
-- possibly by a program that doesn't understand GPT partition tables.  Or perhaps you deleted the GPT table, and are now using an msdos partition table.  Is this a GPT partition
table?
Yes/No? n                                                                 
Model: ATA SanDisk SDSSDP12 (scsi)
Disk /dev/sde: 126GB
Sector size (logical/physical): 512B/512B
Partition Table: unknown
(parted) p                                                               
Warning: /dev/sde contains GPT signatures, indicating that it has a GPT table.  However, it does not have a valid fake msdos partition table, as it should.  Perhaps it was corrupted
-- possibly by a program that doesn't understand GPT partition tables.  Or perhaps you deleted the GPT table, and are now using an msdos partition table.  Is this a GPT partition
table?
Yes/No?                                                                   
Yes/No? n                                                                 
Model: ATA SanDisk SDSSDP12 (scsi)
Disk /dev/sde: 126GB
Sector size (logical/physical): 512B/512B
Partition Table: unknown
(parted) mklabel gpt                                                     
Backtrace has 13 calls on stack:
  13: /usr/lib64/libparted.so.1(ped_assert+0x31) [0x7fc1110a24e1]
  12: /usr/lib64/libparted.so.1(ped_geometry_read+0x80) [0x7fc1110a90a0]
  11: /usr/lib64/libparted.so.1(ped_geometry_read_alloc+0x54) [0x7fc1110a9364]
  10: /usr/lib64/libparted.so.1(nilfs2_probe+0x85) [0x7fc1110b18a5]
  9: /usr/lib64/libparted.so.1(ped_file_system_probe_specific+0x54) [0x7fc1110a3864]
  8: /usr/lib64/libparted.so.1(ped_file_system_probe+0x83) [0x7fc1110a3963]
  7: /usr/lib64/libparted.so.1(+0x25e7f) [0x7fc1110b9e7f]
  6: /usr/lib64/libparted.so.1(ped_disk_new+0x75) [0x7fc1110a8845]
  5: parted() [0x407844]
  4: parted(interactive_mode+0xf3) [0x40c493]
  3: parted(main+0xd8f) [0x408c6f]
  2: /lib64/libc.so.6(__libc_start_main+0xfd) [0x7fc1108990dd]
  1: parted() [0x405919]
Aborted
daw ~ #


Fun ahead... Is there a way to recover this?
_________________
Expert in non-working solutions
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum