Sunday, May 25, 2014

create and format partitions on the Yun SD card

I have an 8GB SD card, I want to make a 4GB and a 3GB partition (it currently has only 1 8GB parition). With the SD card in the Yun:
fdisk /dev/sda
delete my existing partition:
Command (m for help): d
Selected partition 1
Partition 1 is deleted
create the 2 new ones:
Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p
Partition number (1-4, default 1): 
Using default value 1
First sector (2048-15523839, default 2048): 
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-15523839, default 15523839): +4G
Partition 1 of type Linux and of size 4 GiB is set

Command (m for help): n   
Partition type:
   p   primary (1 primary, 0 extended, 3 free)
   e   extended
Select (default p): 
Using default response p
Partition number (1-4, default 2): 
Using default value 2
First sector (8390656-15523839, default 8390656): 
Using default value 8390656
Last sector, +sectors or +size{K,M,G} (8390656-15523839, default 15523839): +3G
Partition 2 of type Linux and of size 3 GiB is set
save:
Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: 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)
Syncing disks.
reboot:
reboot
format the new paritions:
opkg update
opkg install mtd-utils
opkg install e2fsprogs

mkfs.ext4 -L YunSD1 /dev/sda1
mkfs.ext4 -L YunSD2 /dev/sda2

update: when I tried this again in 2015, I had to do:

umount /dev/sda1
umount /dev/sda2

prior to the mkfs commands

No comments:

Post a Comment