sh 创建新分区,创建新文件系统,安装新磁盘

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh 创建新分区,创建新文件系统,安装新磁盘相关的知识,希望对你有一定的参考价值。

#!/bin/bash

1. Create a volume in DTSS and add it to you instance.  Allow the volume to associate itself with the instance.  This may take a little while.

2. View current layout
fdisk -l

3. View the current layout and observe the new disk.
fdisk -l

4. Partition the disk
sed -e 's/\s*\([\+0-9a-zA-Z]*\).*/\1/' << EOF | fdisk /dev/vdb
  n # new partition
  p # primary partition
  1 # partition number 1
    # default, start immediately after preceding partition
    # default, extend partition to end of disk
  t # make a partition bootable
  83 # bootable partition is partition 1 -- /dev/sda1
  w # write the partition table
  q # and we're done
EOF

6. Create the filesystem
mkfs.ext4 /dev/vdb1

7. Make the directory that you want to mount the partition to
mkdir /var/lib/docker

8. Mount it
mount /dev/vdb1 /var/lib/docker

9. Add the following line to the /etc/fstab file.
/dev/vdb1         /var/lib/docker                   ext4    defaults        0 0

以上是关于sh 创建新分区,创建新文件系统,安装新磁盘的主要内容,如果未能解决你的问题,请参考以下文章

Linux中如何创建新分区啊?

Linux 磁盘分区,文件系统创建挂载和卸载

磁盘使用:分区,创建文件系统,挂载

windows7如何添加新磁盘 ?

如何在 Linux 中将主目录移动到新分区或磁盘?

linux添加新硬盘怎么做 要如何分区