Note

The Funtoo Linux project has transitioned to "Hobby Mode" and this wiki is now read-only.

Difference between revisions of "Partitioning using gdisk"

From Funtoo
Jump to navigation Jump to search
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:


===== Notes Before We Begin =====
== Notes Before We Begin ==


These install instructions assume you are installing Funtoo Linux to an empty hard disk using GUID partition tables (GPT). If you are installing Funtoo Linux on a machine where another OS is installed, or there is an existing Linux distribution on your system that you want to keep, then you will need to adapt these instructions to suit your needs.
These install instructions assume you are installing Funtoo Linux to an empty hard disk using GUID partition tables (GPT). If you are installing Funtoo Linux on a machine where another OS is installed, or there is an existing Linux distribution on your system that you want to keep, then you will need to adapt these instructions to suit your needs.


===== Using gdisk =====
== Using gdisk ==


The first step after booting SystemRescueCd is to use <tt>gdisk</tt> to create GPT (also known as GUID) partitions, specifying the disk you want to use, which is typically <tt>/dev/sda</tt>, the first disk in the system:
The first step after booting SystemRescueCd is to use <tt>gdisk</tt> to create GPT (also known as GUID) partitions, specifying the disk you want to use, which is typically <tt>/dev/sda</tt>, the first disk in the system:
Line 30: Line 30:
Above, you'll see that we have a 500 MiB boot partition, a 32 MiB "BIOS boot partition" (also known as the GRUB boot loader partition), 4 GiB of swap, and the remaining disk used by a 107.7 GiB root partition.
Above, you'll see that we have a 500 MiB boot partition, a 32 MiB "BIOS boot partition" (also known as the GRUB boot loader partition), 4 GiB of swap, and the remaining disk used by a 107.7 GiB root partition.


===== For new <tt>gdisk</tt> users =====
== For new <tt>gdisk</tt> users ==


These partitions were created using the "<tt>n</tt>" command from within <tt>gdisk</tt>. The <tt>gdisk</tt> commands to create the partition table above are as follows. Adapt sizes as necessary, although these defaults will work for most users. The partition codes entered below can be found in the [[#Partitioning Recommendations|Partitioning Recommendations]] table below, in the GPT Code column.
These partitions were created using the "<tt>n</tt>" command from within <tt>gdisk</tt>. The <tt>gdisk</tt> commands to create the partition table above are as follows. Adapt sizes as necessary, although these defaults will work for most users. The partition codes entered below can be found in the [[#Partitioning Recommendations|Partitioning Recommendations]] table below, in the GPT Code column.
Line 36: Line 36:
Within <tt>gdisk</tt>, follow these steps:
Within <tt>gdisk</tt>, follow these steps:


'''Create a new empty partition table''' (This ''will'' erase all data on the disk when saved):
'''Create a new empty partition table'''
{{fancywarning|This will '''erase all data''' on the disk when saved!}}


<console>
<console>
Line 60: Line 61:
Partition Number: ##i##2 ↵
Partition Number: ##i##2 ↵
First sector: ##i##↵
First sector: ##i##↵
Last sector: ##i##+1M
Last sector: ##i##+32M
Hex Code: ##i##EF02 ↵
Hex Code: ##i##EF02 ↵
</console>
</console>
Line 102: Line 103:
* <tt>/dev/sda4</tt>, which will hold your root filesystem.
* <tt>/dev/sda4</tt>, which will hold your root filesystem.


===== All Done! =====
== All Done! ==


Now, you can return to the main [[Funtoo Linux Installation]] instructions. Please note that your root filesystem is on <code>/dev/sda4</code>, and your swap partition is <code>/dev/sda3</code>. You will need to adjust your <code>/etc/fstab</code> accordingly when you edit it.
Now, you can return to the main [[Funtoo Linux Installation]] instructions. Please note that your root filesystem is on <code>/dev/sda4</code>, and your swap partition is <code>/dev/sda3</code>. You will need to adjust your <code>/etc/fstab</code> accordingly when you edit it.

Latest revision as of 19:33, July 25, 2015

Notes Before We Begin

These install instructions assume you are installing Funtoo Linux to an empty hard disk using GUID partition tables (GPT). If you are installing Funtoo Linux on a machine where another OS is installed, or there is an existing Linux distribution on your system that you want to keep, then you will need to adapt these instructions to suit your needs.

Using gdisk

The first step after booting SystemRescueCd is to use gdisk to create GPT (also known as GUID) partitions, specifying the disk you want to use, which is typically /dev/sda, the first disk in the system:

root # gdisk /dev/sda

You should find gdisk very similar to fdisk. Here is the partition table we want to end up with:

Command (? for help): p
Disk /dev/sda: 234441648 sectors, 111.8 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): A4E5208A-CED3-4263-BB25-7147DC426931
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 234441614
Partitions will be aligned on 2048-sector boundaries
Total free space is 2014 sectors (1007.0 KiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048          206847   500.0 MiB   8300  Linux filesystem
   2          206848          272383   32.0 MiB    EF02  BIOS boot partition
   3          272384         8660991   4.0 GiB     8200  Linux swap
   4         8660992       234441614   107.7 GiB   8300  Linux filesystem

Command (? for help): 

Above, you'll see that we have a 500 MiB boot partition, a 32 MiB "BIOS boot partition" (also known as the GRUB boot loader partition), 4 GiB of swap, and the remaining disk used by a 107.7 GiB root partition.

For new gdisk users

These partitions were created using the "n" command from within gdisk. The gdisk commands to create the partition table above are as follows. Adapt sizes as necessary, although these defaults will work for most users. The partition codes entered below can be found in the Partitioning Recommendations table below, in the GPT Code column.

Within gdisk, follow these steps:

Create a new empty partition table

   Warning

This will erase all data on the disk when saved!

Command: o ↵
This option deletes all partitions and creates a new protective MBR.
Proceed? (Y/N): y ↵

Create Partition 1 (boot):

Command: n ↵
Partition Number: 1 ↵
First sector: 
Last sector: +500M ↵
Hex Code: 

Create Partition 2 (GRUB):

Command: n ↵
Partition Number: 2 ↵
First sector: 
Last sector: +32M ↵
Hex Code: EF02 ↵

Create Partition 3 (swap):

Command: n ↵
Partition Number: 3 ↵
First sector: 
Last sector: +4G ↵
Hex Code: 8200 ↵

Create Partition 4 (root):

Command: n ↵
Partition Number: 4 ↵
First sector: 
Last sector:  (for rest of disk)
Hex Code: 

Along the way, you can type "p" and hit Enter to view your current partition table. If you make a mistake, you can type "d" to delete an existing partition that you created. When you are satisfied with your partition setup, type "w" to write your configuration to disk:

Write Partition Table To Disk:

Command: w ↵
Do you want to proceed? (Y/N): Y ↵

The partition table will now be written to disk and gdisk will close.

Now, your GPT/GUID partitions have been created, and will show up as the following block devices under Linux:

  • /dev/sda1, which will be used to hold the /boot filesystem,
  • /dev/sda2, which will be used directly by the new GRUB,
  • /dev/sda3, which will be used for swap space, and
  • /dev/sda4, which will hold your root filesystem.

All Done!

Now, you can return to the main Funtoo Linux Installation instructions. Please note that your root filesystem is on /dev/sda4, and your swap partition is /dev/sda3. You will need to adjust your /etc/fstab accordingly when you edit it.