1

I am following this link to create a bootable SD card. I am stuck at mkfs.ext4 <= 1.42.

for: DISK=/dev/mmcblk0

The terminal complains that no 'for' command is found. I suppose I should leave 'for' out? Next:

for: DISK=/dev/sdX
sudo mount ${DISK}1 /media/rootfs/

The terminal throws this error:

mke2fs 1.42.13 (17-May-2015)
The file /dev/sdX1 does not exist and no size was specified.

What am I doing wrong? Also, how can I have mke2fs updated to mke2fs 1.43-WIP (15-Mar-2016)? Thanks.

CaTx
  • 209
  • 2
  • 11

4 Answers4

1

The lines "for: DISK=/dev/mmcblk0" and "for: DISK=/dev/sdX" are for your eyes only, not command lines. "for:"only points to the following instructions in the tutorial, which are command lines and should be run.


The following command lines set the environment variable DISK

  • for a card connected via a PCI card reader

    DISK=/dev/mmcblk0
    
  • for a card connected via a USB card reader,

    DISK=/dev/sdX
    

    In this case you should replace X with the actual drive letter (a, b, c ...), so for example /dev/sdb, that you can identify with the commands

    sudo lsblk --fs     # Output info about filesystems
    sudo lsblk --perms  # Output info about device owner, group and mode
    sudo parted -ls     # --list: lists partition layout on all block devices; --script: never prompts for user intervention
    

    In general, you can use the commands above to find out how the card is connected and identified.

This environment variable is used in the next command in the tutorial as ${DISK}, for example (depending on the version of mkfs.ext4),

  • when connected via PCI

    sudo mkfs.ext4 -L rootfs -O ^metadata_csum,^64bit ${DISK}p1
    
  • or when connected via USB

    sudo mkfs.ext4 -L rootfs -O ^metadata_csum,^64bit ${DISK}1
    

${DISK}p1 and ${DISK}1 specify the partition where you want to create an ext4 file system.

Pablo Bianchi
  • 17,371
sudodus
  • 47,684
0

For is not a command, he is giving examples for two different partition labels since /sdX and /mmcblk have different notations for partitions.

sdX is a generic notation for a block device (HDD, SSD, USB). The "X" is replaced by a letter that is determined by the order in which the device was mounted.

Change the generic statements he uses for the specific information from your system. Use lsblk to find the label linux is using for your SDcard. Then use that in the statement DISK=.

Examples:

DISK=/dev/sdb -- partition=/dev/sdb1  

or

DISK=/dev/mmcblk0 -- partition=/dev/mmcblk0p1
ravery
  • 6,924
0

Instead of using for: try using export command and to the mounting part , like Cornea Valentin said , check if your target is detected by using

sudo fdisk -l /dev/mmcblk0

If detected and still there is problem during mounting try this :

sudo mount -v -t ext4 /dev/mmcblk0 /media/rootfs
Vijay
  • 43
-1

check if target really exist with fdisk or gparted

sudo fdisk -l

gparted must be installed:

sudo apt install gparted
Cornea Valentin
  • 739
  • 6
  • 11