Results 1 to 10 of 10

Thread: Linux command to create aligned partitions

  1. #1
    Join Date
    Jan 2010
    Location
    New Jersey, USA
    Posts
    82

    Default Linux command to create aligned partitions

    Thanks in advance
    When I build a dual boot laptop I have used the Windows DISKPART command
    create partition primary align=1024 size =250000

    I create as many partitions as I want for \windows \boot \swap \OpenSUSE (etc)
    I would prefer to do this with a Linux command from the install DVD
    This is my goal and I would like to do this using Linux commands
    I will be hand-installing Windows-10 using legacy MBR from licensed Microsoft DVD

    DISKPART commands from Windows-10 install DVD for 1TB blank Hard Drive

    create partition primary align=1024 size =400 \boot
    create partition primary align=1024 size =250000
    \windows-10
    create partition primary align=1024 size =150000
    \ (for OpenSUSE)
    create partition extended
    create partition logical align=1024 size =8000 \swap
    create partition logical align=1024 size =300000
    \ntfs
    create partition logical align=1024 (remainder of disk)
    \Fat32

  2. #2
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    28,426

    Default Re: Linux command to create aligned partitions

    I do not know much about Windows, but you better do not use a Windows partitioner to prepare partitions for your openSUSE installation. You better do not use ANY partition preparation. Just provide unpartitioned free space. The installer will find the free, unpartitioned space and offer you a partitioning. You can then alter that partitioning if you want.

    BTW in Linux (and thus openSUSE) there is no " \windows \boot \swap \OpenSUSE".
    You will probably offered a partition for /, for swap, maybe for /boot and, when EFI boot, for /efi.
    Henk van Velden

  3. #3
    Join Date
    Sep 2014
    Location
    Germany
    Posts
    714

    Default Re: Linux command to create aligned partitions

    Quote Originally Posted by qawtbh View Post
    ... I would prefer to do this with a Linux command from the install DVD
    This is my goal and I would like to do this using Linux commands
    I will be hand-installing Windows-10 using legacy MBR from licensed Microsoft DVD
    The tools you are looking for are gdisk or fdisk. Both will allow you to create partitions on a disk. When you boot the Rescue System from the installation DVD both tools should be available.

    However as Henk already told you it's probably better to let the openSUSE installation routine do all this for you.

    Here just a few hints if you really want to do all this manually:

    • Do not mix boot modes; i.e. do NOT install MS Windows in MBR boot mode and openSUSE in UEFI boot mode (or vice versa). Always use the same boot mode for both OS.
    • If your hardware is capable of UEFI-booting then use UEFI-booting instead of MBR-booting.
    • If you want to install MS Windows in UEFI boot mode you have to use (as far as i know) a GPT partition schema on your disk.
    • If you have a GPT partition schema on your disk and want to do MBR-booting then GRUB2 needs a small separat BIOS-Boot-Partition.
    • gdisk is (from my point of view) the better tool to create a GPT partition schema.
    • gdisk will only create partitions. You will have to create file systems on those partions.


    Regards

    susejunky

  4. #4
    Join Date
    Jan 2014
    Location
    Erlangen
    Posts
    2,489
    Blog Entries
    1

    Default Re: Linux command to create aligned partitions

    Quote Originally Posted by qawtbh View Post
    When I build a dual boot laptop I have used the Windows DISKPART command
    create partition primary align=1024 size =250000
    When I built a dual boot system with a brand new SSD (no file systems, no partitions) I first installed Tumbleweed from the iso. Then I installed Windows 10 from their iso. Then I booted into Tumbleweed from the UEFI boot menu and installed the bootloader. That's all. No additional commands necessary: https://forums.opensuse.org/showthre...ws-10-for-Free
    AMD Athlon 4850e (2009), openSUSE 13.1, KDE 4, Intel i3-4130 (2014), i7-6700K (2016), i5-8250U (2018), AMD Ryzen 5 3400G (2020), openSUSE Tumbleweed, KDE Plasma 5

  5. #5
    Join Date
    Dec 2008
    Location
    FL, USA
    Posts
    2,812
    Blog Entries
    1

    Default Re: Linux command to create aligned partitions

    If your heart's set on creating all partitions prior to beginning any actual installation, you can start the openSUSE installer, and upon reaching the licensing screen, key-in Ctrl-Alt-F2 to reach a shell prompt from which you can run fdisk, parted or cfdisk. Once partitioning matches your desires, you can switch back to the GUI (Alt-F7) and proceed to install, or reboot to install Windows first.

    For over two decades I have been creating all needed partitions prior to beginning any installation, but not with Windows, and not with any FOSS tool. Instead I use a non-free tool that ships with binaries included for DOS, Linux, MacOS, OS/2 and Windows. All use the same (text mode) interface, and produce the same compatible partitioning regardless of binary used. It's website is dfsee.com. It produces logs I use for disk and partition inventory management, and makes it unnecessary to take any extended partition on MBR disks into account, automatically sizing it to accommodate all desired logical partitions.

    If you want to partition in advance for free and don't have a Linux installation already done, or a live Linux media to boot that has partitioning software on it, Gparted it probably the best way to go. It works essentially the same whether from an existing Linux installation or live boot, or from media to which its own downloadable .iso has been installed.
    Reg. Linux User #211409 *** multibooting since 1992
    Primary: 15.2, +TW, 15.1, 15.0 & 13.1 on Haswell
    Secondary: eComStation (OS/2) &15.1 on i965P w/ Radeon
    Tertiary: Mageia,Fedora,Debian,more on Kaby Lake,iQ45,iQ43,iG41,iG3X,i965G,AMD,NVidia&&&&&

  6. #6
    Join Date
    Jan 2010
    Location
    New Jersey, USA
    Posts
    82

    Default Re: Linux command to create aligned partitions

    Quote Originally Posted by mrmazda View Post
    If your heart's set on creating all partitions prior to beginning any actual installation, you can start the openSUSE installer, and upon reaching the licensing screen, key-in Ctrl-Alt-F2 to reach a shell prompt from which you can run fdisk, parted or cfdisk. Once partitioning matches your desires, you can switch back to the GUI (Alt-F7) and proceed to install, or reboot to install Windows first.

    For over two decades I have been creating all needed partitions prior to beginning any installation, but not with Windows, and not with any FOSS tool. Instead I use a non-free tool that ships with binaries included for DOS, Linux, MacOS, OS/2 and Windows. All use the same (text mode) interface, and produce the same compatible partitioning regardless of binary used. It's website is dfsee.com. It produces logs I use for disk and partition inventory management, and makes it unnecessary to take any extended partition on MBR disks into account, automatically sizing it to accommodate all desired logical partitions.

    If you want to partition in advance for free and don't have a Linux installation already done, or a live Linux media to boot that has partitioning software on it, Gparted it probably the best way to go. It works essentially the same whether from an existing Linux installation or live boot, or from media to which its own downloadable .iso has been installed.
    Can you give example commands below to create partitions with your favorite Linux tool.
    You pick the sizes, but use megabytes please.


    Create partition primary aligned properly (in Megabytes please)
    Create partition primary aligned properly (in Megabytes please)
    Create partition primary aligned properly (in Megabytes please)
    Create partition extended aligned properly (default is rest of disk)
    Create partition logical aligned properly (in Megabytes please)
    Create partition logical aligned properly (in Megabytes please)

  7. #7
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    13,285
    Blog Entries
    2

    Default Re: Linux command to create aligned partitions

    If you use a current, fully updated Windows 10 to partition your disk, you should be OK...
    Today's Win10 no longer adds a couple bytes to the beginning of each partition so your partitions should be compatible with Linux and other *NIX usage.

    That said, although the partitions should be OK, I always recommend that formatting should be done by whatever OS will natively run or access the partition.

    TSU
    Beginner Wiki Quickstart - https://en.opensuse.org/User:Tsu2/Quickstart_Wiki
    Solved a problem recently? Create a wiki page for future personal reference!
    Learn something new?
    Attended a computing event?
    Post and Share!

  8. #8
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    28,426

    Default Re: Linux command to create aligned partitions

    Quote Originally Posted by tsu2 View Post
    If you use a current, fully updated Windows 10 to partition your disk, you should be OK...
    Today's Win10 no longer adds a couple bytes to the beginning of each partition so your partitions should be compatible with Linux and other *NIX usage.

    That said, although the partitions should be OK, I always recommend that formatting should be done by whatever OS will natively run or access the partition.

    TSU
    I am not sure though that Windows will set the partition types correct (for the partitions that the OP wants to pre-create for Linux). Or, if you can do that from Windows, if the OP knows what to set them to.

    In fact I am not sure why the OP stubborn stresses that he wants to pre-create partitions and special not why he stresses all the time that they should be "properly aligned". I guess most of us have no idea why the OP wants to make everything so difficult (and requiring good knowledge about partition tables, etc) where openSUSE has one of the best installers, made to help newbies with the rather intricate job of creating a partition table, making file systems, making mount points, making fstab entries with all the fine details.

    And to the OP.
    The (CLI) tool I would use to create a MBR partition table to my liking is fdisk. The statement is:
    Code:
    fdisk /dev/sd.
    where you must replace the . with the letter belonging to the disk you want to use.
    Now fdisk is an interactive tool with one-letter commands. So from that point on you must use those commands. Like
    Code:
    o
    n
    ...
    ...
    ...
    w
    But first study
    Code:
    man fdisk
    And during your fdisk session you can use the command
    Code:
    m
    to refresh your knowledge about which commands exist.


    PS.
    I might be wrong, but I have a strong impression that you forgot the general advice "to forget all you have learned using MS Windows and start new learning about computers when you use Linux".
    Last edited by hcvv; 26-Oct-2020 at 08:30.
    Henk van Velden

  9. #9

    Default Re: Linux command to create aligned partitions

    Laptop with spinning rust HDD?
    Ordinary you cannot use MBR with NVMe.
    Use M$ installer to create partitions.

  10. #10
    Join Date
    Dec 2008
    Location
    FL, USA
    Posts
    2,812
    Blog Entries
    1

    Default Re: Linux command to create aligned partitions

    Quote Originally Posted by qawtbh View Post
    Can you give example commands below to create partitions with your favorite Linux tool.
    You pick the sizes, but use megabytes please.
    1. Create partition primary aligned properly (in Megabytes please)
    2. Create partition primary aligned properly (in Megabytes please)
    3. Create partition primary aligned properly (in Megabytes please)
    4. Create partition extended aligned properly (default is rest of disk)
    5. Create partition logical aligned properly (in Megabytes please)
    6. Create partition logical aligned properly (in Megabytes please)
    If you wish non-aligned partitions you have to specify a variance, something I've never investigated, and may not be possible unless using a non-standard "geometry" (not using the modern standard 64 heads & 32 sectors). The app defaults to the ancient 255 heads & 63 sectors "geometry" convention for disks with no partition table.

    AFAIK, the only way to get a size in megabytes is to first convert to mebibytes and then specify the converted number. Using the create menu, I see no option to select sizing units. The tabled result sizes are always stated in MiB when I use it. This is not a subject I've ever investigated, so I could well be wrong.

    Assuming you do not wish to do the work using its menu system, the target is the second disk in the system (change disk number appropriately if not), and the target disk has no existing partition table, this is the command line template:

    0a: disk 2
    0b: geo ? 64 32
    1: cr pri linux 400 -a:1,c -f:#
    2: cr pri ntfs 250000 -f:#
    3: cr pri linux 150000 -f:#
    4: N/A
    5: cr log swap 8400 -f:#
    6: cr log fat32 -f:#

    For -f:#, substitute for # the number in the table column 1 shown by the last action that identifies the freespace in which to create new partition. If there is no freespace on disk 1, then -f:# can be omitted. It also can be omitted if the target is the first available freespace of adequate size.

    -a:1,c above means start the partition at the first sector of the second "cylinder" (cylinder 1, starting from 0), which with standard 64 head 32 sectors per track "geometry" causes proper alignment with 4k internal sector size when applicable, leaving Grub ample room to install on the first "cylinder", same as any of the current FOSS partitioning tools.

    linux above equates to 0x83 (aka LinuxNative), which may be used instead.
    ntfs above equates to 0x07, which may be used instead.
    swap above equates to 0x82, which may be used instead.
    what fat32 will equate to depends on size and location on disk, but typically 0x0B or 0x0C.
    Reg. Linux User #211409 *** multibooting since 1992
    Primary: 15.2, +TW, 15.1, 15.0 & 13.1 on Haswell
    Secondary: eComStation (OS/2) &15.1 on i965P w/ Radeon
    Tertiary: Mageia,Fedora,Debian,more on Kaby Lake,iQ45,iQ43,iG41,iG3X,i965G,AMD,NVidia&&&&&

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •