LoginSignup
2
1

More than 5 years have passed since last update.

NanoPi NEO のbootパーティションをFAT32にしてみる

Last updated at Posted at 2016-11-14

NanoPiの公式イメージはどういうわけかbootパーティションがEXT4。

root@LATITUDE:~/Downloads/fuse-ext2-0.0.7# fdisk -l
・
・
・
Disk /dev/mmcblk0: 7.4 GiB, 7948206080 bytes, 15523840 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: 0x00000000

デバイス       起動  Start 最後から セクタ  Size Id タイプ
/dev/mmcblk0p1       49152   131071   81920   40M 83 Linux
/dev/mmcblk0p2      131072  7617185 7486114  3.6G 83 Linux

Raspberry PiはbootパーティションがFAT32なので、WindowsでもMacでも読み書きできる。そうした方が便利になるかも・・・ということでbootパーティションをFAT32に変更してみました。

bootパーティションに入っているのは2つのファイルのみ。

root@LATITUDE:/media/nanbuwks/boot# ls -alh
合計 4.4M
drwxr-xr-x  2 nanbuwks nanbuwks  16K  1月  1  1970 .
drwxr-x---+ 4 root     root     4.0K 11月 14 20:46 ..
-rw-r--r--  1 nanbuwks nanbuwks  34K  8月  5 02:13 script.bin
-rw-r--r--  1 nanbuwks nanbuwks 4.4M  8月  5 02:13 uImage

もうひとつのパーティションにbootディレクトリがあるが、空っぽです。

root@LATITUDE:~/Downloads/fuse-ext2-0.0.7# ls /media/nanbuwks/
boot/                             rootfs/
root@LATITUDE:~/Downloads/fuse-ext2-0.0.7# ls /media/nanbuwks/rootfs/
Settings  boot  etc   lib         media  opt   root  sbin  sys  usr
bin       dev   home  lost+found  mnt    proc  run   srv   tmp  var
root@LATITUDE:/media/nanbuwks/boot# ls /media/nanbuwks/rootfs/boot
root@LATITUDE:/media/nanbuwks/boot#

容量的には十分余裕があります。

root@LATITUDE:~/Downloads/fuse-ext2-0.0.7# df -h
Filesystem      Size  Used Avail Use% Mounted on
・
・
・
/dev/mmcblk0p1   40M  4.4M   36M  11% /media/nanbuwks/boot
/dev/mmcblk0p2  3.6G  595M  3.0G  17% /media/nanbuwks/rootfs

なので、rootfsパーティションにbootbackというディレクトリを作り、そこに避難させました。

root@LATITUDE:~/Downloads/fuse-ext2-0.0.7# cd /media/nanbuwks/boot
root@LATITUDE:/media/nanbuwks/boot# mkdir ../rootfs/bootback
root@LATITUDE:/media/nanbuwks/boot# cp * ../rootfs/bootback/

fdiskで操作します。

root@LATITUDE:/media/nanbuwks/boot# fdisk  /dev/mmcblk0

Welcome to fdisk (util-linux 2.27.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


コマンド (m でヘルプ): p
Disk /dev/mmcblk0: 7.4 GiB, 7948206080 bytes, 15523840 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: 0x00000000

デバイス       起動  Start 最後から セクタ  Size Id タイプ
/dev/mmcblk0p1       49152   131071   81920   40M 83 Linux
/dev/mmcblk0p2      131072  7617185 7486114  3.6G 83 Linux

コマンド (m でヘルプ): t
パーティション番号 (1,2, default 2): 1
Partition type (type L to list all types): L

 0  空              24  NEC DOS         81  Minix / 古い Li bf  Solaris        
 1  FAT12           27  Hidden NTFS Win 82  Linux スワップ  c1  DRDOS/sec (FAT-
 2  XENIX root      39  Plan 9          83  Linux           c4  DRDOS/sec (FAT-
 3  XENIX usr       3c  PartitionMagic  84  OS/2 hidden or  c6  DRDOS/sec (FAT-
 4  FAT16 <32M      40  Venix 80286     85  Linux 拡張領域  c7  Syrinx         
 5  拡張領域        41  PPC PReP Boot   86  NTFS ボリューム da  非 FS データ   
 6  FAT16           42  SFS             87  NTFS ボリューム db  CP/M / CTOS / .
 7  HPFS/NTFS/exFAT 4d  QNX4.x          88  Linux プレーン  de  Dell ユーティリ
 8  AIX             4e  QNX4.x 第2パー  8e  Linux LVM       df  BootIt         
 9  AIX 起動可能    4f  QNX4.x 第3パー  93  Amoeba          e1  DOS access     
 a  OS/2 ブートマネ 50  OnTrack DM      94  Amoeba BBT      e3  DOS R/O        
 b  W95 FAT32       51  OnTrack DM6 Aux 9f  BSD/OS          e4  SpeedStor      
 c  W95 FAT32 (LBA) 52  CP/M            a0  IBM Thinkpad ハ ea  Rufus alignment
 e  W95 FAT16 (LBA) 53  OnTrack DM6 Aux a5  FreeBSD         eb  BeOS fs        
 f  W95 拡張領域 (L 54  OnTrackDM6      a6  OpenBSD         ee  GPT            
10  OPUS            55  EZ-Drive        a7  NeXTSTEP        ef  EFI (FAT-12/16/
11  隠し FAT12      56  Golden Bow      a8  Darwin UFS      f0  Linux/PA-RISC  
12  Compaq 診断     5c  Priam Edisk     a9  NetBSD          f1  SpeedStor      
14  隠し FAT16 <32M 61  SpeedStor       ab  Darwin ブート   f4  SpeedStor      
16  隠し FAT16      63  GNU HURD または af  HFS / HFS+      f2  DOS セカンダリ 
17  隠し HPFS/NTFS  64  Novell Netware  b7  BSDI fs         fb  VMware VMFS    
18  AST SmartSleep  65  Novell Netware  b8  BSDI スワップ   fc  VMware VMKCORE 
1b  隠し W95 FAT32  70  DiskSecure Mult bb  隠し Boot Wizar fd  Linux raid 自動
1c  隠し W95 FAT32  75  PC/IX           bc  Acronis FAT32 L fe  LANstep        
1e  隠し W95 FAT16  80  古い Minix      be  Solaris ブート  ff  BBT            

FAT32はb,c,1b,1c,bcとあります。確か Raspberry Pi の場合はcだった気がするのでとりあえずパーティションタイプを「 c W95 FAT32 (LBA)」にします。

Partition type (type L to list all types): c

Changed type of partition 'Linux' to 'W95 FAT32 (LBA)'.

コマンド (m でヘルプ): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Re-reading the partition table failed.: デバイスもしくはリソースがビジー状態です

The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8).

とりあえず確認。

root@LATITUDE:/media/nanbuwks/boot# fdisk -l
・
・
・
Disk /dev/mmcblk0: 7.4 GiB, 7948206080 bytes, 15523840 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: 0x00000000

デバイス       起動  Start 最後から セクタ  Size Id タイプ
/dev/mmcblk0p1       49152   131071   81920   40M  c W95 FAT32 (LBA)
/dev/mmcblk0p2      131072  7617185 7486114  3.6G 83 Linux

変わっているみたいなのでFAT32でフォーマット。

root@LATITUDE:/media/nanbuwks/boot# mkfs.vfat /dev/mmcblk0p1
mkfs.fat 3.0.28 (2015-05-16)
mkfs.vfat: /dev/mmcblk0p1 contains a mounted filesystem.

おっと。マウント解除しなきゃ。

root@LATITUDE:/media/nanbuwks/boot# mount
・
・
・
/dev/mmcblk0p1 on /media/nanbuwks/boot type vfat (rw,nosuid,nodev,relatime,uid=1000,gid=1000,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,showexec,utf8,flush,errors=remount-ro,uhelper=udisks2)
root@LATITUDE:/media/nanbuwks/boot# cd ..

ファイルブラウザでマウント解除して、念の為に抜いてもう一度挿し直し

root@LATITUDE:/media/nanbuwks# mkfs.vfat /dev/mmcblk0p1
mkfs.fat 3.0.28 (2015-05-16)

ファイルブラウザでマウント解除して、念の為にsdカードを抜いてもう一度挿し直し。
マウントポイントが5522-FE25になった。

root@LATITUDE:/media/nanbuwks/rootfs# mount
・
・
・
/dev/mmcblk0p2 on /media/nanbuwks/rootfs type ext4 (rw,nosuid,nodev,relatime,data=ordered,uhelper=udisks2)
/dev/mmcblk0p1 on /media/nanbuwks/5522-FE25 type vfat (rw,nosuid,nodev,relatime,uid=1000,gid=1000,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,showexec,utf8,flush,errors=remount-ro,uhelper=udisks2)

bootにマウントされないと気持ち悪い。もしかしたらNanoPiもボリュームラベルを認識する可能性も考え、ボリュームラベルをちゃんと付けてみる。

root@LATITUDE:/media/nanbuwks# mkfs.vfat -n boot /dev/mmcblk0p1
mkfs.fat 3.0.28 (2015-05-16)
mkfs.fat: warning - lowercase labels might not work properly with DOS or Windows

うん? worningですね。大文字にしたほうがいいのかな? もしかして大文字で書いても、Linuxでマウントするときには小文字になったりするかな?

root@LATITUDE:/media/nanbuwks# mkfs.vfat -n BOOT /dev/mmcblk0p1
mkfs.fat 3.0.28 (2015-05-16)

BOOTにマウントしたので、元に戻します。

root@LATITUDE:/media/nanbuwks# mkfs.vfat -n boot /dev/mmcblk0p1
mkfs.fat 3.0.28 (2015-05-16)
mkfs.fat: warning - lowercase labels might not work properly with DOS or Windows

先ほどコピーした2つのファイルをコピーします。

root@LATITUDE:/media/nanbuwks# cp rootfs/bootback/* boot
root@LATITUDE:/media/nanbuwks# cd

これでマウント解除して取り外し、NanoPiに接続すると無事起動しました。
これらRaspberry Piだったら bootパーティションにはconfig.txtがあったりするのでWindowsやMacの場合は便利。けれどもNanoPiの場合はFAT32にしたところでそれだけだと嬉しいことは何もない。

「RaspberryPi3のWiFiファイルをSDに置いて起動時に読み込んで自動接続する」
http://qiita.com/miminashi/items/a5da8880ea37e017934e
のようなテクとの併せ技で嬉しくなるというお話でした。

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1