Difference between revisions of "Format SSD MMC"

From ElphelWiki
Jump to: navigation, search
(from camera)
(About)
 
(11 intermediate revisions by 2 users not shown)
Line 2: Line 2:
 
Help tips for formatting:
 
Help tips for formatting:
 
* SSD (internal or external)
 
* SSD (internal or external)
* MMC (&muSD card - normal or recovery)
+
* MMC (μSD card - normal or recovery)
 
* USB drive
 
* USB drive
  
Line 12: Line 12:
  
 
==<font color="blue">SSD or USB</font>==
 
==<font color="blue">SSD or USB</font>==
===from camera===
+
===camera===
* check the SSD is already partitioned:
+
* (not needed for USB) Check if SSD is connected to the camera:
 +
** The default connection is ''camera <=> internal SSD''
 +
** For external drive set: ''camera <=> external SSD'' and power on the drive.
 +
** [[Sata_multiplexer_10389| '''More info''']]
 +
* Find out the device name:
 +
$ dmesg
 +
* Check if it is already partitioned:
 
  $ cat /proc/partitions
 
  $ cat /proc/partitions
 
* manage partitions:
 
* manage partitions:
Line 21: Line 27:
 
* for '''fast recording'''
 
* for '''fast recording'''
 
** Do not make a file system on the partition
 
** Do not make a file system on the partition
 +
 +
===pc===
 +
The same as above except:
 +
* For internal SSD the connection should be set to ''pc <=> internal SSD''
  
 
==<font color="blue">MMC</font>==
 
==<font color="blue">MMC</font>==
 
+
===camera===
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
+
Make sure the camera 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 /.
 
mounts /dev/mmcblk0p2 (EXT4) as /.
 
* check boot mode:
 
* check boot mode:
Line 32: Line 42:
 
* manage partitions:
 
* manage partitions:
 
  $ fdisk /dev/mmcblk0
 
  $ fdisk /dev/mmcblk0
* mkfs
+
* format a partition for file storage:
 +
mkfs.ext4 /dev/mmcblk0pX
 +
 
 +
===pc===
 +
* Same as above except the MMC might be detected as /dev/sdX
 +
* If MMC is for boot the partition table type must be '''msdos''', not gpt
 +
 
 +
 
  
=='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.
Line 47: Line 64:
 
* To erase the drive's partition table (better use '''fdisk'''):
 
* To erase the drive's partition table (better use '''fdisk'''):
 
  $ dd if=/dev/zero of=/dev/sda bs=512 count=2
 
  $ dd if=/dev/zero of=/dev/sda bs=512 count=2
 +
 +
  
 
==<font color="blue">Useful links</font>==
 
==<font color="blue">Useful links</font>==
* [https://github.com/Elphel/elphel-tools-update github:elphel-tools-update] - '''write_bootable_mmc.py'''
+
* [https://git.elphel.com/Elphel/elphel-tools-update git: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)
 
** 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'''
 
** it has examples of using '''dd''', '''parted''', '''mkfs''', '''kpartx'''
 +
* [[Sd_boot_rootfs|MMC boot]]
 +
** prepare a bootable &mu;SD card and boot
  
 
[[Category:393]]
 
[[Category:393]]

Latest revision as of 10:23, 26 June 2017

About

Help tips for formatting:

  • SSD (internal or external)
  • MMC (μSD 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

camera

  • (not needed for USB) Check if SSD is connected to the camera:
    • The default connection is camera <=> internal SSD
    • For external drive set: camera <=> external SSD and power on the drive.
    • More info
  • Find out the device name:
$ dmesg
  • Check if it 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

pc

The same as above except:

  • For internal SSD the connection should be set to pc <=> internal SSD

MMC

camera

Make sure the camera 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
  • format a partition for file storage:

mkfs.ext4 /dev/mmcblk0pX

pc

  • Same as above except the MMC might be detected as /dev/sdX
  • If MMC is for boot the partition table type must be msdos, not gpt


'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

  • git: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
  • MMC boot
    • prepare a bootable μSD card and boot