Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Next revision Both sides next revision
tutorial:oc3_hard_drives:zh [2022/08/11 05:12]
fight_xing created
tutorial:oc3_hard_drives:zh [2022/08/11 12:55]
fight_xing [OC 教程:硬盘]
Line 2: Line 2:
 ================= =================
  
-当你 [[tutorial:​oc2_writing_code:​zh|编写程序]] 时,通常是希望程序文件一直存在的,所以使用 `/tmp` 目录并不是长久之计。将 [[item:hdd|硬盘(英文)]]放入计算机,它将自动挂载在 `/mnt` 目录下。并以其地址的前几个字母命名。尽管这可能已经够用了,但是你可能想知道如何灵活且优雅地使用它。本教程将会讲述标签与安装硬盘的概念。+当你 [[tutorial:​oc2_writing_code:​zh|编写程序]] 时,通常是希望程序文件一直存在的,所以使用 `/tmp` 目录并不是长久之计。将 [[item:hard_disk_drive:​zh|硬盘]] 放入计算机,它将自动挂载在 `/mnt` 目录下。并以其地址的前几个字母命名。尽管这可能已经够用了,但是你可能想知道如何灵活且优雅地使用它。本教程将会讲述标签与安装硬盘的概念。
  
-*注意*:本教程的所有内容同样适用于 [[item:floppy|软盘(英文)]]。+*注意*:本教程的所有内容同样适用于 [[item:floppy_disk:​zh|软盘]]。
  
 首先,将一个全新的硬盘插入计算机: 首先,将一个全新的硬盘插入计算机:
Line 21: Line 21:
 {{https://​i.imgur.com/​X1ws656.png?​700}} {{https://​i.imgur.com/​X1ws656.png?​700}}
  
-We can now mount the hard drive while referring to it by name. Type `mount <​label>​ <​path>​` to mount the hard drive with the specified label at the specified path. Hard drives can be mounted in multiple locations, so doing that will not invalidate the default mount in the `/mnt` folder. 
 我们现在可以通过使用硬盘名称的方法挂载它了。输入 `mount <​名称>​ <​路径>​` 来挂载带有给定标签、位于给定路径的硬盘。硬盘可以被挂载到不同位置, 我们现在可以通过使用硬盘名称的方法挂载它了。输入 `mount <​名称>​ <​路径>​` 来挂载带有给定标签、位于给定路径的硬盘。硬盘可以被挂载到不同位置,
  
Line 30: Line 29:
 {{https://​i.imgur.com/​QYgrS3z.png?​700}} {{https://​i.imgur.com/​QYgrS3z.png?​700}}
  
-自动运行脚本需要获取储存介质的代理作为它们的第一个参数,所以我们可以使用 Lua 的变长语句获取它。我们会将它传递到 `fs.mount()` 函数,你可以在 [[api:​filesystem|文件系统 API(英文)]] 找到它的文档。+自动运行脚本需要获取储存介质的代理作为它们的第一个参数,所以我们可以使用 Lua 的变长语句获取它。我们会将它传递到 `fs.mount()` 函数,你可以在 [[api:​filesystem:zh|文件系统 API]] 找到它的文档。
  
 {{https://​i.imgur.com/​J5inxhI.png?​700}} {{https://​i.imgur.com/​J5inxhI.png?​700}}
  
-Save that file and close it. After removing the hard disk from the computer and inserting it again, run `ls` and you should see the disk has been automatically mounted again. 
 保存并关闭文件。在从电脑移除并重新插入硬盘后,运行 `ls`,你就会发现硬盘已经被自动挂载了。 保存并关闭文件。在从电脑移除并重新插入硬盘后,运行 `ls`,你就会发现硬盘已经被自动挂载了。