Difference between revisions of "Format SSD MMC"
From ElphelWiki
(→from camera) |
|||
Line 34: | Line 34: | ||
* mkfs | * mkfs | ||
− | =='Erase' a file system from a partition== | + | ==<font color="blue">'Erase' a file system from a partition</font>== |
Sometimes there is a need to this: | Sometimes there is a need to this: | ||
* if the drive was partitioned several times and the old file system journal starts from a location of a new partition - the file system will surely show up. | * if the drive was partitioned several times and the old file system journal starts from a location of a new partition - the file system will surely show up. |
Revision as of 11:46, 29 December 2016
Contents
About
Help tips for formatting:
- SSD (internal or external)
- MMC (&muSD card - normal or recovery)
- USB drive
Can be done either from the camera or PC, the required programs are:
- fdisk - format into partitions
- mkfs.ext4 - create filesystem
- mkfs.vfat - create filesystem
- dd - clean filesystem from the partition for fast recording
SSD or USB
from camera
- check the SSD is already partitioned:
$ cat /proc/partitions
- manage partitions:
$ fdisk /dev/sda
- format a partition for file storage:
$ mkfs.ext4 /dev/sda1
- for fast recording
- Do not make a file system on the partition
MMC
If done from the camera make sure it is not boot from the MMC - in MMC boot by default the camera gets the boot files from /dev/mmcblk0p1 (FAT32) and mounts /dev/mmcblk0p2 (EXT4) as /.
- check boot mode:
$ mount | grep " / "
- check existing paritions:
$ cat /proc/partitions
- manage partitions:
$ fdisk /dev/mmcblk0
- mkfs
'Erase' a file system from a partition
Sometimes there is a need to this:
- if the drive was partitioned several times and the old file system journal starts from a location of a new partition - the file system will surely show up.
- by accident
Examples:
- Use dd:
- 'Erase' a filesystem from /dev/sda1
$ dd if=/dev/zero of=/dev/sda bs=1MB count=1 seek=1
- 'Erase' a filesystem on /dev/sda2, if /dev/sda1 size is SIZE MB:
$ dd if=/dev/zero of=/dev/sda bs=1MB count=1 seek=SIZE
- To erase the drive's partition table (better use fdisk):
$ dd if=/dev/zero of=/dev/sda bs=512 count=2
Useful links
- github:elphel-tools-update - write_bootable_mmc.py
- the script is used to create a bootable MMC from a PC (the camera doesn't have parted and kpartx installed)
- it has examples of using dd, parted, mkfs, kpartx