我正在尝试使用java访问主启动记录扇区,我已经在Windows中完成了,但我使用的地址在ubuntu中无效。这是我的代码:
File diskRoot = new File("\\\\.\\PhysicalDrive0");
final RandomAccessFile diskAccess = new RandomAccessFile(diskRoot, "r");
byte content[] = new byte[512];
diskAccess.readFully(content);
任何人都可以在ubuntu中告诉我应该输入什么而不是“\\。\ PhysicalDrive0”吗?
答案 0 :(得分:0)
我猜你必须在下面的命令之前运行才能将MBR复制到文件中:
$ dd if=/dev/sda of=yourMBR.bin bs=512 count=1
我不知道你是否可以在Linux上避免这一步。