martes, 4 de noviembre de 2014

Deploying OS on Rasperry - partitions, filesystems,...

From my point of view, the default raspberry OS images or the installation script, lacks of some useful features, such as:

  • Deployment from an image
    • A bigger fat partition (useful for data exchange; it able to insert this SD in a Windows computer and copy files there)
    • Additional partition for  data  (having system and data separated, it is possible to have smaller backups containing only system partition)
  • Deployment from a installation script
    • OSMC (installation script, creates a
    •      a 1st partition of 242MB FAT32-LBA
    •      a 2nd partition using the rest of the SD.

So, we can improve the default deployment with the following solutions:
  1. Deploy the standard image on a bigger SD card (default)
  2. Deploy the standard image on a bigger SD card and resize partitions (gparted)
  3. Manual method 1
  4. Manual method 2
    1. Deploy standard image on a bigger SD card
    2. Resize ext partition (decrease from begining) in order to free space after the fat32 partition
    3. Copy or pack (tar) files from fat32 partition
    4. Delete fat partition
    5. Create a new fat32 (lba) partition with desired size
    6. Paste, untar files on fat32 partition

Some examples of a "better" partition


fat32 1GB(boot+media)
ext4 7GB(system+media)

SD 16GB 
fat32 8GB(boot+media)
ext4 8GB(system+media)


SD 16GB 
fat32 1GB(boot+media)
ext4 7GB(system)
ext4  8GB(data)

Partition backups on images

Backups to image can be done at partition level, using dd command or graphical tool (i.e Disks in Ubuntu)
To restore an image containing a partition, you have to create a partition on destination disk.
If you are using "Disks" and image size and destination partition have not the same size, it will alert you but don't worry it works.

Checking content of images

sudo fdisk /media/midisco/raspberry_cosas/OpenELEC-RPi.arm-4.0.5.img

Resizing OS from an image


In theory with gparted it is possible to resize fat and ext partitions but it

sometimes can have problems resizing a  fat32 filesystem, it means that partition have desired size but filesystem and available space still having the original size.
-usually works fine with ext2, ext3 partitions

Manual method for fat32 partition

dd partition1(fat32) on a disk

Copy or pack (tar) files from fat32 partition
Delete partition
Create a new fat32 (lba) partition with desired size
Paste, untar files 

Accessing from Windows to Linux Filesystem

Use a file explorer, i.e Linux reader from diskinternals