新购存储

在购买新的Volume后,控制台页面已经给了一份操作说明,在此做一份记录

1. To get started with a new volume, you'll want to create a filesystem on it:

译: 要开始使用新卷,你需要在其上(指这块Volume)创建一个文件系统。

意指为新的硬盘需要格式化,就像个人电脑安装新硬盘一样,不过这里需要注意的是Linux的存储文件系统格式推荐为ext4

# 创建文件系统ext4(后面的路径为Linode控制台页面给出的路径,每个人实际上可能会有不同的路径)
mkfs.ext4 "/dev/disk/by-id/****-*Linode_Volume_disk1"

2. Once the volume has a filesystem, you can create a mountpoint for it:

译: 卷有文件系统后,您可以为它创建一个挂载点:

# 为新Volume准备一个路径作为挂载点
# 这个路径可以按个人需求进行更改
mkdir "/mnt/disk1"

3. Then you can mount the new volume:

译: 接下来你就可以挂载新'卷'Volume了

# 前路径为硬盘路径,后路径为挂载路径
mount "/dev/disk/by-id/****-*Linode_Volume_disk1" "/mnt/disk1"

4. If you want the volume to automatically mount every time your Linode boots, you'll want to add a line like the following to your /etc/fstab file:

译: 如果您希望每次Linode引导时都自动挂载卷,您需要在/etc/fstab文件中添加如下所示的行:

这里就是指的开机就挂载的意思。这个当然是必须的,否则多买了这么块存储闲置着干嘛,而且如果你的资料或程序安装到了这块存储上,如果开机没有加载,会导致其他引用了该存储的程序产生一些不可预知的问题。

# 编辑 /etc/fstab
nano /etc/fstab

# 在文件最后一行添加以下内容
/dev/disk/by-id/****-*Linode_Volume_disk1 /mnt/disk1 ext4 defaults,noatime,nofail 0 2

至此,新的Volume已经可以使用了。

注: 文中指令中出现的所有硬盘路径,应替换为你实际使用中在Linode控制台拿到的路径,切勿无脑粘贴复制!!!*

2019/07/29

扩展(Resize)

后来发现上次买的体积不够用,于是这次打算扩展一下体积,于是官方又给了一份操作说明:

1.After the volume resize is complete, you'll need to restart your Linode for the changes to take effect. Once your Linode has restarted, make sure the volume is unmounted for safety:

译:'卷'调整大小完成后,您需要重新启动Linode才能使更改生效。在您的Linode重新启动后,请确保已卸载卷以确保安全

# 取消挂载
umount /dev/disk/by-id/****-*Linode_Volume_disk1

2.Assuming you have an ext2, ext3, or ext4 partition, first run a file system check, then resize it to fill the new volume size:

译:假设您的系统中有ext2、ext3或ext4分区,首先运行文件系统检查,然后调整其大小以填充新的卷大小

# 检查文件系统
e2fsck -f /dev/disk/by-id/****-*Linode_Volume_disk1
# 调整大小
resize2fs /dev/disk/by-id/****-*Linode_Volume_disk1

3.Now mount it back onto the filesystem:

译:接下来你可以把这块'卷'重新挂载到你的系统中了

mount /dev/disk/by-id/****-*Linode_Volume_disk1 /mnt/disk1