Setting on RASPBIAN

Although I’m not familiar to Linux, I’ll customize from the original RASPBIAN. 

Login using ssh

From immediately after the installation of RASPBIAN, it is available to use the ssh connection. The default user name is “pi”, and its password is “raspberry”. If the Raspberry Pi has been connected to the Mac by the LAN cable, you can login it immediately.

[highlight_bash]
$ ssh -l pi raspberrypi.local
The authenticity of host ‘raspberrypi.local (fe80::2caa:f0e6:cf70:3f64%en4)’ can’t be established.
ECDSA key fingerprint is SHA256:RTopB4E1E8xdYL+NCC3YYpULqWdCjkk+cSZfkyko9i8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘raspberrypi.local,fe80::2caa:f0e6:cf70:3f64%en4’ (ECDSA) to the list of known hosts.
pi@raspberrypi.local’s password:
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
pi@raspberrypi:~ $
[/highlight_bash]

Now, has logged in.

Expand the disk area

Let’s expand the disk area, after you are able to login to the RASPBIAN.

Of course the disk area is 1.2GB too, because the disk image file of the RASPBIAN LITE edition is 1.2GB. I confirmed the used area by the “df” utility, it used the 74% of all.

So the micro SD card has the area as 4GB, you can use the rest of the area to expand the partition size by the “raspi-config” utility.

[highlight_bash]
pi@raspberrypi:~ $ LANG=C sudo raspi-config
Welcome to fdisk (util-linux 2.25.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): Disk /dev/mmcblk0: 3.9 GiB, 4116709376 bytes, 8040448 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: 0xe6a544c8
Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p1 8192 131071 122880 60M c W95 FAT32 (LBA)
/dev/mmcblk0p2 131072 2658303 2527232 1.2G 83 Linux
Command (m for help): Partition number (1,2, default 2):
Partition 2 has been deleted.
Command (m for help): Partition type
p primary (1 primary, 0 extended, 3 free)
e extended (container for logical partitions)
Select (default p): Partition number (2-4, default 2): First sector (2048-8040447, default 2048): Last sector, +sectors or +size{K,M,G,T,P} (131072-8040447, default 8040447):
Created a new partition 2 of type ‘Linux’ and of size 3.8 GiB.
Command (m for help): Disk /dev/mmcblk0: 3.9 GiB, 4116709376 bytes, 8040448 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: 0xe6a544c8
Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p1 8192 131071 122880 60M c W95 FAT32 (LBA)
/dev/mmcblk0p2 131072 8040447 7909376 3.8G 83 Linux
Command (m for help): The partition table has been altered.
Calling ioctl() to re-read partition table.
Re-reading the partition table failed.: Device or resource busy
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).
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_CTYPE = “UTF-8”,
LANG = “C”
are supported and installed on your system.
perl: warning: Falling back to the standard locale (“C”).
[/highlight_bash]

After expand the partition, to restart the system using “sudo reboot”. You can see the free space is 2.8GB.

[highlight_bash]
pi@raspberrypi:~ $ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/root 3.7G 816M 2.8G 23% /
devtmpfs 459M 0 459M 0% /dev
tmpfs 463M 0 463M 0% /dev/shm
tmpfs 463M 6.2M 457M 2% /run
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 463M 0 463M 0% /sys/fs/cgroup
/dev/mmcblk0p1 60M 20M 41M 34% /boot
[/highlight_bash]

Update the RASBIAN to the latest, and customize

After update the packages by the “apt” utility, you should install the “rpi-update” utility to update the boot loader.

[highlight_bash]
pi@raspberrypi:~ $ sudo apt update
pi@raspberrypi:~ $ sudo apt upgrade
pi@raspberrypi:~ $ sudo apt install rpi-update
pi@raspberrypi:~ $ sudo rpi-update
*** Raspberry Pi firmware updater by Hexxeh, enhanced by AndrewS and Dom
*** Performing self-update
*** Relaunching after update
*** Raspberry Pi firmware updater by Hexxeh, enhanced by AndrewS and Dom
*** We’re running for the first time
*** Backing up files (this will take a few minutes)
*** Remove old firmware backup
*** Backing up firmware
*** Remove old modules backup
*** Backing up modules 4.1.18-v7+
#############################################################
This update bumps to rpi-4.1.y linux tree
Be aware there could be compatibility issues with some drivers
Discussion here:
https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=113753
##############################################################
*** Downloading specific firmware revision (this will take a few minutes)
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 168 0 168 0 0 129 0 –:–:– 0:00:01 –:–:– 129
100 49.3M 100 49.3M 0 0 169k 0 0:04:57 0:04:57 –:–:– 309k
*** Updating firmware
*** Updating kernel modules
*** depmod 4.1.19-v7+
*** depmod 4.1.19+
*** Updating VideoCore libraries
*** Using HardFP libraries
*** Updating SDK
*** Running ldconfig
*** Storing current firmware revision
*** Deleting downloaded files
*** Syncing changes to disk
*** If no errors appeared, your firmware was successfully updated to 2a7eb4fc4cef07906c36e9adcf76f053daabe371
*** A reboot is needed to activate the new firmware
[/highlight_bash]

You should backup the disk by the “dd” utilitiy.

At first, unmount the disk by the “diskutil unmountDisk” command. To keep the size down, compress the image file by the “gzip” utility.

Because the “dd” utility without the “of” option outputs the data to the standard output device, you should receive by the pipe and compress by the “gzip” utility.

[highlight_bash]
sudo dd bs=1m if=/dev/rdisk3 | gzip -c > raspbian-jessie-lite-backup.img.gz
[/highlight_bash]

Even this time, you use the device name with prefix “r”, the reading speed will be made fast.

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments