How to use SharpExt4 to access Raspberry Pi SD Card Linux partition

In my previous post, I introduced the SharpExt4 .Net library. In this post, I will show how to use SharpExt4 to access the Raspberry Pi SD card from Windows OS.

  • Take out the Raspberry Pi SD card and insert it into a USB card reader
  • Run “diskpart” from Windows command prompt and find out the SD card disk number and partition number. In my case, the disk number is 3 and the partition is 2.
  • Clone the SharpExt4 from GitHub, and open Visual Studio as Admin

Note: If you want to access physical drive, you must run application in admin permission

  • Open SharpExt4 and edit the Program.cs from the Sample project
static void Main(string[] args)
{
    //Open Raspberry Pi SD card, see diskpart disk number
    var disk = ExtDisk.Open(3);
    //Get the file system, see diskpart partition number
    var fs = ExtFileSystem.Open(disk.Parititions[1]);
    //List all directories in root folder
    foreach (var file in fs.GetDirectories("/", "*", SearchOption.TopDirectoryOnly))
    {
        Console.WriteLine(file);
    }
}

Run the Sample project and see the result to list all the folders in Raspberry Pi root folder.

Leave a Reply

Your email address will not be published. Required fields are marked *