MochiuWiki : SUSE, EC, PCB
案内
メインページ
最近の更新
おまかせ表示
MediaWiki についてのヘルプ
ツール
リンク元
関連ページの更新状況
特別ページ
ページ情報
We ask for
Donations
検索
個人用ツール
ログイン
Toggle dark mode
名前空間
ページ
議論
表示
閲覧
ソースを閲覧
履歴を表示
SSDからRaspbianを起動する方法のソースを表示
提供: MochiuWiki : SUSE, EC, PCB
←
SSDからRaspbianを起動する方法
あなたには「このページの編集」を行う権限がありません。理由は以下の通りです:
この操作は、次のグループのいずれかに属する利用者のみが実行できます:
管理者
、new-group。
このページのソースの閲覧やコピーができます。
== 概要 == <br><br> == SDカード必要 SSD起動ディスク化 == ===== デバイス名の確認 ===== 以下のコマンドを実行する。<br> sudo fdisk -l | grep /dev/sda --結果-- Device Boot Start End Sectors Size Id Type /dev/mmcblk0p1 2048 3656250 3654203 1.8G e W95 FAT16 (LBA) /dev/mmcblk0p2 3656251 123494399 119838149 57.1G 5 Extended /dev/mmcblk0p5 3661824 3727357 65534 32M 83 Linux /dev/mmcblk0p6 3727360 3868671 141312 69M c W95 FAT32 (LBA) /dev/mmcblk0p7 3874816 123494399 119619584 57G 83 Linux Disk /dev/sda: 111.8 GiB, 120034121728 bytes, 234441644 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x3d0e23d3 <br> ===== パーティションの作成 ===== SSDのパーティションを作成するため、以下のコマンドを実行する。<br> # パーティションテーブルの設定を行う sudo fdisk /dev/sda <br> 続いて、以下のように入力していく。<br> # d でパーティションを削除する Command (m for help): d Selected partition 1 Partition 1 has been deleted. # p で現在の状態を確認 Command (m for help): p Disk /dev/sda: 3.7 TiB, 4000787030016 bytes, 7814037168 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: F3BA4D9C-C2F7-43FF-837C-D3BFBFBF5C1D # n でパーティションを作成(何も入力しない場合は全てデフォルトとなる) Command (m for help): n Partition number (1-128, default 1): 1 First sector (34-7814037134, default 2048): 2048 Last sector, +sectors or +size{K,M,G,T,P} (2048-7814037134, default 7814037134): Created a new partition 1 of type 'Linux filesystem' and of size 3.7 TiB. # p で作成したパーティションを確認する Command (m for help): p Disk /dev/sda: 3.7 TiB, 4000787030016 bytes, 7814037168 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: F3BA4D9C-C2F7-43FF-837C-D3BFBFBF5C1D Device Start End Sectors Size Type /dev/sda1 2048 7814037134 7814035087 3.7T Linux filesystem # w で変更を書き込む Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks. <br> ===== 作成したパーティションの確認 ===== 上記で作成したパーティションを確認するため、以下のコマンドを実行する。<br> sudo fdisk -l --結果-- ...省略 Disk /dev/sda: 111.8 GiB, 120034121728 bytes, 234441644 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x2a6be21a Device Boot Start End Sectors Size Id Type /dev/sda1 2048 234441643 234439596 111.8G 83 Linux <br> lsblk --結果-- NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 111.8G 0 disk └─sda1 8:1 0 111.8G 0 part mmcblk0 179:0 0 58.9G 0 disk ├─mmcblk0p1 179:1 0 42.9M 0 part /boot └─mmcblk0p2 179:2 0 29.8G 0 part <br> ===== パーティションのフォーマット(ext4) ===== SSDに作成したパーティションをフォーマットするため、以下のコマンドを実行する。<br> sudo mkfs.ext4 /dev/sda1 mke2fs 1.43.4 (31-Jan-2017) Found a dos partition table in /dev/sda1 Proceed anyway? (y,N) y '''←"y"を入力''' Creating filesystem with 29305205 4k blocks and 7331840 inodes Filesystem UUID: bf3db726-f1fa-4a6c-a64b-fe48bbfa9a99 Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000, 7962624, 11239424, 20480000, 23887872 Allocating group tables: done Writing inode tables: done Creating journal (131072 blocks): done Writing superblocks and filesystem accounting information: done <br> ===== 自動マウントの設定 ===== /etc/fstabにSSDのPARTUUIDを登録することにより、起動時に自動マウントすることができる。<br> PARTUUIDを登録する理由は、SSDのフルパスが変更されてもマウントできるからである。<br> <br> まず、SSDのパーティションをアンマウントする。 sudo umount /dev/sda1 <br> 次に、マウントポイントを作成する。(ここでは、tmpディレクトリ内に作成する)<br> sudo mkdir /tmp/mmcrf /tmp/ssdrf sudo mount /dev/mmcblk0p2 /tmp/mmcrf ←Raspbian OSのルートディレクトリをマウント sudo mount /dev/sda1 /tmp/ssdrf <br> 上記で作成した/tmp/mmcrfから/tmp/ssdrfへtarコマンドを使用して全てコピーする。 cd /tmp/mmcrf sudo tar --backup -c * | sudo tar -C /tmp/ssdrf -xv <br> ディスクの調整を行う。<br> sudo umount /dev/sda1 sudo e2fsck -f /dev/sda1 <br> ブートファイルであるcmdline.txtを編集する。(cmdline.txtのバックアップを作成すること)<br> cmdline.txtの中にあるroot=/dev/mmcblk0p2をroot=PARTUUID=xxxxに変更する。<br> (PARTUUIDの値は、blkidコマンドを実行することで表示される)<br> sudo cp /boot/cmdline.txt /boot/cmdline.txt.org sudo nano /tmp/boot/cmdline.txt # 変更前 dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait # 変更後 dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=xxxxxxxx-xx rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait <br> fstabを編集して、PARTUUIDの値を変更する。<br> fstabの設定に誤りがある場合、再起動時にemergency modeで起動されるので、必ずfstabファイルのバックアップを取ること。<br> sudo cp /etc/fstab /etc/fstab.org sudo nano /etc/fstab # proc /proc proc defaults 0 0 PARTUUID=xxxxxxxx-xx / ext4 defaults,noatime 0 1 <br> Raspbian OSを再起動する。<br> sudo reboot <br><br> __FORCETOC__ [[カテゴリ:Raspberry_Pi]]
SSDからRaspbianを起動する方法
に戻る。
案内
メインページ
最近の更新
おまかせ表示
MediaWiki についてのヘルプ
ツール
リンク元
関連ページの更新状況
特別ページ
ページ情報
We ask for
Donations
Collapse