Gentoo:磁盘分区

来自WHY42

本文记载win10与gentoo双系统分区。参考这里

环境准备

同时需要禁用掉快速启动。原因是:Without it, Windows' filesystems are not unmounted even when you're using Linux, so editing Windows files can result in data loss. Even if you do not intend to share filesystems, the EFI System Partition is likely to be damaged on an EFI system.

刻录SystemRescueCd并进入系统,开始分区。

Disk /dev/sdb: 223.6 GiB, 240057409536 bytes, 468862128 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
Disklabel type: gpt
Disk identifier: 19FC4662-CDC6-44A2-A78B-717085B89743

Device         Start       End   Sectors  Size Type
/dev/sdb1       2048    616447    614400  300M Windows recovery environment
/dev/sdb2     616448    821247    204800  100M EFI System
/dev/sdb3     821248   1083391    262144  128M Microsoft reserved
/dev/sdb4    1083392 168855551 167772160   80G Microsoft basic data
/dev/sdb5  168855552 378570751 209715200  100G Microsoft basic data

livecd ~ # gdisk /dev/sdb
GPT fdisk (gdisk) version 1.0.1                                               
                                                                               
Partition table scan:                                                           
  MBR: protective                                                                 
  BSD: not present                                                                 
  APM: not present                                                                  
  GPT: present                                                                       
                                                                                      
Found valid GPT with protective MBR; using GPT.                                        
                                                                                        
Command (? for help): p                                                                 
Disk /dev/sdb: 468862128 sectors, 223.6 GiB                                              
Logical sector size: 512 bytes                                                             
Disk identifier (GUID): 19FC4662-CDC6-44A2-A78B-717085B89743                                 
Partition table holds up to 128 entries                                                       
First usable sector is 34, last usable sector is 468862094                                     
Partitions will be aligned on 2048-sector boundaries                                           
Total free space is 90293357 sectors (43.1 GiB)                                                  
                                                                                                  
Number  Start (sector)    End (sector)  Size       Code  Name                                      
   1            2048          616447   300.0 MiB   2700  Basic data partition                        
   2          616448          821247   100.0 MiB   EF00  EFI system partition                         
   3          821248         1083391   128.0 MiB   0C01  Microsoft reserved ...                        
   4         1083392       168855551   80.0 GiB    0700  Basic data partition                            
   5       168855552       378570751   100.0 GiB   0700  Basic data partition   

磁盘分区

gdisk /dev/sdx
...
mkfs.ext2 /dev/sda1
mkfs.ext4 /dev/sda3
mkswap /dev/sda2
swapon /dev/sda2
Command (? for help): n                                                                                     
Partition number (6-128, default 6):                                                                         
First sector (34-468862094, default = 378570752) or {+-}size{KMGTP}:                                          
Last sector (378570752-468862094, default = 468862094) or {+-}size{KMGTP}: +100M                              
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300): 
Changed type of partition to 'Linux filesystem'

Command (? for help): n
Partition number (7-128, default 7): 
First sector (34-468862094, default = 378775552) or {+-}size{KMGTP}: 
Last sector (378775552-468862094, default = 468862094) or {+-}size{KMGTP}: +2G
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300): 8200
Changed type of partition to 'Linux swap'

Command (? for help): n
Partition number (8-128, default 8): 
First sector (34-468862094, default = 382969856) or {+-}size{KMGTP}: 
Last sector (382969856-468862094, default = 468862094) or {+-}size{KMGTP}: +10G
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300): 
Changed type of partition to 'Linux filesystem'

Command (? for help): n
Partition number (9-128, default 9): 
First sector (34-468862094, default = 403941376) or {+-}size{KMGTP}: 
Last sector (403941376-468862094, default = 468862094) or {+-}size{KMGTP}: 
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300): 
Changed type of partition to 'Linux filesystem'

Command (? for help): p
Disk /dev/sdb: 468862128 sectors, 223.6 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 19FC4662-CDC6-44A2-A78B-717085B89743
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 468862094
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          616447   300.0 MiB   2700  Basic data partition
   2          616448          821247   100.0 MiB   EF00  EFI system partition
   3          821248         1083391   128.0 MiB   0C01  Microsoft reserved ...
   4         1083392       168855551   80.0 GiB    0700  Basic data partition
   5       168855552       378570751   100.0 GiB   0700  Basic data partition
   6       378570752       378775551   100.0 MiB   8300  Linux filesystem
   7       378775552       382969855   2.0 GiB     8200  Linux swap
   8       382969856       403941375   10.0 GiB    8300  Linux filesystem
   9       403941376       468862094   31.0 GiB    8300  Linux filesystem

Command (? for help): w

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!

Do you want to proceed? (Y/N): y
OK; writing new GUID partition table (GPT) to /dev/sdb.
The operation has completed successfully.

挂载磁盘

mount /dev/sda3 /mnt/gentoo
mkdir /mnt/gentoo/boot
mount /dev/sda1 /mnt/gentoo/boot