You are on page 1of 27

RPi Resize Flash Partitions - eLinux.

org

Log in Request account

Page Discussion Read View source View history Search Go


Search

ATTENTION ELC Presenters: Please upload your slide deck for your presentation to
the following page: ELC_2017_Presentations

Navigation

RPi Resize Flash Partitions


Main Page
Community portal
Current events
Recent changes This page is a guide to modifying partitions on the Raspberry Pi (and Pi clones, such as the
Help Banana Pi) for Linux-based operating systems, such as Raspian Linux, CentOS, Arch, and
Volunteering
Linux distributions. Incorrectly using these instructions is likely to corrupt your system.
Bug Tracker
The prepared images for the Raspberry Pi are created for SD cards usually 2 GB in size. If
Where else to find us
you install it on a larger SD card than what it was designed for, you can resize or restructure
Google+ Community
the system, once it is installed, to use the full size of the SD card.
Twitter (@elinux)
#elinux on Freenode
Contents
Facebook
(@elinux.org) 1 Raspi-config
Mailing Lists 2 Explanation
Tools 3 Manually resizing the SD card on Linux
What links here 3.1 Backup
Related changes 3.2 Resizing
Special pages 3.3 Swap
Printable version 3.4 Expand the partition
Permanent link 3.5 Clean and grow the file system
Page information 4 Boot
5 Manually extracting partitions from the image on Linux
6 Manually resizing the SD card using a GUI with GParted
7 Manually resizing the SD card on Raspberry Pi

Raspi-config
If using the official Raspian images released by the Raspberry Pi Foundation, you can use
the raspi-config utility to resize the main partition to fill the SD card. Instructions are on
the RPi raspi-config page. Read on if you want to know if you should use it.

The raspi-config tool is fully automatic. All you have to do is launch it, select the option
expand_rootfs in the raspi-config menu, and reboot the Raspberry Pi. It takes some
time for the changes to be made. Once it's finished, the Pi returns to a command-line or
graphical login prompt.

Alternatively, you can just run raspi-config --expand-rootfs to make it a completely


non-interactive process.

Explanation
Storage devices need some structure that allows the operating system to locate existing files

http://elinux.org/RPi_Resize_Flash_Partitions[24/04/2017 21:04:39]
RPi Resize Flash Partitions - eLinux.org

and create new ones. This is done using partitions and file systems. For a simplistic
explanation, see Partition (basics), which applies to all systems that use partitioning.

A partition is a section of a storage device, which is formatted with a file system, in which the
operating system creates a directory structure. The Linux system has a single directory
structure starting at the root directory ("/"). Partitions are mounted at points in the directory
structure, but the file system remains a single structure. Generally, users do not need to
know about, or see, how partitions are used. This is different from Windows, where each
partition becomes a separate drive, referenced by a letter such as C:, D:, and so on.

A storage device can have a single partition, or several partitions. Changing a partition
structure might be seen as a difficult operation to perform without losing data, so that
structure should be considered carefully before putting data onto a device.

If you skipped it, the Partition (basics) page gives more details.

Manually resizing the SD card on Linux


A tutorial video: http://www.youtube.com/watch?v=R4VovMDnsIE

The first step is to discover where your system accesses your SD card. How the SD card
shows up on your system depends largely on whether you have attached it directly into an
SD card slot in your computer or into an external card reader plugged into a USB port of
your computer.

The best way to discover the storage devices connected to your computer is the lsblk
command. Here is the sample output:

$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 149.1G 0 disk
sda1 8:1 0 48.5G 0 part
sda2 8:2 0 96.3G 0 part
mmcblk0 179:0 0 7.5G 0 disk
mmcblk0p1 179:1 0 50MB 0 part
mmcblk0p2 179:2 0 2G 0 part

In this sample outpet, the sda device is the computer's internal hard drive, and the mmtblk0
device is an SD card that has been inserted into the computer's SD card reader.

Here is an example of an SD card in an external card reader that is plugged into a


computer's USB port:

sda 8:0 0 149.1G 0 disk


sda1 8:1 0 48.5G 0 part
sda2 8:2 0 96.3G 0 part
sdb 8:16 0 465.9G 0 disk
sdb1 8:17 0 50MB 0 part /boot
sdb2 8:18 0 2G 0 part /

If you are not sure which device represents your SD card, just remove your SD card and run
lsblk again. The device that disappears was your SD card, so insert your card again and
run lsblk and take note of the new device in the list.

http://elinux.org/RPi_Resize_Flash_Partitions[24/04/2017 21:04:39]
RPi Resize Flash Partitions - eLinux.org

Backup
If you have any data other than a fresh image on the SD card, backup your SD card
before resizing partitions. Windows users may use the HDD Raw Copy Tool .

Linux users can just use dd (the same command you probably used to get the image onto
the SD card in the first place) or the dcfldd command (which shows the progress of the
operation unlike dd). For example, to copy all contents off the device that represents your
SD card into an .img file in your home directory:

You should find out the block size of your sd card first (using an improper block size can
lead to issues later on... TRUST)

$ sudo fdisk -l /dev/mmcblk0

Now, look at this line from the output of the previous command. It will determine what we
should use as the bs (block size, not bullsh!t):

Units: sectors of 1 * 512 = 512 bytes

So, bs=512 would be the proper syntax in this instance. Other examples could be: bs=2MB
(for block size = 2 Megabytes), or bs=4MB (for block size = 4 Megabytes), without
specification, dd/dcfldd default to the bytes value.

And finally, to copy all contents off the device that represents your SD card into an .img file
in your home directory:

$ sudo dd if=/dev/mmcblk0 of=$HOME/sdbackup.img bs=512

Resizing
With the SD card in your computer or card reader, make sure it's unmounted. Use the
correct device designation. In this example, I use mmcblk0 but yours may differ:

$ sudo umount /dev/mmcblk0

Use the parted (partition editor) tool to resize the partitions.

Use parted to examine the card:

$ sudo parted /dev/mmcblk0


(parted) unit chs
(parted) print
Disk /dev/mmcblk0: 121535,3,31
Sector size (logical/physical): 512B/512B
BIOS cylinder,head,sector geometry: 121536,4,32. Each cylinder
is 65.5kB.
Partition Table: msdos

http://elinux.org/RPi_Resize_Flash_Partitions[24/04/2017 21:04:39]
RPi Resize Flash Partitions - eLinux.org

Number Start End Type File system Flags


1 16,0,0 1215,3,31 primary fat32 lba
2 1232,0,0 26671,3,31 primary ext4
3 26688,0,0 29743,3,31 primary linux-swap(v1)

Nothing uses the card from end of 'cylinder' 29743 to the card's maximum at 121535.

Partition 1 is the boot partition. Leave that one alone. Partition 2 is the root partition, which
can afford to grow to fill most of the card. If your distribution has a Partition 3 for swap
space, then you need to move that to the end of the card. If your card does not have a swap
partition, or if its swap partition is Partition 2, then you can skip the swap step.

Swap
To move the swap partition (if it exists between your root partition and the end of your SD
card), first calculate how many cylinders your swap partition needs to move. To calculate the
number to use: (Maximum - (Partition 3 End - Partition 3 Start) ) - 1 =
Partition 3 New Start .

In this example: (121535 - ( 29743 - 26688)) -1 = 118479

Assuming you are using parted version 2.4 or greater:

(parted) move 3 118479,0,0

Expand the partition


To grow the root partition, you must first remove the partition boundaries, then recreate the
partition as a larger container, and then resize the file system. As scary as that sounds, it
doesn't destroy data, it just redefines the area "around" that data. Even so, you should make
sure that you backup any important data before attempting this!

To remove and then recreate your root partition, assuming that your root partition is
numbered 2 (it may not be, if you have a swap partition in the 2 slot, so use print in parted
to double check):

(parted) rm 2
(parted) mkpart primary 1232,0,0 118478,3,31
(parted) quit

In this example, the starting address of the new partition is identical to its original value, and
the ending address is the end of the SD card (or the start of the swap partition, if you had a
swap partition that you had to move).

Clean and grow the file system


Now that you have room for a bigger file system, you must clean and then grow the existing
file system that has been displaced by the changing boundaries of its partition. Remember
to use the correct device designation. In this example, I use mmcblk0p2 to represent
Partition 2 on an internal SD card slot, but yours may differ.

http://elinux.org/RPi_Resize_Flash_Partitions[24/04/2017 21:04:39]
RPi Resize Flash Partitions - eLinux.org

$ sudo e2fsck -f /dev/mmcblk0p2

If e2fsck asks to create a Lost+Found directory, it's OK to allow it.

Then resize:

$ sudo resize2fs /dev/mmcblk0p2

Boot
Your system now occupies all available space on your SD card. Put the card in your Pi and
boot.

Once booted, verify your hard work with df:

pi@raspberrypi:~$ df -h
Filesystem Size Used Avail Use% Mounted on
tmpfs 94M 4.0K 94M 1% /lib/init/rw
udev 10M 168K 9.9M 2% /dev
tmpfs 94M 0 94M 0% /dev/shm
rootfs 7.1G 1.3G 5.4G 20% /
/dev/mmcblk0p1 75M 28M 48M 37% /boot

Manually extracting partitions from the image on Linux


Get the information about offsets and sizes from the SD-Card-Image:

$ parted -s SD-Card-Image unit KiB print

Here, the -s option directs parted to go into scripting mode and the commands unit KiB
print tells parted to display its results in blocks of 1024 byte (KiB, see also block size in
GNU Coreutils docu ) and print the partition table.

You will get some information like the following (this is created with the Raspbian Wheezy
image dated 15-Jul-2012):

Disk SD-Card-Image: 1894400kiB


Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system


Flags
1 4096kiB 61440kiB 57344kiB primary fat16
lba
2 61440kiB 1894400kiB 1832960kiB primary ext4

Now you can extract the partitions with

http://elinux.org/RPi_Resize_Flash_Partitions[24/04/2017 21:04:39]
RPi Resize Flash Partitions - eLinux.org

$ dd if=SD-Card-Image of=Part1 bs=1024 skip=4096 count=57344


$ dd if=SD-Card-Image of=Part2 bs=1024 skip=61440 count=1832960

Fill in the skip and count parameters with the numbers for start and size, which you got from
the parted command above.

Manually resizing the SD card using a GUI with GParted


If you are using a PC with a linux distribution to resize the partitions, you can run GParted to
resize the partitions using a GUI. This method is tested on Ubuntu 10.10 using the Gnome
desktop. Versions of GParted differ slightly in their GUIs. For Windows users, it is also
possible to follow the same procedure (less the installation) using the live version of GParted
(GParted Live CD/USB/PXE/HD ).

GParted can be installed using:

sudo apt-get install gparted

Note: I had to physically remove and re-insert the SD card from the card reader after writing
the image before the partitions were recognised properly and the following could be done.

Start GParted (on my system it is [System]->[Administration]->[GParted


Partition editor] ).
Select the drive corresponding to your SD card (was /dev/sdh/ on my system). You
now see the partitions mentioned above (with some tiny unallocated areas in between
and a large one after).
Select the swap partition by clicking on it.
If the Resize/Move toolbar icon or [Resize/Move] menu option is disabled, go to
Partition / Unmount.
Select the menu option [Partition]->[Resize/Move] and drag the partition to the
right (click/drag in the middle).
Select the ext4 partition.
If the Resize/Move toolbar icon or [Resize/Move] menu option is disabled, go to
Partition / Unmount.
Resize the partition by dragging the right edge of the partition all the way to the right
(click/drag the right edge).
When you are satisfied with the changes, click on the green check mark, "Return" arrow,
or other "apply" control to execute these changes.

You're done!

Manually resizing the SD card on Raspberry Pi


You can also resize the partitions of the SD card that your Pi is running on.

First you need to change the partition table with fdisk. You need to remove the existing
partition entries and then create a single new partition than takes the whole free space of the
disk. This will only change the partition table, not the partitions data on disk. The start of the
new partition needs to be aligned with the old partition!

Start fdisk:

http://elinux.org/RPi_Resize_Flash_Partitions[24/04/2017 21:04:39]
RPi Resize Flash Partitions - eLinux.org

sudo fdisk /dev/mmcblk0

Then delete partitions with d and create a new with n. You can view the existing table with p.

p to see the current start of the main partition


d, 3 to delete the swap partition
d, 2 to delete the main partition
n p 2 to create a new primary partition, next you need to enter the start of the old main
partition and then the size (enter for complete SD card). The main partition on the
Debian image from 2012-04-19 starts at 157696, but the start of your partition might be
different. Check the p output!
w write the new partition table

Now you need to reboot:

sudo shutdown -r now

After the reboot you need to resize the filesystem on the partition. The resize2fs
command will resize your filesystem to the new size from the changed partition table.

sudo resize2fs /dev/mmcblk0p2

This will take a few minutes, depending on the size and speed of your SD card.

When it is done, you can check the new size with:

df -h

Category: RPi Linux

This page was last modified on 2 March 2017, at 17:08.

This page has been accessed 449,479 times.

Content is available under a Creative Commons Attribution-ShareAlike 3.0 Unported License unless otherwise noted.

Privacy policy About eLinux.org Disclaimers

http://elinux.org/RPi_Resize_Flash_Partitions[24/04/2017 21:04:39]
RPi raspi-config - eLinux.org

Log in Request account

Page Discussion Read View source View history Search Go


Search

ATTENTION ELC Presenters: Please upload your slide deck for your presentation to
the following page: ELC_2017_Presentations

Navigation

RPi raspi-config
Main Page
Community portal
Current events
Recent changes
Contents
Help
1 The raspi-config tool
Volunteering
Bug Tracker 2 Using raspi-config
3 Moving Around the Menu
Where else to find us
4 What raspi-config does
Google+ Community
5 Menu Options
Twitter (@elinux)
5.1 info - Information About This Tool
#elinux on Freenode
5.2 expand_rootfs - Expand root partition to fill SD card
Facebook
(@elinux.org) 5.3 overscan - Change overscan
Mailing Lists 5.4 configure-keyboard - Set keyboard layout
Tools 5.5 change_pass - Change password for pi user
What links here 5.6 change_locale - Set locale
Related changes 5.7 change_timezone - Set timezone
Special pages 5.8 memory_split - Change memory split
Printable version 5.9 ssh - Enable or disable ssh server
Permanent link 5.10 boot_behaviour - Start desktop on boot?
Page information 5.11 update - Try to upgrade raspi-config
5.12 <Finish>
6 First-boot activity
6.1 History
6.2 Is this useful?

The raspi-config tool


The raspi-config tool helps you to configure your Raspberry Pi; several settings can be
changed with this tool without having to know the correct commands to use. It is written as a
bash script, run in a terminal window, and uses whiptail (whiptail is a "dialog" replacement
using newt instead of ncurses, see "man whiptail") to create the windows, menus and
messages. Some changes require "administrator" permissions, so the tool must be run in a
terminal with:

sudo raspi-config

This can be run from the command line or from a terminal window if using the GUI. Older
versions of Raspbian would boot to the command line and the raspi-config tool would run on

http://elinux.org/RPi_raspi-config[24/04/2017 21:06:01]
RPi raspi-config - eLinux.org

first boot after installation. Newer versions boot to the GUI and do not run raspi-config.
There is a similar GUI configuration tool that can be run from the menus.

Although it is already installed on Raspbian, and there is an update option within the menus,
it is installed or updated from package raspi-config.

Using raspi-config
It has the following entries (this is the layout from raspi-config version 20160108, January
2016). It may be different on other Raspbian images:

Raspberry Pi Software Configuration Tool (raspi-config)

1 Expand Filesystem Ensures that all of the SD card


storage is av...
2 Change User Password Change password for the default
user (pi)
3 Boot Options Choose whether to boot into a
desktop environ...
4 Wait for Network at Boot Choose whether to wait for
network connection...
5 Internationalisation Options Set up language and regional
settings to matc...
6 Enable Camera Enable this Pi to work with the
Raspberry Pi ...
7 Add to Rastrack Add this Pi to the online
Raspberry Pi Map (R...
8 Overclock Configure overclocking for your
Pi
9 Advanced Options Configure advanced settings
0 About raspi-config Information about this
configuration tool

<Select> <Finish>

The Advanced Options option is another menu:

Raspberry Pi Software Configuration Tool (raspi-config)

A1 Overscan You may need to configure overscan if black


bars are ...
A2 Hostname Set the visible name for this Pi on a network
A3 Memory Split Change the amount of memory made available to
the GPU
A4 SSH Enable/Disable remote command line access to
your Pi ...
A5 Device Tree Enable/Disable the use of Device Tree
A6 SPI Enable/Disable automatic loading of SPI
kernel module...
A7 I2C Enable/Disable automatic loading of I2C
kernel module
A8 Serial Enable/Disable shell and kernel messages on
the seria...
A9 Audio Force audio out through HDMI or 3.5mm jack
A0 Update Update this tool to the latest version

http://elinux.org/RPi_raspi-config[24/04/2017 21:06:01]
RPi raspi-config - eLinux.org

<Select> <Back>

Where the description is too long to fit on a single line it is shown truncated, but above it is
shown with "..." (the dots are not shown on your Pi).

Moving Around the Menu


Cursor up/down keys move the highlight up and down menus, stopping at the top or bottom.

The Tab key switches from the selected menu entry and the "buttons" at the bottom (inside
angle brackets), and back again.

With a menu entry or a "button" highlighted, press Enter to start that option or button.

Pressing ESC quits from the menus, without confirmation. Whiptail has a 'hotkey' capability
which does not apply in raspi-config.

Some of the menu entries take a while to read configuration information before they change
what is displayed. Be patient.

What raspi-config does


Some menu entries modify the file /boot/config.txt. This file, out of the box, contains a
number of commented out configuration entries; raspi-config adds entries at the end of this
file. You can see what raspi-config has done to the
file by viewing it on the Pi using Leafpad.
More information on editing config.txt here R-Pi_ConfigurationFile

Other entries modify Linux configuration files. Some take effect immediately, others at the
next boot.

Menu Options
Here is a description of each menu entry.

info - Information About This Tool


It helpfully advises that it is for initial configuration, and can be run at any time. You may
have difficulties if you have heavily customized your installation as the changes it makes
might not be correct if what it attempts to change is not what it expects.

expand_rootfs - Expand root partition to fill SD card


The usual distribution images are 2 GB. When you copy the image to a larger SD card you
have a portion of that card unused. This option expands the initial image to expand to fill the
rest of the SD card, giving you more space. You need to reboot the Raspberry Pi to make
this available. THERE IS NO CONFIRMATION - SELECTING THE OPTION EXPANDS
THE PARTITION.

overscan - Change overscan


Old photographs had a border round the outside to allow for handling and mounting. Old TV
sets had a significant variation in the size of the picture it produced; some had cabinets that
overlapped the screen. Like the photographs, the TV pictures were given a black border so

http://elinux.org/RPi_raspi-config[24/04/2017 21:06:01]
RPi raspi-config - eLinux.org

that none of the picture was lost. This is called overscan. Modern TVs and monitors don't
need, and the signal doesn't have, the border. If the initial text shown on the screen
disappears off the edge you need to enable overscan to add back the border.

Any changes will take effect after a reboot. You can have greater control over the settings by
editing boot/config.txt.

On some displays, particularly monitors, just disabling Overscan will make the picture fill the
whole screen and correct the resolution. For other displays it may be necessary to leave
overscan enabled and adjust the Overscan values, more information here R-
Pi_Troubleshooting#Big_black_borders_around_small_image_on_HD_monitors.

configure-keyboard - Set keyboard layout


This option selects the keyboard being used, so that the characters produced are the same
as those typed (important examples are # and /). It is slow to display, while it reads all the
keyboard types. Changes usually take effect immediately, but may require a reboot.

Brands of keyboards are chosen first followed by other choices to set up the nationality of
the keyboard. The default is a Generic 105-key (Intl) PC. If you cannot find your keyboard on
the list then use one of the generic keyboards. Check | this page for most keyboard
layouts. The next screen gives the keyboard layout. If you are not using the first choice of
English UK select Other and you will be faced with a long list of other national keyboards.

You then select specific options:

No AltGr key
Compose key Many people choose not to set up a Compose key, but it can be useful
for typing symbols or accented characters on a regular keyboard. If you wish to define a
Compose key, instructions on how to do so are here: Compose key.
Shutdown XServer (use [Ctrl][Alt][Backspace] all pressed at the same time)

change_pass - Change password for pi user


The default user for the Raspian install is "pi" and its password is "raspberry". If you change
the password, other people will need to know the new password, including you, to logon to
the Raspberry Pi. Each user/password combination can be different on each SD card.

change_locale - Set locale


This option selects the characters and other symbols being displayed on the screen, and is
important if you want to use the non-english ones. It is slow to display, while it reads all the
locale information. Changes usually take effect immediately, but may require a reboot.

You usually select only the one(s) you want (press space); this will generate the
configuration data for all those you select. The default setting is en_GB UTF-8 UTF-8

change_timezone - Set timezone


This is where you setup your system clock; if its wrong it just means the date and time
assigned to files you create (automatically when you make them) will be wrong. It is slow to
display as there are lots of selections. First you select the continent, then select a City from
that continent. You may have to select the one nearest to you.

The Raspberry Pi does not have an onboard clock (you can add one), so the "clock" stops

http://elinux.org/RPi_raspi-config[24/04/2017 21:06:01]
RPi raspi-config - eLinux.org

when you power it off. If you are connected to the internet the Raspberry Pi can be set up to
get the time from an online time signal.

memory_split - Change memory split


The Raspberry Pi has two processors, one for calculation tasks (the CPU) and one for
graphical tasks (the GPU). The CPU is described as the ARM; the GPU as the VideoCore.
This version takes account of the 256 MB or 512 MB boards, and allows a dynamic
reallocation of memory, whereas older versions of raspi-config only split the 256 MB and
could not set the dynamic option. The best setting will depend on what type of applications
you are running on your Raspberry Pi.

ssh - Enable or disable ssh server


Enabling ssh will allow you to connect to your Raspberry Pi from another device on your
network and use a terminal window remotely. You do not need a monitor or keyboard
connected to your Raspberry Pi if you do this.

Unless you want to use the Raspberry Pi remotely you can disable this, as it stops the ssh
service which takes a small amount of processing resources. If you want to set this up, see
the ssh page.

boot_behaviour - Start desktop on boot?


The official images are supplied with the Raspberry Pi booting into a command line,
presumably because problems with connecting the display are fewer and simpler. If you
think you are ok with the GUI interface you can boot to this. You can change this at any
time.

Desktop (GUI interface) - gives a picture based screen, similar to a Windows, Mac or
smartphone, that requires a mouse to select actions (usually). This option also skips the
login by using the pi user. Pressing the red Exit button on the right hand side of the
screen will give the options to logout, shutdown or reboot. Using logout will give a GUI
login screen. Using Ctrl-Alt-Backspace also gives a GUI login screen. To use a
command line open the Terminal window. To get back to the command line, logout and
press Ctrl-Alt-F1. To permanently get back the command line, run raspi-config and reset
the boot behaviour and restart.
Command line - gives a text based screen that requires the user to type commands on
the keyboard only. Usually the mouse is not required, but some command line programs
can use mouse control. You can switch to the GUI screen by typing "startx" and pressing
'Enter'. This time the red Exit button on the right hand side of the screen will only give the
option to logout. This returns you to the command line. To stop or reboot the Raspberry
Pi type "sudo halt" or "sudo reboot" and press 'Enter'.

update - Try to upgrade raspi-config


The raspi-config utility has changed quite a bit since it started, and is likely to continue to
change. Use this option to check if your version of raspi-config is the latest, and if not
download the latest version; you will need to be connected to the internet to update it. Once
updating is complete, raspi-config will close. You should restart raspi-config with "sudo
raspi-config" to make sure that you have completed all the options.

http://elinux.org/RPi_raspi-config[24/04/2017 21:06:01]
RPi raspi-config - eLinux.org

<Finish>
Use this 'button' when you have completed your changes. You will be asked whether you
want to reboot or not. When used for the first time its best to reboot. This should restart your
Pi. There will be a delay if you have chosen to resize your SD card.

First-boot activity
When a new image that contains the raspi-config utility is booted the first time, the session
starts with the raspi-config screen. Use the help above when using the utility on first boot.
This behaviour is driven by the raspi-config.sh script in the /etc/profile.d directory.

#!/bin/sh
# Part of raspi-config http://github.com/asb/raspi-config
#
# See LICENSE file for copyright and license details

# Should be installed to /etc/profile.d/raspi-config.sh to force


raspi-config
# to run at initial login

# You may also want to set automatic login in /etc/inittab on


tty1 by adding a
# line such as:
# 1:2345:respawn:/bin/login -f root tty1 </dev/tty1 >/dev/tty1
2>&1 # RPICFG_TO_DISABLE

if [ $(id -u) -ne 0 ]; then


printf "\nNOTICE: the software on this Raspberry Pi has not
been fully configured. Please run 'sudo raspi-config'\n\n"
else
raspi-config
exec login -f pi
fi

This runs the raspi-config script (found as /usr/bin/raspi-config). When that has
completed, the script above shows the login prompt for the pi user.

When the raspi-config script runs, and the user selects the Finish option, the script above
is deleted so that it will not run again. When the Raspberry Pi is first booted it uses the
/etc/inittab script, which does an automatic login as root. The Finish option of the raspi-
config script modifies part of the inittab script, from the login as root:

...
# 1:2345:respawn:/sbin/getty --noclear 38400 tty1 #
RPICFG_TO_ENABLE
1:2345:respawn:/bin/login -f root tty1 </dev/tty1 >/dev/tty1
2>&1 # RPICFG_TO_DISABLE
2:23:respawn:/sbin/getty 38400 tty2
3:23:respawn:/sbin/getty 38400 tty3
...

to the standard login action:

http://elinux.org/RPi_raspi-config[24/04/2017 21:06:01]
RPi raspi-config - eLinux.org

...
1:2345:respawn:/sbin/getty --noclear 38400 tty1
2:23:respawn:/sbin/getty 38400 tty2
3:23:respawn:/sbin/getty 38400 tty3
...

History
This utility script was first released with the Debian Wheezy image of 18 June 2012. It is
expected to continue changing so the number of menu items and the ease of use of those
items will increase with time. If anyone feels willing and able to improve raspi-config then
please contact Alex Bradbury [1] .

Is this useful?
This may be just a bit of background information, but it could be useful if you wish to
distribute your own SD cards to friends, based on your own configuration. You may have
added or removed packages, changed configurations, or any number of things that you and
your friends think are useful.

You can create a backup image of your SD card, but that image will not execute the raspi-
config script on first boot; your friends may need to run it because they have different
hardware. To make that script run automatically, copy the top script to /etc/profile.d/raspi-
config.sh and change the /etc/inittab script back to the original lines.

Category: RPi Linux

This page was last modified on 17 January 2016, at 05:20.

This page has been accessed 498,929 times.

Content is available under a Creative Commons Attribution-ShareAlike 3.0 Unported License unless otherwise noted.

Privacy policy About eLinux.org Disclaimers

http://elinux.org/RPi_raspi-config[24/04/2017 21:06:01]
Partition (basics) - eLinux.org

Log in Request account

Page Discussion Read View source View history Search Go


Search

ATTENTION ELC Presenters: Please upload your slide deck for your presentation to
the following page: ELC_2017_Presentations

Navigation

Partition (basics)
Main Page
Community portal
Current events
Recent changes
Contents
Help
1 Devices and Partitioning
Volunteering
Bug Tracker 1.1 A simple library
1.2 Complications
Where else to find us
1.3 Filesystems
Google+ Community
2 Windows filesystems
Twitter (@elinux)
3 Apple Mac filesystems
#elinux on Freenode
4 Linux filesystems
Facebook
(@elinux.org)
Mailing Lists

Tools
Devices and Partitioning
What links here When you buy a new computer, with the operating system already installed, you might not
Related changes need to know about partitions. This explanation is given without considering any particular
Special pages
operating system. Some common elements are covered towards the end.
Printable version
Permanent link Storage devices come in a variety of types and sizes. When installed in a computer, the
Page information operating system must arrange those storage devices into a filesystem. A block of storage
space, configured to hold data, is referred to as a partition. A partition cannot cross over
more than one device, but a
device can be split into more than one partition. A device would
hold a partition table that would details of each partition on the device.

A simple library
This example uses a simple library; a building with rows of shelves containing paper books
and magazines, and possibly music and video recordings. Inside the building is a single
room and a short corridor. To get a book, you would enter the building into the corridor, go
into the room, check the index on each row until you find your book, which you then borrow.

This would be the case with a single disc and a single partition. The operating system (you,
in the library) would find the drive (building) and check the corridor (partition table) to find the
partition (room). Each partition contains a directory / folder structure (the index) and locates
the file (book).

Complications
Now imagine three extra things that make your library better.

Language - If you have books in more than one language (say English and German) you
might want to keep those in two separate sections. Then if you want an English book,

http://elinux.org/Partition_(basics)[24/04/2017 21:07:11]
Partition (basics) - eLinux.org

you don't have to look through all the German books as well. You may only be able to
read one language.
Safety - If your books are valuable, you might worry that a fire might destroy all your
books. Keeping them in smaller rooms would reduce the risk.
Expansion - If you can add any book you like, you might find that the library gets full of,
say, fashion magazines. Then you wouldn't be able to add other books that you feel are
more important without removing some of those magazines.

You would change your library by adding panels in the room to divide it up. New doors in the
corridor now show which room is which. Language books are separated, you risk losing only
one room in a small disaster, and when one room is full there is still space in the others.

This is like partitioning your drive. Although the panelled walls in the library can be moved, it
is not easy. The extra rooms become extra partitions and equally, they can be resized, but
not without some difficulty. You then have partitions with different file systems (languages),
smaller partitions
are easier to backup, and directories can only fill up the partition they are
on.

A very large disc drive can be divided into several partitions, just as we divide the room
above. We could also add another drive, which is like adding a new building. Depending on
the layout of the buildings, you may not notice that you are in separate buildings, just like the
operating system might "hide" the layout of the devices when you are looking for a file.

Filesystems
Each partition must be formatted with a filesystem to allow files to be saved on that partition.
The filesystem used is usually dependent on the operating system of the computer on which
the device is installed.

Windows filesystems
The Microsoft Windows operating system primarily uses proprietary Microsoft filesystems,
FAT12, FAT16, FAT32, exFAT and NTFS. The partitions are labelled with a single capital
letter. Older hardware used A: and B: (note the colon delimiter) for floppy disc drives, and C:
for the main partition that holds the
operating system. Drives D: onwards are used for other
disc drives, CD/DVD drives and removable media. Reading other file systems will require
third party utilities to provide that capability.

Apple Mac filesystems


Apple have used various filesystems for previous products; the OSX filesystem used on the
Mac is based on the UNIX filesystem.

Linux filesystems
Linux filesystems are derived from UNIX, with ext4 being the one currently preferred. Many
others can be used. Linux has a single directory structure, with "/" (called "root") being the
highest level. Several directories at the next level have designated purposes, with more sub-
levels of directory as
required. The "/mnt" directory is where installed device partitions are
mounted, and "/media" is where removable device partitions are mounted. With this
structure, a system can have directories located on any suitable devices without the user

http://elinux.org/Partition_(basics)[24/04/2017 21:07:11]
Partition (basics) - eLinux.org

needing to know how this has been set up.

Category: Linux

This page was last modified on 27 January 2013, at 09:30.

This page has been accessed 4,564 times.

Content is available under a Creative Commons Attribution-ShareAlike 3.0 Unported License unless otherwise noted.

Privacy policy About eLinux.org Disclaimers

http://elinux.org/Partition_(basics)[24/04/2017 21:07:11]
HDDGURU: HDD Raw Copy Tool

MENU Home Software HDD Raw Copy Tool

Home

Forum
HDD Raw Copy Tool
Articles MiniTool Data Recovery
Docs 3 Steps Recover All Lost Data. Download Now and Get Your Data Back!
Go to powerdatarecovery.com
Software

Firmware

Publish on HDD Guru!

SEARCH
Custom Search Search

HDD Raw Copy Tool click to enlarge

Developer: HDDGURU.COM

License terms: Freeware

Supported OS: MS Windows XP, Vista, 7, 8, Server 2003, 2008, 2008R2

HDD Raw Copy Tool is a utility for low-level, sector-by-sector hard disk duplication and image creation.

Supported interfaces: S-ATA (SATA), IDE (E-IDE), SCSI, SAS, USB, FIREWIRE.
Big drives (LBA-48) are supported.
Supported HDD/SSD Manufacturers: Intel, OCZ, Samsung, Kingston, Maxtor,
Hitachi, Seagate, Samsung,
Toshiba, Fujitsu, IBM, Quantum, Western Digital,
and almost any other not listed here.
The program also supports low-level duplication of FLASH cards
(SD/MMC, MemoryStick,
CompactFlash, SmartMedia, XD) using a card-reader.

HDD Raw Copy tool makes an exact duplicate of a SATA, IDE, SAS, SCSI or SSD hard disk drive.
Will also
work with any USB and FIREWIRE external drive enclosures
as well as SD, MMC, MemoryStick and
CompactFlash media.

The tool creates a sector-by-sector copy of all areas of the hard drive (MBR, boot records,
all partitions as well as
space in between). HDD Raw Copy does not care about
the operating system on the drive it could be Windows,
Linux, Mac, or any other OS
with any number of partitions (including hidden ones). Bad sectors are skipped by
the tool.

If your media has a supported interface then it can be copied with HDD Raw Copy!

In addition, HDD Raw Copy can create an exact raw (dd) or compressed image of the entire
media (including
service data such as MBR, Boot records, etc). Again, all filesystems
(even hidden) are supported.

Examples of possible uses

Data recovery: make a copy of the damaged drive to attempt recovery on the copy
Data recovery: copy a damaged hard drive and skip bad sectors
Migration: completely migrate from one hard drive to another
Ultimate backup: Make an exact copy of the hard drive for future use
Backup: create an image of a USB flash stick and copy/restore at any moment

http://hddguru.com/software/HDD-Raw-Copy-Tool/[24/04/2017 21:08:21]
HDDGURU: HDD Raw Copy Tool

Software QA engineers: restore your OS hard drives at any moment from a compressed image
Duplicate/Clone/Save full image of any type of media!

Download Windows Installer (most people will want this option): HDD Raw Copy ver.1.10 setup

Download Windows Executable (works without installation): HDD Raw Copy ver.1.10 portable

Copyright 20052017 HDDGURU.COM


Privacy Policy | Refund Policy | Advertise | Submit Article | Contact us

http://hddguru.com/software/HDD-Raw-Copy-Tool/[24/04/2017 21:08:21]
GNU Coreutils: Block size

Next: Floating point, Previous: Backup options, Up: Common options [Contents][Index ]

2.3 Block size

Some GNU programs (at least df, du, and


ls) display sizes in blocks. You can adjust the block size
and method of display to make sizes easier to read. The block size
used for display is independent of
any file system block size.
Fractional block counts are rounded up to the nearest integer.

The default block size is chosen by examining the following environment


variables in turn; the first one
that is set determines the block size.

DF_BLOCK_SIZE

This specifies the default block size for the df command.


Similarly, DU_BLOCK_SIZE specifies the
default for du and
LS_BLOCK_SIZE for ls.

BLOCK_SIZE

This specifies the default block size for all three commands, if the
above command-specific
environment variables are not set.

BLOCKSIZE

This specifies the default block size for all values that are normally
printed as blocks, if neither
BLOCK_SIZE nor the above
command-specific environment variables are set. Unlike the other
environment variables, BLOCKSIZE does not affect values that are
normally printed as byte counts,
e.g., the file sizes contained in
ls -l output.

POSIXLY_CORRECT

If neither command_BLOCK_SIZE, nor BLOCK_SIZE, nor


BLOCKSIZE is set, but this variable is set,
the block size
defaults to 512.

If none of the above environment variables are set, the block size
currently defaults to 1024 bytes in
most contexts, but this number may
change in the future. For ls file sizes, the block size
defaults to 1
byte.

A block size specification can be a positive integer specifying the number


of bytes per block, or it can
be human-readable or si to
select a human-readable format. Integers may be followed by suffixes
that
are upward compatible with the
SI prefixes
for decimal multiples and with the
ISO/IEC 80000-13
(formerly IEC 60027-2) prefixes for binary multiples.

With human-readable formats, output sizes are followed by a size letter


such as M for megabytes.
BLOCK_SIZE=human-readable uses
powers of 1024; M stands for 1,048,576 bytes.
BLOCK_SIZE=si is
similar, but uses powers of 1000 and appends
B; MB stands for 1,000,000 bytes.

A block size specification preceded by ' causes output sizes to


be displayed with thousands
separators. The LC_NUMERIC locale
specifies the thousands separator and grouping. For example, in an
American English locale, --block-size="'1kB" would cause a size
of 1234000 bytes to be displayed
as 1,234. In the default C
locale, there is no thousands separator so a leading ' has no
effect.

http://www.gnu.org/software/coreutils/manual/html_node/Block-size.html[24/04/2017 21:10:16]
GNU Coreutils: Block size

An integer block size can be followed by a suffix to specify a


multiple of that size. A bare size letter,
or
one followed by iB, specifies
a multiple using powers of 1024. A size letter followed by B
specifies
powers of 1000 instead. For example, 1M and
1MiB are equivalent to 1048576, whereas 1MB is
equivalent to 1000000.

A plain suffix without a preceding integer acts as if 1 were


prepended, except that it causes a size
indication to be appended to
the output. For example, --block-size="kB" displays 3000 as
3kB.

The following suffixes are defined. Large sizes like 1Y


may be rejected by your computer due to
limitations of its arithmetic.

kB

kilobyte: 10^3 = 1000.

k
K
KiB

kibibyte: 2^{10} = 1024. K is special: the SI prefix is


k and the ISO/IEC 80000-13 prefix is
Ki, but tradition and
POSIX use k to mean KiB.

MB

megabyte: 10^6 = 1,000,000.

M
MiB

mebibyte: 2^{20} = 1,048,576.

GB

gigabyte: 10^9 = 1,000,000,000.

G
GiB

gibibyte: 2^{30} = 1,073,741,824.

TB

terabyte: 10^{12} = 1,000,000,000,000.

T
TiB

tebibyte: 2^{40} = 1,099,511,627,776.

PB

http://www.gnu.org/software/coreutils/manual/html_node/Block-size.html[24/04/2017 21:10:16]
GNU Coreutils: Block size

petabyte: 10^{15} = 1,000,000,000,000,000.

P
PiB

pebibyte: 2^{50} = 1,125,899,906,842,624.

EB

exabyte: 10^{18} = 1,000,000,000,000,000,000.

E
EiB

exbibyte: 2^{60} = 1,152,921,504,606,846,976.

ZB

zettabyte: 10^{21} = 1,000,000,000,000,000,000,000

Z
ZiB
2^{70} = 1,180,591,620,717,411,303,424.

YB

yottabyte: 10^{24} = 1,000,000,000,000,000,000,000,000.

Y
YiB
2^{80} = 1,208,925,819,614,629,174,706,176.

Block size defaults can be overridden by an explicit


--block-size=size option. The -k
option is
equivalent to --block-size=1K, which
is the default unless the POSIXLY_CORRECT environment variable
is
set. The -h or --human-readable option is equivalent to
--block-size=human-readable. The --si
option is
equivalent to --block-size=si. Note for ls
the -k option does not control the display of the
apparent file sizes, whereas the --block-size option does.

Next: Floating point, Previous: Backup options, Up: Common options [Contents][Index ]

http://www.gnu.org/software/coreutils/manual/html_node/Block-size.html[24/04/2017 21:10:16]
GParted -- Live CD/USB/PXE/HD


Search
GNOME Partition Editor Custom Search

Home Download Live CD/USB Help News Develop Donate

Live CD/USB/PXE/HD
GParted Live is a small bootable GNU/Linux distribution for x86
based
computers.
It enables you to use all the features of
the latest versions of the GParted
application.

GParted Live can be installed on CD, USB, PXE server, and Hard Disk
then run
on an x86 machine.

CAUTION:
Creating a whole disk or partition image backup is recommended
before
you resize or move a partition. Some free software
(GPL) disk and
partition image tools are available:

Clonezilla,
doClone,
FSArchiver,
G4L,
g4u,
Partimage,
Partclone.

Installation Instructions
To install GParted Live on CD, download the
.iso file and burn it as an image to a
CD.

For other installations, please refer to the following documents:


GParted Live on USB
GParted Live on PXE server
GParted Live on Hard Disk
Create your own custom GParted Live
from scratch

Usage Instructions
See the GParted
Live Manual for instructions on how to use the Live image.
See the GParted Manual
for instructions on how to use the application for partitioning
tasks.
See the documentation page for copies
of the GParted Manual in other languages.

Accounts in GParted live


GParted live is based on Debian live, and the default account is "user", with password "live". There is no
root password, so if you need root privileges, login as "user", then run "sudo" to get root privileges.

http://gparted.org/livecd.php[24/04/2017 21:11:05]
GParted -- Live CD/USB/PXE/HD

Available boot parameters


You can find the available boot parameters for GParted live here.

Included Packages
GParted Live includes additional packages, such as:

Graphical Utilities

Right click on the desktop to access a pop-up menu.

lxterminal - Terminal emulator (provides access to command line)


pcmanfm - Graphical file manager
leafpad - Graphical text editor
netsurf - Small web browser
gsmartcontrol - Hard disk drive and SSD health inspection tool
calcoo - RPN and algebraic scientific calculator

Command Line Utilities

fsarchiver - File system archiver and restorer


partclone - Backup partitions into a compressed image file (e.g.,
partclone.ext4)
partimage - Backup partitions into a compressed image file
testdisk - Data recovery tool that can help recover lost partitions
gpart - (Older) data recovery tool that can help recover lost msdos partition tables
grub - GRand Unified Bootloader for restoring GRUB 2 boot loader
mc - Text based file manager known as Midnight Commander
nano - Text editor
vim-tiny - Enhanced vi text editor
parted - Partition table editor
fdisk - MSDOS partition table editor
sfdisk - MSDOS partition table editor also useful to save/restore partition table to/from a file
gdisk - GPT partition table editor
sgdisk - GPT partition table editor also useful to save/restore partition table to/from a file
gptsync - GPT and MSDOS partition tables synchronization tool useful for Mac OS X users
openssh - Secure shell (ssh) connectivity tool suite
screen - Screen manager with VT100/ANSI terminal emulation
ping - Check network connectivity to another host on a network
rsync - Fast, versatile, remote (and local) file-copying tool
telnet - Communicate with another host using the TELNET protocol
traceroute - Print the route packets trace to network host
bc - Arbitrary precision calculator language

To view all of the included packages you can either:


refer to the "packages-x.y.z-w.txt" file in the
download directory,
or
view the file "live/packages.txt" file inside the
GParted Live iso file or zip file.

http://gparted.org/livecd.php[24/04/2017 21:11:05]
GParted -- Live CD/USB/PXE/HD

Documentation
FAQ
Forum
Bugs
Features
Screenshots
Articles
Contact

http://gparted.org/livecd.php[24/04/2017 21:11:05]
Raspberry Pi - Resize the partition to fill the SD card - YouTube

BR

Pesquisar Fazer login

Prximo Reproduo automtica


Preparing for Pi - Using


Full SD card capacity
(Resizing Partitions In
GP t d)
RaspberryPiTutorials
63.248 visualizaes
9:06

Raspberry Pi:
Openelec Vs Raspbmc
TechMadeEasyUK
601.645 visualizaes

10:23

NOOBS: The Easiest


Raspberry Pi Setup
Mark Bruce
271.265 visualizaes

6:34

Raspberry Pi - Tutorial
Raspberry Pi - Resize the partition to fill the SD 9A - Partitioning &
card Formatting Drives
TechErudio
RaspberryPiIVBeginners 25.967 visualizaes
10:26
Inscrever-se 67.936
99.030 visualizaes
RaspberryPi Clone SD
Adicionar a
Compartilhar
Mais 386
21 Card to Smaller One
(using Linux)
Duan Ogrizovi
10.493 visualizaes
Publicado em 13 de mai de 2012 7:42
THIS IS AN OLD METHOD NOW. CHECK "sudo raspi-config" FOR AN AUTOMATIC PROCESS.
THIS IS ONLY FOR OLD VERSIONS OF DEBIAN Raspberry Pi 3:
Extreme Passive
Cooling
MOSTRAR MAIS ExplainingComputers
406.432 visualizaes
11:02

Getting started with


32 your Raspberry Pi

Carregando...

VDEOS RaspberryPiIVBeginners

Backup and Shrink


your Raspberry Pi
Image
Novaspirit Tech
14.784 visualizaes
11:34

Raspberry Pi - Preping
the SD card
RaspberryPiIVBeginners
55.733 visualizaes

3:23

Ubuntu Mate Set up


Raspberry Pi 1 , 2 , 3
and ZERO How To
R PRIME
ETA i Fil S t
10.142 visualizaes
5:09

Raspberry Pi expand
filesystem the easy
way and the hard way -
Pi Z IT Stuff
Basic Pi A B Pi 2
1.068 visualizaes
2:05

Raspberry Pi - Tutorial
9B - Partitioning &

https://www.youtube.com/watch?v=R4VovMDnsIE[24/04/2017 21:13:20]
Raspberry Pi - Resize the partition to fill the SD card - YouTube

Formatting (Continued)
TechErudio
14.354 visualizaes
8:03

Raspberry Pi and
Windows 7 -
MagnumPi
Warrington Collegiate
273.411 visualizaes
2:56

Raspberry Pi - How to
update your Raspberry
Pi
RaspberryPiIVBeginners
33.113 visualizaes
7:39

Raspberry Pi - Tutorial
3 - Installing an OS
(SEE NEWER
METHOD 1 !! T
TechErudio i l
253.702 visualizaes
10:27

New Raspberry Pi 3
(2016) Review -
Unboxing and Tutorial
Dan Wood - kookytech.net
435.645 visualizaes
20:14

Tutorial 2 - Networking
& Linux | Raspberry Pi
Supercomputer
Connor McBrine-Ellis
149.977 visualizaes
3:48

Mobile Pi-to-Go:
Portable Raspberry Pi
Computer
Parts-People.Com, Inc
938.002 visualizaes
6:38

Deleting Raspberry PI
SD Card Partitions in
Linux
startingelectronics
5.221 visualizaes
1:54

Raspberry Pi 3 Cluster
(Supercomputer) Part 1
Rasim Muratovic
535.006 visualizaes

10:04

MOSTRAR MAIS

https://www.youtube.com/watch?v=R4VovMDnsIE[24/04/2017 21:13:20]

You might also like