I am following this link to create a bootable SD card. I am stuck at mkfs.ext4 <= 1.42.
for: DISK=/dev/mmcblk0The 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.
04 Answers
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/mmcblk0for a card connected via a USB card reader,
DISK=/dev/sdXIn this case you should replace
Xwith the actual drive letter (a,b,c...), so for example/dev/sdb, that you can identify with the commandssudo 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 interventionIn 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}p1or 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.
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/mmcblk0If detected and still there is problem during mounting try this :
sudo mount -v -t ext4 /dev/mmcblk0 /media/rootfs 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 0 check if target really exist with fdisk or gparted
sudo fdisk -lgparted must be installed:
sudo apt install gparted 2