1

I'm quite new to C# and I need to write a file (grub) on an EXt2 linux partition from windows 7.

What is the good way to do such thing? Do I need to mount the partition with external program?

4

5 回答 5

1

I think you need to mount it with an external program such as: http://www.fs-driver.org/

于 2010-11-16T17:41:47.423 回答
1

Mount the drive using a a driver like FS-driver and then write to it using standard C# file writing techniques.

于 2010-11-16T17:42:39.093 回答
0

您可以使用 Ext2Fsd 在 windows 中挂载分区,然后像任何其他分区一样写入。

EXT2FSD 主页

于 2010-11-16T17:44:20.677 回答
0

如果您在 Windows 下使用 Total Commander,可用插件之一是用于访问 ext2/3/4。这里可能已经提到过,但它使得从 Windows 访问 Linux 几乎是透明的。我现在没有安装它,否则我会看看名字。

于 2015-11-30T17:59:53.850 回答
0

SharpExt4 可以帮助您进行 Linux 文件系统的读写。

一个 .Net 库,提供对 Linux ext2/ext3/ext4 文件系统的完全访问(读/写)

这是 GitHub 链接 https://github.com/nickdu088/SharpExt4

//Open EXT4 SD Card
//Here is SD Card physical disk number. you can get from Windows disk manager
ExtDisk SharpExt4.ExtDisk.Open(int DiskNumber);
//In your case FAT32 is 1st one, ext4 is 2nd one
//Open EXT4 partition
var fs = ExtFileSystem.Open(disk.Parititions[1]); 

//Create /home/pi/file.conf file for write
var file = fs.OpenFile("/home/pi/file.conf", FileMode.Create, FileAccess.Write);
var hello = "Hello World";
var buf = Encoding.ASCII.GetBytes(hello);
//Write to file
file.Write(buf, 0, buf.Length);
file.Close();

如何使用 SharpExt4 访问树莓派 SD 卡 Linux 分区

于 2021-06-30T10:41:00.803 回答