4
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

[メモ] Raspberry Pi : Jessie初回起動時のrootfs拡張

Last updated at Posted at 2016-06-13

Raspbian

  • 2016-05-27-raspbian-jessie.img
  • 2016-05-27-raspbian-jessie-lite.img

/boot/cmdline.txt

  • microSDにイメージを焼いた直後:dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet init=/usr/lib/raspi-config/init_resize.sh

  • 一度でも起動した後: dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait

  • 差分: quiet init=/usr/lib/raspi-config/init_resize.sh

/usr/lib/raspi-config/init_resize.sh
...
main () {

...

if ! parted -m $ROOT_DEV u s resizepart $ROOT_PART_NUM $TARGET_END; then
    FAIL_REASON="Root partition resize failed"
    return 1
  fi

  return 0
}

mount -t proc proc /proc
mount -t sysfs sys /sys

mount /boot
sed -i 's/ quiet init=.*$//' /boot/cmdline.txt
mount /boot -o remount,ro
sync

echo 1 > /proc/sys/kernel/sysrq

...

if main; then
  whiptail --infobox "Resized root filesystem. Rebooting in 5 seconds..." 20 60
  sleep 5
else
...
  • sed/boot/cmdline.txtファイルの、quiet から文末まで削除してる
  • main()で、partedを呼び出している
4
5
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
4
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?