-
Notifications
You must be signed in to change notification settings - Fork 1
Home
Parted utility is generally available on most linux system and allows you to view the partition information.
$ sudo parted -l|more
Model: ATA ST500LT012-1DG14 (scsi)
Disk /dev/sda: 500GB
Sector size (logical/physical): 512B/4096B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 1049kB 538MB 537MB primary fat32 boot
2 539MB 500GB 500GB extended
5 539MB 500GB 500GB logical lvm
Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/vgubuntu-root: 499GB
Sector size (logical/physical): 512B/4096B
Partition Table: loop
Disk Flags:
Number Start End Size File system Flags
1 0.00B 499GB 499GB ext4
Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/vgubuntu-swap_1: 1028MB
Sector size (logical/physical): 512B/4096B
Partition Table: loop
Disk Flags:
Number Start End Size File system Flags
1 0.00B 1028MB 1028MB linux-swap(v1)
You can insert and mount any additional USB drives / SD cards. so, make a folder for each of the partition and mount them
$ mkdir usb1
$ mount /dev/sdb1 usb1
$ mkdir usb2
$ mount /dev/sdb2 usb2
For best stability, it is recommended to install and run a Raspberry Pi distributed kernel - https://github.com/raspberrypi/linux Raspberry Pi 4 supports USB boot and network boot out of box, this means you can install an OS into hard drive or SSD directly.
-
Raspberry Pi 4 series (BCM2711)
- Raspberry Pi 4B
- Compute Module 4
- Raspberry Pi 400
-
Raspberry Pi 3 (BCM2837/B0)
- Raspberry Pi 3/3B/3B+
- Compute Module 3
-
Raspberry Pi 2 (Partial, BCM2837 model)
Presently, we have tested with Raspberry Pi 4B and it works very well.
- Upgrade EEPROM firmware (Only for Raspberry Pi 4 series)
- Partitioning and formatting
- Install OS and other essential software packages
- if required;chroot and post installation steps
Check if you have everything listed here:
- A Raspberry Pi 2/3/4
- Installation media (SD card or USB drive)
- Network connectivity via Ethernet cable (for your Pi)
- A good enough SD Card reader which does not corrupt your SD card
- HDMI/MiniHDMI cable for attaching your Pi to a monitor Or a serial console connection. See Raspberry Pi GPIO for pinouts. Or you can ignore this if you want it to run completely headless.
You need to download a few files:
- Latest Raspberry EEPROM firmware (if you have a Pi4)[https://github.com/raspberrypi/rpi-eeprom/releases]
- Latest raspberry pi OS ARM64 tarball
If you don't have a Raspberry Pi 4, please skip this process, as older models don't have onboard EEPROM.
- Obtain a copy of latest Raspberry EEPROM firmware.
- Format a SD card as FAT32 filesystem.
- Extract its contents to the root of SD card.
- Make sure all files exists in the filesystem root, then plug it into your Pi and turn it on.
- You may see the upgrade process if you attach a display.
- Wait it for restarting, if you see a completely green screen then your upgrade is successful.
- If no screen is attached, after a successful upgrade, the green Activity LED will flash rapidly.
Now you can prepare your SD card for installation.
- For Raspberry Pi 4:
- GPT partition table, Network Boot and USB Boot are supported out of box after upgrading your EEPROM.
- Despite GPT is supported, the onboard EEPROM is not UEFI compatible.
- You can see Pi's booting diagnostic screen (and its attempt to boot infinitely) if there's no media plugged in.
- For Raspberry Pi 3:
- You can program a permanent bit in your SOC to gain USB and network boot support, but the support is very limited and it does not support GPT partition table.
Plug your installation media into your PC and begin your installation. You need at least two partitions in your media:
-
The first one is a FAT32 partition, and should be at least 100 MB. This partition will store Raspberry Pi's pre-boot configuration (config.txt), kernel command line (cmdline.txt), its kernel (kernel8.img for arm64), device tree files and overlays), and optionally the initial ramdisk (yes, it does support initramfs).
-
The second is root filesystem. You can format it as whatever you like, e.g. LVM, btrfs, just if your kernel or initramfs supports it. In most cases, I prefer to choose ext4.
Note: initramfs is required if you install your OS in a Logical Volume or an encrypted filesystem, and it must be copied to the boot partition.
- Optionally you can create a swap partition. The size is uncertain as suspend is not supported under plain Raspberry Pi firmware.
Assuming your media presents as /dev/sda, we will use fdisk to partition the media.
THIS WILL OVERWRITE YOUR DISK PARTITION TABLE. If you are uncertain about which device is, execute lsblk
command may help you identify your media.
We will be using GPT partition table for a fresh re-partitioning of Raspberry Pi 4. Here we will set two partitions, boot, root. For swap, you can optionally create a dedicate swap partition or use a swap file in your root filesystem.
- Run fdisk as a root
# fdisk /dev/sda1
-
fdisk will present you a prompt:
-
Execute command
g
to create an empty GPT partition table: -
Execute
n
command to create the first partition. -
Create a vfat filesystem using mkfs.vfat for boot partition:
# mkfs.vfat -n "BOOT" /dev/sda1
Reference:
-
https://wiki.aosc.io/aosc-os/installation/manual/arm-raspberry-pi/
-
If you have swap partition created, use mkswap to create a swap partiton:
# mkswap /dev/sdaX
You need to download the latest version of Raspbian OS from the Raspberry Pi official site [https://www.raspberrypi.org/downloads/raspbian/]. The latest version is the Raspbian Buster.
It is required to flash the OS in a microSD card using different system and a third-party tools. The easiest way to do it is using balenaEtcher application - it is a cross platform tool and it can flash an OS in a microSD within minutes. It can be downloaded from the balena official site - https://www.balena.io/etcher/
You need to insert the memory card in a card reader slot and attach it to the working computer. Now, launch balenaEtcher application; and flash in the following three steps:
- Select the downloaded "Image" file from your download folder
- Select "flash drive" from the options
- Click Flash and wait for the success notification.
Once flashing is finished, you need to add two files to boot partition to make the raspberry pi operational for acess.
- Enabling SSH access To enable ssh, simply add a file named SSH in the boot directory. Note that, the file should not have any extension. Now, you can login the machine using ssh by using softwares like Putty(Windows). Of course, you need to connect LAN cable to put the raspberry Pi on the network.
Default host, user and password are as follows:
hostname: raspberrypi.local
username: pi
password: raspberry
You can now do configuration changes using raspi-config
command.
- Enabling Wi-Fi access To enable WiFi, you have to create another file that holds network information. So, create a file - /etc/wpa_supplicant.conf and add the following lines:
country=IN
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="Your SSID 1"
psk="Your Password"
key_mgmt=WPA-PSK
}
network={
ssid="Your SSID 2"
psk="Your Password"
key_mgmt=WPA-PSK
}
Here, there is only one WiFi network. But, you can add as many as you wish. You have to edit SSID and password for each network.
Further, configure network interfaces in /etc/network/interfaces
auto lo
iface lo inet loopback
alow-hotplug wlan0
auto wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
auto eth0
iface eth0 inet dhcp
Now, reconfigure Wifi card
# sudo wpa_cli -i wlan0 reconfigure
# sudo ifdown wlan0
# sudo ifup wlan0
If required, restart networking service
# sudo systemctl restart networking
To scan and check WiFi networks, you can use
# sudo iwlist wlan0 scan
check the SSID fields in the result.
Sometimes, Wifi drivers are absent for the given manufacturer. You can check the device manufacturer names using lsusb
command.
Now, you have to search the Internet for the corresponding driver.
Now, after inserting the microSD in the Raspberry Pi and powering on the device, you can ssh via WiFi. There is no need of any Ethernet cable.
If you don't know the password of the pi user since it was pre-owned or you have forgotten the password, you have to intercept the boot process (the splash screen says to press the SHIFT key), append “init=/bin/bash” to the “kernel” line, and then issue a “mount -o rw,remount /” followed by a password reset for the pi and root users.