[RaspberryPi][Pidora] RaspberryPiにPidoraを導入してみた。

ARMPC、Gadget

RaspberryPiのディストリビューションでFedoraベースである、Pidoraに興味があったのでちょっと導入してみました。

最初、簡単に調べたところディスプレイ接続が必須のような感じで書かれていたのですが、どうやらheadlessモードもちゃんと用意されているようです。

Pidora-Headless-Mode - CDOT Wiki

/bootパーティションに「headless」というファイルを作成し、IP設定がDHCPの場合は空で、スタティックに設定する場合は以下の様な感じで記述すると良いようです。

IPADDR=192.168.1.105
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
RESIZE
SWAP=512

ただ、こちらで確認した限りでは、IP設定はうまくいったのですが、rootfsのリサイズと、スワップの作成はされていませんでした。

ということで、こちらについては改めて作業を実施する必要があります。

作業環境:

# cat /etc/redhat-release
Pidora 18 (Raspberry Pi Fedora Remix)

rootfsの拡張

1. rootfsの拡張
導入時は以下のようになっていると思います。

# df -h
Filesystem      Size  Used Avail Use% Mounted on
rootfs          1.6G  1.6G     0 100% /
/dev/root       1.6G  1.6G     0 100% /
devtmpfs        219M     0  219M   0% /dev
tmpfs           219M     0  219M   0% /dev/shm
tmpfs           219M  880K  218M   1% /run
tmpfs           219M     0  219M   0% /sys/fs/cgroup
tmpfs           219M   12K  219M   1% /tmp
/dev/mmcblk0p1   50M   18M   33M  35% /boot
302 Found

上記Webサイトを参考に作業を進める。

2. デバイスを確認する。

# ll /dev/mm*
brw-rw---- 1 root disk 179, 0 Jun 28 16:48 /dev/mmcblk0
brw-rw---- 1 root disk 179, 1 Jun 28 16:48 /dev/mmcblk0p1
brw-rw---- 1 root disk 179, 2 Jun 28 16:48 /dev/mmcblk0p2

3. fdiskを使用し、現状のパーティション構成を確認する。

# fdisk /dev/mmcblk0
Welcome to fdisk (util-linux 2.22.1).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p

Disk /dev/mmcblk0: 15.8 GB, 15811477504 bytes, 30881792 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
Disk identifier: 0x000622ba

Device Boot      Start         End      Blocks   Id  System
/dev/mmcblk0p1   *        2048      104447       51200    c  W95 FAT32 (LBA)
/dev/mmcblk0p2          104448     3494304     1694928+  83  Linux

Command (m for help): q

4. partedを使用し、パーティション構成を確認する。

# parted /dev/mmcblk0
GNU Parted 3.1
Using /dev/mmcblk0
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) unit chs
(parted) print
Model: SD NCard (sd/mmc)
Disk /dev/mmcblk0: 1922,77,10
Sector size (logical/physical): 512B/512B
BIOS cylinder,head,sector geometry: 1922,255,63.  Each cylinder is 8225kB.
Partition Table: msdos
Disk Flags:

Number  Start     End        Type     File system  Flags
1      0,32,32   6,127,56   primary  fat16        boot, lba
2      6,127,57  217,130,9  primary  ext4

5. 後方のパーティションを削除する。

(parted) rm 2
Error: Partition(s) 2 on /dev/mmcblk0 have been written, but we have been unable to inform
the kernel of the change, probably because it/they are in use.  As a result, the old
partition(s) will remain in use.  You should reboot now before making further changes.
Ignore/Cancel? i
(parted) print
Model: SD NCard (sd/mmc)
Disk /dev/mmcblk0: 1922,77,10
Sector size (logical/physical): 512B/512B
BIOS cylinder,head,sector geometry: 1922,255,63.  Each cylinder is 8225kB.
Partition Table: msdos
Disk Flags:

Number  Start    End       Type     File system  Flags
1      0,32,32  6,127,56  primary  fat16        boot, lba

6. 改めてパーティションを作成する。

(parted) mkpart primary 6,127,57 1922,77,10
Error: Partition(s) 2 on /dev/mmcblk0 have been written, but we have been unable to inform
the kernel of the change, probably because it/they are in use.  As a result, the old
partition(s) will remain in use.  You should reboot now before making further changes.
Ignore/Cancel? i
(parted) print
Model: SD NCard (sd/mmc)
Disk /dev/mmcblk0: 1922,77,10
Sector size (logical/physical): 512B/512B
BIOS cylinder,head,sector geometry: 1922,255,63.  Each cylinder is 8225kB.
Partition Table: msdos
Disk Flags:

Number  Start     End         Type     File system  Flags
1      0,32,32   6,127,56    primary  fat16        boot, lba
2      6,127,57  1922,77,10  primary  ext4

(parted) quit

7. 再起動を実施する。

8. 新しいパーティション構成を確認する。

# fdisk /dev/mmcblk0
Welcome to fdisk (util-linux 2.22.1).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p

Disk /dev/mmcblk0: 15.8 GB, 15811477504 bytes, 30881792 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
Disk identifier: 0x000622ba

Device Boot      Start         End      Blocks   Id  System
/dev/mmcblk0p1   *        2048      104447       51200    c  W95 FAT32 (LBA)
/dev/mmcblk0p2          104448    30881791    15388672   83  Linux

Command (m for help): quit

9. rootfsを拡張する。

# resize2fs /dev/mmcblk0p2
resize2fs 1.42.3 (14-May-2012)
Filesystem at /dev/mmcblk0p2 is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 1
The filesystem on /dev/mmcblk0p2 is now 3847168 blocks long.

10. ファイルシステムをチェックする。

# e2fsck -f /dev/mmcblk0p2
e2fsck 1.42.3 (14-May-2012)
/dev/mmcblk0p2 is mounted.


WARNING!!!  The filesystem is mounted.   If you continue you ***WILL***
cause ***SEVERE*** filesystem damage.


Do you really want to continue? yes
rootfs: recovering journal
esPass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Free blocks count wrong (3387572, counted=3387558).
Fix? yes

rootfs: ***** FILE SYSTEM WAS MODIFIED *****
rootfs: ***** REBOOT LINUX *****
rootfs: 63741/944000 files (0.1% non-contiguous), 459610/3847168 blocks

11. 認識される容量が拡張されていることを確認する。

# df -h
Filesystem      Size  Used Avail Use% Mounted on
rootfs           15G  1.6G   13G  12% /
/dev/root        15G  1.6G   13G  12% /
devtmpfs        219M     0  219M   0% /dev
tmpfs           219M     0  219M   0% /dev/shm
tmpfs           219M  796K  218M   1% /run
tmpfs           219M     0  219M   0% /sys/fs/cgroup
tmpfs           219M  4.0K  219M   1% /tmp
/dev/mmcblk0p1   50M   18M   33M  35% /boot

また、このままではスワップ領域も作成されていないので、必要に応じて作成します。

swapの拡張

1. スワップ領域となるファイルを作成する。

# dd if=/dev/zero of=/swap bs=1024 count=512000
512000+0 records in
512000+0 records out
524288000 bytes (524 MB) copied, 59.3611 s, 8.8 MB/s

2. スワップファイルを初期化する。

# mkswap /swap
Setting up swapspace version 1, size = 511996 KiB
no label, UUID=04fca2b4-543f-43e8-b454-0e7e5a759e0c

3. swaponコマンドで、スワップ領域を有効化する。

# swapon /swap
# cat /proc/swaps
Filename                                Type            Size    Used    Priority
/swap                                   file            511996  0       -1

4. ブート時からスワップ領域が有効になるよう、/etc/fstabを編集する。

LABEL="swap"            /swap                   swap    swap    defaults        0 0

あとは、時刻設定も日本時間ではないのでJSTに変更します。

# date
Fri Jun 28 17:48:56 EDT 2013
# cp /usr/share/zoneinfo/Japan /etc/localtime
cp: overwrite ‘/etc/localtime’? y
# date
Sat Jun 29 06:53:18 JST 2013

以上で、初期設定は終了だと思います。

この記事を書いた人

kometchtech

うつ病を患いながら、IT業界の末席にいるおっさんエンジニア。科学計算をしたことがないのに、HPC分野にお邪魔している。興味のある分野で学習したことをblogにまとめつつ、うつ病の経過症状のメモも置いておく日々。じつはRouterboard User Group JPの中の人でもある。 Amazon欲しいものリスト / Arm板を恵んでくれる人募集中

kometchtechをフォローする
タイトルとURLをコピーしました