Question: When I am running linux from sd card and try to mount sd card -no problem, works fine. But when I am running linux from flash memory I am unable to mount my SD card:

```
# mount /dev/mmcblk0p1 /mnt/ 
mount: mounting /dev/mmcblk0p1 on /mnt/ failed: Invalid argument

```

What could be the basic reason for this error ? 

**Additional Info**

```
root@Xilinx-ZC702-14_7:/# mount -t /dev/mmcblk0p1 /mnt
mount: can't find /mnt in /etc/fstab 

root@Xilinx-ZC702-14_7:/var/volatile/log# ls
wtmp

root@Xilinx-ZC702-14_7:/var/volatile/log# dmesg
dmesg: klogctl: Function not implemented

```

Answer: 
First check the file systems supported in the kernel.

```
[kevin@hexcore ~]
$ cat /proc/filesystems 
....
    ext3
    ext2
    ext4
....

```

I assume that you are trying to mount the same SD card from which you are running the Linux. If so, I assume, quite reasonably, that it has native file system support in Linux. To make sure you have loaded the SD card driver, you can try,

```
$ sudo modprobe sdhci
$ dmesg | tail -n 10
sdhci: Secure Digital Host Controller Interface driver

```

Now, try read access to partitions:

```
$ sudo dd if=/dev/mmcblk of=/dev/null bs=4k count=0  # note: count = 0

```

Alternatively:

```
$ sudo fdisk -l /dev/mmcblk

```

`fdisk` will tell you the partition types as well.

This assures you that the SD card driver can access the block device.
Now you can run `parted` to print the file systems:

```
$ sudo parted /dev/mmcblk
(parted) p
Number  Start   End     Size    Type     File system     Flags
 1      1049kB  8000MB  7999MB  primary  linux-swap(v1)
 2      8000MB  500GB   492GB   primary  ext4

```

Once you know the FS, mount it with

```
$ sudo mount -t <FS> /dev/mmcblkpX </target/dir>

```
Maybe you need to use (parted command) due to partition size:

```
# /sbin/parted /dev/mmcblk0p1
(parted) mklabel gpt
this disk will be lost. Do you want to continue?
Yes/No? yes
....
(parted) quit

```

To make sure that the partition is properly created use `/sbin/parted /dev/mmcblk0p1 print”`

Then you have to format the created partition

```
/sbin/mkfs -t correct_type /dev/mmcblk0p1

```