I am thinking of learning OpenCV. I read that I should expand the SD card partition before installing the OpenCV program. I have never partitioned the SD card before. So I googled.
I read the following tutorial about adding a new partition, then I realized that I don't need that. What I want is to resize the existing partition.
RPi Easy SD Card Setup
...
Manually resizing the SD card partitions (Optional)
http://elinux.org/RPi_Easy_SD_Card_Setup
The SD card image is sized for a 2 GB card. So, if you are using an SD card with a greater capacity, you may find that only 2 GB is available. If this is the case, then to gain more free space, the partitions must be resized. The Fedora Remix and the BerryBoot will automatically resize the partitions on the mounted card during the first boot. The Debian , OpenSuSe and Rasbian images won't, so you'll have to do it manually. The easiest way is to use the tool RPi raspi-config selecting menu item EXPAND-ROOTFS - Expand Root Partition to Fill SD Card.
If you want to resize the SD card whilst the SD card is not mounted in the Pi, look here for instructions.
Adding a data partition (Optional)
If you would rather not resize the partition on another machine as described above, either because you do not have another working Linux machine or you wish to keep your data on another partition to your operating system, you can instead create a new data partition and have that mount automatically at boot.
First you need to become root and install parted (I did all of this from the boot command prompt, although if you feel safer in a GUI, you can do all of this in a terminal window):
sudo su
apt-get install parted
Then you need to run parted on your SD card, mine is /dev/mmcblk0, ymmv:
parted /dev/mmcblk0
Once running, set the display units to something usable and then print your partition table
unit chs
print
You should see something like this:
Model: SD SD08G (sd/mmc)
Disk /dev/mmcblk0: 121279,3,31
Sector size (logical/physical): 512B/512B
BIOS cylinder,head,sector geometry: 121280,4,32. Each cylinder is 65.5kB.
Partition Table: msdos
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)
Now you need to create your data partition - you need to choose one more than the end of partition 3 with ,0,0 as your start and use the number from the line that starts with Disk as your end:
mkpart primary 29744,0,0 121279,3,31
print
That should show your new partition:
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)
4 29744,0,0 121279,3,31 primary
Now quit and format the partition (again, ymmv with the specific device name, try ls /dev for some clues), and then label it:
quit
mkfs.ext4 /dev/mmcblk0p4
e2label /dev/mmcblk0p4 data
Now we need to make sure that the partition is mounted automatically when the system boots (maybe don't use vi if you never have before, try nano):
vi /etc/fstab
Enter a line exactly like this at the end of the file and save and quit your text editor:
/dev/mmcblk0p4 /data ext4 defaults 1 2
Create the mount point:
mkdir /data
Now mount the partition:
mount /data
cd /data
ls
Your new partition has been created!
.END
No comments:
Post a Comment