コンピュータのディレクトリ

パーティションのフォーマットとディレクトリマッピング

ページ作成日 2016/5/4
ページ更新日 2022/9/27

setup起動

setupと打ち込んでEnterキーを押して、Slackwareのインストールプログラムを起動させます。


root@slackware:/# setup

スワップの組み込み・アクティブ化

Slackware Linux Setupのメニューが表示されます。
まず最初に、Swap領域を組み込みます。
矢印キー(↓)でADDSWAPを選択しEnterキーを押します。

Slackware Linux Setup (version 15.0)
Welcome to Slackware Linux Setup.
Select an option below using the UP/DOWN keys and SPACE or ENTER.
Alternate keys may also be used: '+', '-', and TAB.
   HELP       Read the Slcakware Setup HELP file
   KEYMAP     Remap your keyboard if you're not using a US one
   ADDSWAP    Set up your swap partition(s)
   TARGET     Set up your target partitions
   SOURCE     Select source media
   SELECT     Select categories of software to install
   INSTALL    Install selected software
   CONFIGURE  Reconfigure your Linux system
   EXIT       Exit Slackware Linux Setup
<  OK  >            <Cancel>

すると、次のような画面が表示されて、無事にGPTで作成したスワップ用パーティションが認識されます。

SWAP SPACE DETECTED
Slackware Setup has detected one or more swap partitions
on your system. These partitions have been preselected to
be set up as swap space. If there are any swap partitions
that you do not wish to use with this installation,
please unselect them with the up and down arrows and
spacebar. If you wish to use all of them (this is
recommended), simply hit the ENTER key.
      [*] /dev/nvme0n1p2  Linux swap partition, 72GB
<  OK  >          <Cancel>

次に、スワップパーティションのバッドブロックのチェックをするかどうかを訊いてきます。
昨今のHDDは、自己診断機能を持っているので、デフォルトはNoだという説明が書いてあります。
ですので、そのままNoで良いです。

CHECK PARTITION FOR BAD BLOCKS?
Slackware Setup will now your system's swap
space.  When formatting swap partitions with mkswap you
may also check them for bad blocks.  This is not the
default since nearly all modern hard drives check
themselves for bad blocks anyway.  Would you like to
check for bad blocks while running mkswap?
< Yes >         < No  >

Swapのパーティションをフォーマットした後、Swap領域としてmountされます。
OKを押して、次へ進みます。

SWAP SPACE CONFIGURED
Your swapspace has been configured. This information will
be added to your /etc/fstab:

/dev/nvme0n1p2   swap             swap        defaults         0  0


<  OK  >

パーティションのフォーマットとマッピング

/(ルート)をどのパーティションに割り当てるかを決めます。
パーティショニング設計で、/dev/sda3を/(ルート)に割り当てると決めてあるので、このままEnterキーを押します。

Select Linux installation partition:
Please select a partition from the following list to use for your
root (/) Linux partition.
    /dev/nvme0n1p3  Linux 860G                                   
    ---             (done adding partitions, continue with setup)
    ---             (done adding partitions, continue with setup)
    ---             (done adding partitions, continue with setup)
    ---             (done adding partitions, continue with setup)
<Select>            <Continue>

次に、フォーマットとBad Blockのチェックについて選択を求められます。

Format
クイックフォーマットを行い、Bad Blockチェックは行いません
Check
スローフォーマットを行い、Bad Blockの有無をチェックします。
No
フォーマットもBad Blockのチェックも行いません。

通常であれば、Formatで十分です。
しかし、古いHDDを使用しているのであれば、Checkを選択した方がいいかもしれません。

FORMAT PARTITION /dev/nvme0n1p3
If this partition has not been formatted, you should format it.
NOTE: This will erase all data on it. Would you like to format
this partition?
         Format  Quick format with no bad block checking        
         Check   Slow format that checks for bad blocks
         No      No, do not format this partition
<  OK  >          <Cancel>

Formatを選んだ場合に、どのファイルシステムでフォーマットするかを選択します。
デフォルトでは、ext4が選ばれています。

それぞれのファイルシステムで強みと弱みがあります。
SSDやM.2を使っているなら、NAND型フラッシュメモリに最適化されたf2fsが良いでしょう。

SELECT FILESYSTEM FOR /dev/nvme0n1p3
Please select the type of filesystem to use for the specified device. Here
are descriptions of the available filesystem: Ext2 is the traditional
Linux file system and is fast and stable. Ext3 is the journaling version
of the Ext2 filesystem. Ext4 is the successor to the ext3 filesystem.
Btrfs is a B-tree copy-on-write filesystem. F2FS is a Flash-Friendly File
System. JFS is IBM's Journaled Filesystem, currently used in IBM
enterprise servers. ReiserFS is a jouranling filesystem that stores all
files and filename in a balanced tree structure. XFS is SGI's journaling
filesystem that originated on IRIX.
    ext2      Standard Linux Ext2 Filesystem           
    ext3      Ext3 Journaling Filesystem           
    ext4      Ext4 Journaling Filesystem
    jfs       IBM's Journaling Filesystem                          
    reiserfs  ReiserFS Journaling Filesystem           
    btrfs     Btrfs Copy-onWrite B-tree Filesystem           
    f2fs      Flash-Friendly File System
    xfs       SGI's Journaling Filesystem           
<  OK  >         <Cancel>

フォーマットが終わると、/etc/fstabにどのように記載されたのかが表示されるので、ENTERキーを押して、次に進みます。

DONE ADDING LINUX PARTITONS TO /etc/fstab
Adding this information to your /etc/fstab:
                                                                   
/dev/nvme0n1p3        /                f2fs         defaults         1  1
<  OK  >

複数のストレージを搭載している場合

複数のストレージがPCに搭載されている場合、フォーマットが終了すると、他のストレージのパーティションをどのディレクトリにマッピングしてマウントするか訊かれます。
「/はSSDやM.2にして、/homeはHDDを使って、大容量を確保したい」なんて使い方をされている方もいるでしょう。

HDDを搭載していて、それが/dev/sdb1というシステムファイルで認識されている場合に、それを/homeにマッピングする例を記載します。
矢印キー(↑↓)で/dev/sdb1を選択し、Enterキーを押します。
その後、/dev/nvme0n1p3と同じようにフォーマットするかどうか、またどのファイルシステムにするかを選びます。

Select other Linux partitions for /etc/fstab
You seem to have more than one partition tagged as type Linux.
You may use these to distribute your Linux system across more than
one partition.  Currently, you have /dev/hda5 mounted as your /
partition.  You might want to mount directories such as /home or 
/usr/local on separate partitions.  You should not try to mount
/etc, /sbin, or /bin on their own partitions since they contain
utilities needed to bring the system up and mount partitions.
Also, do not reuse a partition that you've already entered before. 
Please select one of the Linux partitions listed below, or if
you're done, hit <Continue>.
    (IN USE)   /dev/nvme0n1p3 on / Linux 860G
    /dev/sdb1  Linux 2.8T
    ---        (done adding partitions, continue with setup)      
    ---        (done adding partitions, continue with setup)
<Select>           <Continue>

選択したパーティションをどこのディレクトリとしてマウントするかを入力します。
ここでは、/homeと入力します。

SELECT MOUNT POINT FOR /dev/sdb1
OK, now you need to specify where you want the new
partition mounted.  For example, if you want to put it 
under /usr/local, then respond:  /usr/local
Where would you like to mount /dev/sdb1?
_                                                     
<  OK  >       <Cancel>

フォーマットするファイルシステムの選択→マウントするパーティションの選択→マウントポイントのディレクトリの指定を繰り返して、全てのパーティションをマッピングします。
すると、下記のようにどのパーティションをどのディレクトリにマッピングしてマウントしたか一覧が表示されます。

Enterキーを押して次へ進みます。

DONE ADDING LINUX PARTITONS TO /etc/fstab
Adding this information to your /etc/fstab:
                                                                   
/dev/nvme0n1p3        /                f2fs         defaults         1  1
/dev/sdb1             /home            xfs          defaults         1  2
<  OK  >

USBメモリからインストールしている場合には、それが検出されてしまうので、Noを次に、EFIパーティションがフォーマットされていないのでフォーマットするか?と訊かれます。

FORMAT EFI PARTITON /dev/nvme0n1p3?
An EFI System Partition was found on /dev/nvme0n1p3,
but it has not yet been formatted. Would you like to
format this partition?
< Yes >         < No  >

YESを選択した状態で、ENTERキーを押して、フォーマットします。
EFIパーティションは、FAT32でフォーマットされます。
フォーマットが終わると、/etc/fstabに情報を追加した旨の通知が表示されますので、Enterキーを押して次へと進みます。

EFI SYSTEM PARTITON RECOGNIZED
Adding this information to your /etc/fstab:
                                                                   
/dev/nvme0n1p3   /boot/efi        vfat        defaults         1  0


<  OK  >

USBメモリからインストールしている場合には、パーティションがFAT32でフォーマットしているため、それを/etc/fstabに含めるか訊かれます。
Noを選んでENTERキーを押して、登録を回避します。

FAT or NTFS PARTITON DETECTED
Partitions of type FAT or NTFS (commonly used by DOS and Windows)
have been found on your system. Would you like to add these
partition to your /etc/fstab so that these partitions are visible
from Linux?
< Yes >            < No  >

次は、パッケージの選択とインストールに進みます。