Help how to mount SD-Card
#1
Hi All,

On a linux desktop, one way to access your device is to edit the "/etc/fstab" to mount your device permanently so you can access it.

Reading postmarketOS's wiki about fstab, it told you to activate "rc-update" and the localmount service, which is the command:

Code:
sudo rc-update add localmount default

And to check whether the service is running:

Code:
rc-service localmount status

While blkid will return nothing, I use "sudo fdisk -l" to identify the UUID of the SD-Card, which gives:

Code:
Disk /dev/mmcblk0: 59.48 GiB, 63864569856 bytes, 124735488 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: Disk /dev/mmcblk0: 59.48 GiB, 63864569856 bytes, 124735488 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: DC11BA49-9C6F-4BC0-B775-E39576550622

Device           Start       End   Sectors  Size Type
/dev/mmcblk0p1    2048   1050623   1048576  512M EFI System
/dev/mmcblk0p2 1050624 124733439 123682816   59G Microsoft basic data


Device           Start       End   Sectors  Size Type
/dev/mmcblk0p1    2048   1050623   1048576  512M EFI System
/dev/mmcblk0p2 1050624 124733439 123682816   59G Microsoft basic data

Therefore, I edit my fstab to looks like the following:
Code:
UUID=DC11BA49-9C6F-4BC0-B775-E39576550622 /home/user/SDCard vfat defaults 0 0

On a reboot it did not give me anything in the folder. Upon the failure, I tried to mount the SDcard by using the mount command, which return error:-

Code:
sudo mount -t vfat -o ro /dev/mmcblk0p2 ~/SDCard
mount: /home/user/SDCard: wrong fs type, bad option, bad superblock on /dev/mmcblk0p2, missing codepage or helper program, or other error.

My question is, is there something wrong with what I did or anything that I might not have been aware of?

Cheers.
Chadwick
  Reply
#2
Before moving on to an fstab entry you need to make sure you can mount the partition manually, which it seems you can't do yet. I suspect that's because the partition isn't vfat. There are several ways you can check which filesystem type it's using - I'm not sure which will be present by default on PmOS but here are some you can try:

lsblk -f
blkid /dev/mmcblk0p2
sudo file -sL /dev/mmcblk0p2

These will also show you the UUID of the partition - this is what should go in the fstab entry, not the disk identifier you used.
  Reply
#3
(11-19-2021, 04:09 AM)chadwick Wrote: Hi All,

On a linux desktop, one way to access your device is to edit the "/etc/fstab" to mount your device permanently so you can access it.

Reading postmarketOS's wiki about fstab, it told you to activate "rc-update" and the localmount service, which is the command:

Code:
sudo rc-update add localmount default

And to check whether the service is running:

Code:
rc-service localmount status

While blkid will return nothing, I use "sudo fdisk -l" to identify the UUID of the SD-Card, which gives:

Code:
Disk /dev/mmcblk0: 59.48 GiB, 63864569856 bytes, 124735488 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: Disk /dev/mmcblk0: 59.48 GiB, 63864569856 bytes, 124735488 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: DC11BA49-9C6F-4BC0-B775-E39576550622

Device           Start       End   Sectors  Size Type
/dev/mmcblk0p1    2048   1050623   1048576  512M EFI System
/dev/mmcblk0p2 1050624 124733439 123682816   59G Microsoft basic data


Device           Start       End   Sectors  Size Type
/dev/mmcblk0p1    2048   1050623   1048576  512M EFI System
/dev/mmcblk0p2 1050624 124733439 123682816   59G Microsoft basic data

Therefore, I edit my fstab to looks like the following:
Code:
UUID=DC11BA49-9C6F-4BC0-B775-E39576550622 /home/user/SDCard vfat defaults 0 0

On a reboot it did not give me anything in the folder. Upon the failure, I tried to mount the SDcard by using the mount command, which return error:-

Code:
sudo mount -t vfat -o ro /dev/mmcblk0p2 ~/SDCard
mount: /home/user/SDCard: wrong fs type, bad option, bad superblock on /dev/mmcblk0p2, missing codepage or helper program, or other error.

My question is, is there something wrong with what I did or anything that I might not have been aware of?

Cheers.
Chadwick


for me this worked:

sudo passwd
sudo blkid /dev/null >uuid.txt


edit
/etc/fstab

UUID= .....   /home/user/SDCard vfat defaults 0 0


sudo chmod 777 ~/SDCard
  Reply
#4
(11-19-2021, 05:01 AM)wibble Wrote: Before moving on to an fstab entry you need to make sure you can mount the partition manually, which it seems you can't do yet. I suspect that's because the partition isn't vfat. There are several ways you can check which filesystem type it's using - I'm not sure which will be present by default on PmOS but here are some you can try:

lsblk -f
blkid /dev/mmcblk0p2
sudo file -sL /dev/mmcblk0p2

These will also show you the UUID of the partition - this is what should go in the fstab entry, not the disk identifier you used.

Hi wibble,

Thanks for your reply. The mmcblk0p2's UUID clearly are different than what I thought it was after digging deeper into the device.

However, after probing into the mmcblk0p2, the type return with "dos". Other than 'vfat' or ext4, pmOS does not seems to know others type of format. I tried "ntfs" "ntfs-3g" for types which return unknown filetype. Is there a package that I needed to install first before it can read the filetype?

Cheers,
Chadwick

(11-20-2021, 03:31 AM)Juergen Wrote:
(11-19-2021, 04:09 AM)chadwick Wrote: Hi All,

On a linux desktop, one way to access your device is to edit the "/etc/fstab" to mount your device permanently so you can access it.

Reading postmarketOS's wiki about fstab, it told you to activate "rc-update" and the localmount service, which is the command:

Code:
sudo rc-update add localmount default

And to check whether the service is running:

Code:
rc-service localmount status

While blkid will return nothing, I use "sudo fdisk -l" to identify the UUID of the SD-Card, which gives:

Code:
Disk /dev/mmcblk0: 59.48 GiB, 63864569856 bytes, 124735488 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: Disk /dev/mmcblk0: 59.48 GiB, 63864569856 bytes, 124735488 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: DC11BA49-9C6F-4BC0-B775-E39576550622

Device           Start       End   Sectors  Size Type
/dev/mmcblk0p1    2048   1050623   1048576  512M EFI System
/dev/mmcblk0p2 1050624 124733439 123682816   59G Microsoft basic data


Device           Start       End   Sectors  Size Type
/dev/mmcblk0p1    2048   1050623   1048576  512M EFI System
/dev/mmcblk0p2 1050624 124733439 123682816   59G Microsoft basic data

Therefore, I edit my fstab to looks like the following:
Code:
UUID=DC11BA49-9C6F-4BC0-B775-E39576550622 /home/user/SDCard vfat defaults 0 0

On a reboot it did not give me anything in the folder. Upon the failure, I tried to mount the SDcard by using the mount command, which return error:-

Code:
sudo mount -t vfat -o ro /dev/mmcblk0p2 ~/SDCard
mount: /home/user/SDCard: wrong fs type, bad option, bad superblock on /dev/mmcblk0p2, missing codepage or helper program, or other error.

My question is, is there something wrong with what I did or anything that I might not have been aware of?

Cheers.
Chadwick


for me this worked:

sudo passwd
sudo blkid /dev/null >uuid.txt


edit
/etc/fstab

UUID= .....   /home/user/SDCard vfat defaults 0 0


sudo chmod 777 ~/SDCard
Hi Juergen,

Thank you for your reply. Would you mind elaborate a bit more, I do not see how that would help pmOS to read the SDCard that is format as 'dos' filetype.

Cheers
Chadwick
  Reply
#5
How exactly did you determine the filesystem type was 'dos'? That doesn't seem right. I don't know which PmOS supports, but 'cat /proc/filesystems' should tell you.
  Reply
#6
(11-22-2021, 07:02 AM)wibble Wrote: How exactly did you determine the filesystem type was 'dos'? That doesn't seem right. I don't know which PmOS supports, but 'cat /proc/filesystems' should tell you.

Hi wibble,

running "sudo -sL /dev/mmcblk0p2" and "sudo fdisk -l" gives me the following respectively:

/dev/mmcblk0p2: DOS/MBR boot sector

Device          Start      End  Sectors  Size Type
/dev/mmcblk0p1    2048  1050623  1048576  512M EFI System
/dev/mmcblk0p2 1050624 124733439 123682816  59G Microsoft basic data

And /proc/filesystems of PmOS shows:
nodev sysfs
nodev tmpfs
nodev bdev
nodev proc
nodev cgroup
nodev cgroup2
nodev cpuset
nodev devtmpfs
nodev configfs
nodev debugfs
nodev securityfs
nodev sockfs
nodev pipefs
nodev ramfs
nodev hugetlbfs
nodev rpc_pipefs
nodev devpts
          ext3
          ext4
          ext2
          vfat
nodev nfs
nodev nfs4
nodev autofs
          fuseblk
nodev fuse
nodev fusectl
nodev mqueue
          squashfs

Maybe I should try to format the sdcard into ext4 in order to use it?
  Reply
#7
I think it's formatted as exfat - at least on my desktop 'file -sL' says 'DOS/MBR boot sector' when run against an exfat formatted partition. The kernel on my desktop supports exfat so I can mount it, but it looks like PmOS may not. Perhaps look for an exfat package to install suitable kernel driver and userspace tools? If those don't exist then you'll have to reformat in a format it can mount.
  Reply
#8
(11-25-2021, 09:15 AM)wibble Wrote: I think it's formatted as exfat - at least on my desktop 'file -sL' says 'DOS/MBR boot sector' when run against an exfat formatted partition. The kernel on my desktop supports exfat so I can mount it, but it looks like PmOS may not. Perhaps look for an exfat package to install suitable kernel driver and userspace tools? If those don't exist then you'll have to reformat in a format it can mount.

Cheers, I will dig around for alpine/pmos if they provide exfat packages. I last recall reading somewhere there is such packages, but search through the apk by that name, nothing has show up, it might have changed its name or packages being quashed somehow.
  Reply
#9
(11-26-2021, 05:09 AM)chadwick Wrote:
(11-25-2021, 09:15 AM)wibble Wrote: I think it's formatted as exfat - at least on my desktop 'file -sL' says 'DOS/MBR boot sector' when run against an exfat formatted partition. The kernel on my desktop supports exfat so I can mount it, but it looks like PmOS may not. Perhaps look for an exfat package to install suitable kernel driver and userspace tools? If those don't exist then you'll have to reformat in a format it can mount.

Cheers, I will dig around for alpine/pmos if they provide exfat packages. I last recall reading somewhere there is such packages, but search through the apk by that name, nothing has show up, it might have changed its name or packages being quashed somehow.

Just to add a solution to the question if anyone might be facing the same problems.

In order for your PmOS to read a "DOS/MBR" (i.e. exfat) sdcard, you needed to install "fuse-exfat"

Code:
sudo apk add fuse-exfat
sudo mount -t exfat -o ro /dev/mmcblk0p2 ~/SDCard

For permanent mounting, please refer to the previous threads, edit your /etc/fstab, and use 'exfat' as the files type.
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How can I get the permissions to write to the external SD card ...? Peter Gamma 10 4,001 06-16-2024, 02:36 PM
Last Post: Peter Gamma
  How to create a file on the SD card I can modify on my Ubuntu PC? Peter Gamma 0 629 06-16-2024, 02:33 PM
Last Post: Peter Gamma
  How to write the the external SD card with Abword? Peter Gamma 0 785 08-27-2023, 01:10 AM
Last Post: Peter Gamma
  How can I open an Abiword file from an external SD card with Abiword? Peter Gamma 5 3,129 08-25-2023, 02:05 AM
Last Post: Peter Gamma
  Unable to mount root partition PostmarketOS lanawwas 0 3,312 09-06-2020, 07:42 AM
Last Post: lanawwas
  pmaports root & boot mount issue dustfinger 0 2,227 07-07-2020, 09:43 AM
Last Post: dustfinger
  PP boots into factory test even if flashed sd card is inserted hapster 5 7,484 04-13-2020, 02:34 PM
Last Post: MartijnBraam
  terminal command for sd card size pnphn 5 7,780 04-02-2020, 12:51 PM
Last Post: someGermanGuy

Forum Jump:


Users browsing this thread: 1 Guest(s)