-
Notifications
You must be signed in to change notification settings - Fork 4
4. Prepare SD card
Frank1119 edited this page Apr 6, 2019
·
7 revisions
By default, when the Pi boots for the first time, it claims all space there is on the SD card using /usr/lib/raspi-config/init_resize.sh
which is run by the init=
instruction in /boot/cmdline.txt
, but this instruction was removed from cmdline.txt
as stated in page 2 of this manual, because an extra partition has to be created. To do this, perform the following steps:
sudo sfdisk -d /dev/mmcblk0 > /tmp/partitions.txt sudo nano /tmp/partitions.txt sudo sed -i "/mmcblk0p2.*size/s/size=.*,/size= 8388608,/g" /tmp/partitions.txt sudo sfdisk -n /dev/mmcblk0 < /tmp/partitions.txt sudo partprobe /dev/mmcblk0 sudo resize2fs /dev/mmcblk0p2
This will resize the root file system to 4GB. Check with df -h
sudo apt-get update sudo apt-get install ntfs-3g
Start fdisk interactive: sudo fdisk /dev/mmcblk0
- Print the existing partition table with
p
- Create a new partition with
n
- Make this an primary partition by entering
p
- Accept the default partition number (3)
- Enter the first sector number. This is the number of the
End
sector of/dev/mmcblk0p2
increased by 1 - Accept the default last sector number. This will fill up your SD card completely
- Change the partition type by entering
t
- Choose partition 3 to alter
- Type
7
to mak this a NTFS partition - Enter
w
to write the partition information to disk - Update the kernel tables:
sudo partprobe /dev/mmcblk0
Format the newly created partition:
sudo mkntfs -Q -L CD-berry /dev/mmcblk0p3
Mount and check the partition:
sudo mount /dev/mmcblk0p3 /mnt sudo df -h sudo umount /mnt
On a 16GB SD card, you will see a NTFS partition with a size of about 11GB
Go Home