Format SD card on V4k for media

Hi guys,
I have a 64Gb xc sd card I like to keep it in V4K and use it like local storage for media files.
It showed up in the file manager, but I don’t see any menu to reformat it.
Could somebody explain how I can format it at command line, preferably in a Linux friendly type, not in NTSF?

I don’t use it to reinstall osmc, just to keep media on it.

Format it as exFAT in your PC and it will be fine.
Or you can format it as ext4 via the command line (a bit trickier)

I got no pc, my old Mac cannot read it…

Disk Utility will probably let you format it.

Assuming your sd card is /dev/sda (check with lsblk):

sudo umount /dev/sda*
sudo parted -s /dev/sda mklabel msdos -- mkpart primary ext4 16MiB -1s
sudo mkfs.ext4 /dev/sda1

No need to start at 16Mib; I start at 4096s usually.
I think op will need to sudo apt-get update && sudo apt-get install parted.

SD card is /dev/mmcblk1 (not mmcblk0) on Vero 4K.


We’ve discussed this before. The journal is 128MiB. I think it makes sense to make sure that fits into a number of whole erase blocks (AUs), which for an SDXC card are 16MiB. It may be chance, but the only card I’ve ever had fail was not aligned in this way.

Is this only the case for SDXC?
I’ve also seen better efforts at alignment than we do and I’m always open to suggestions.

Key places:


For sizes >32GB, AUs are 16MiB. For smaller cards (not tiny ones, too small for OSMC) AUs are 4MiB. So you could pretend all cards are SDXC and lose space or test for card capacity. These are the parameters I’m using:

# find out how big it is to determine AU size
	DISKSIZE=$(lsblk -blo NAME,SIZE | grep "$MEDIA " | sed 's/^\S*\s*\(\S*\)\s.*/\1/')
	if (( DISKSIZE > 33000000000)); then

	echo Formatting SD card $MEDIA
	parted -s /dev/$MEDIA mklabel msdos mkpart primary fat32 $BLANK $PART1 \
		&& parted /dev/"$MEDIA" set 1 lba on \
		&& parted -s /dev/$MEDIA -- mkpart primary ext4 $PART1 -1s

Some ppl put a small partition at the beginning instead of blank space. I haven’t researched the pros and cons of that.

Sorry to revive this topic, but it was the only useful topic found for “sd card ext4 vero4k” via search engines.

I just put a 64GB microSD card (Sandisk Ultra SDSQUNS-064G-GN3MN 64GB 80MB/s UHS-I Class 10 microSDXC Card) into my Vero4K, but it seems it got mounted as exFAT via FUSE. I’d rather use ext4.

However, I’m quite puzzled why you guys are either creating 2 partitions or start the first one 16MB into the card. Can you please explain why this is necessary? Is this just for alignment thus performance or does it also extend the life of the sd card?

There are no guides how to move the kodi library onto a sd card and/or external usb drive. Or maybe I missed them. I could copy the existing .kodi directory onto the card/drive and mount it over the one in my home directory. But is this the preferred way to do this or are there better options?

You are plugging in an already formatted card, so the Vero is going to use the current formatting. After all, you wouldn’t want it to just blindly reformat your SD card would you?

There is plenty of information here about how to format a drive (or SD Card) to ext4.

As to using it, you could just use fstab to mount the card at /home/osmc/.kodi

Then everything written to .kodi would actually end up on the SD card.

EDIT: if you also want to store media on it, then you should mount it to /home/osmc. If you only want media on it then it’s best to just let it automount and add the source in Kodi.

Ok, I am not an idiot. I’ve been working with Linux/Unix systems for over 20 years. So, yes, I want to do exactly that. Especially since it is a brand new card.

I get that and I know how to format a card to ext4. I don’t even need parted to do it. I was asking why you are creating 2 partitions instead of one. I even stated a few theories.

I know that you just want to help and that your explanation is perfectly valid. But this was also not my question. I know all of these things. What I do not know is, if this is the preferred way to do it or if there are other options that are more the “kodi way” like changing settings in the advanced settings file to write resources somewhere else.

Without being mean or unappreciative I kindly ask you to please look at my previous comment and look at the sentences with a question mark. I need answers to these questions, not some comments directed to the rest of the text I posted.

The card is being mounted as it’s already formatted. You need to reformat it if you want ext4. We are not writing any partition information to the card.

I’m sorry, I try it once again:

@grahamh wrote in this very topic the following command (in this comment) :

sudo parted -s /dev/sda mklabel msdos -- mkpart primary ext4 16MiB -1s

It creates an ext4 partition that does not start at the beginning of the storage. And I am asking why he’s doing that. So maybe I have to wait for @grahamh to answer that question.

1 Like

That’s why. I personally just reformat anything with one partition. But I don’t use SD cards much. There is a lot of voodoo with SD cards.

I think you are missing the entire discussion here. We might be talking past each other.

That’s not why. He meant that people sometimes also use an extra partition to align the real partition to the AUs. Naturally you don’t have to do that if you create a partition so that it is aligned right away.

I want to know about the background of the reasoning for aligning the filesystem with the AUs on the storage. And if it is a performance thing or a method to extend the lifetime of a card.

As for SD card if you want a fun read…

As for the moving of Kodi files I think you would need to explain exactly what you were wanting to move and why.

That’s far beyond the scope of this forum why people do this. These kinds of questions are probably better asked on a linux forum. He do have several people here knowledgeable on linux, but this type of question is very in-depth.

BTW, I have been using *nix since 1981, and I learn new things almost every day.

4 posts were split to a new topic: Moving Kodi Folder/Database to SD Card

It might have been, if not the owner and a moderator had started a discussion about it in this very topic.