Ubuntu 15.10 新增硬盘详细过程

前端之家收集整理的这篇文章主要介绍了Ubuntu 15.10 新增硬盘详细过程前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

查看硬盘信息

fdisk -l //执行查看命令

命令执行完后会输入类似下面的信息,找到需要增加的硬盘盘符,例如/dev/sda

Disk /dev/xvda: @H_404_12@75.2 GB,@H_404_12@75161927680 bytes
@H_404_12@255 heads,@H_404_12@63 sectors/track,@H_404_12@9137 cylinders,total @H_404_12@146800640 sectors
Units = sectors of @H_404_12@1 * @H_404_12@512 = @H_404_12@512 bytes
Sector size (logical/physical): @H_404_12@512 bytes / @H_404_12@512 bytes
I/O size (minimum/optimal): @H_404_12@512 bytes / @H_404_12@512 bytes
Disk identifier: @H_404_12@0x00000000

    Device Boot      Start         End      Blocks   Id  System
/dev/xvda1   *       @H_404_12@16065   @H_404_12@146785904    @H_404_12@73384920   @H_404_12@83  Linux

Disk /dev/xvdf: @H_404_12@53.7 GB,@H_404_12@53687091200 bytes
@H_404_12@255 heads,@H_404_12@6527 cylinders,total @H_404_12@104857600 sectors
Units = sectors of @H_404_12@1 * @H_404_12@512 = @H_404_12@512 bytes
Sector size (logical/physical): @H_404_12@512 bytes / @H_404_12@512 bytes
I/O size (minimum/optimal): @H_404_12@512 bytes / @H_404_12@512 bytes
Disk identifier: @H_404_12@0x00000000

Disk /dev/xvdf doesn't contain a valid partition table

硬盘设置

sudo fdisk /dev/xvdf

执行命令后,按如下顺序进行设置(Step 1­4)

Command (m for help): m <enter>

Command action

a toggle a bootable flag

b edit bsd disklabel

c toggle the dos compatibility flag

d delete a partition

l list known partition types

m print this menu

n add a new partition

o create a new empty DOS partition table

p print the partition table

q quit without saving changes

s create a new empty Sun disklabel

t change a partition's system id

u change display/entry units

v verify the partition table

w write table to disk and exit

x extra functionality (experts only)

// Step 1

Command (m for help):n <enter>

Command action

e extended

p primary partition (@H_404_12@1-@H_404_12@4)

// Step 2

p <enter>

Partition number (@H_404_12@1-@H_404_12@4):

// Step 3

@H_404_12@1 <enter>

// Step 4

Command (m for help):w

The partition table has been altered!

Calling ioctl() to re-read partition table.

Syncing disks.

格式化

sudo mke2fs -j /dev/xvdf

修改保留空间

sudo tune2fs -m @H_404_12@1 /dev/xvdf

设置挂载点

新建文件夹(挂载点)

sudo mkdir /Backup

挂载(临时)

sudo mount /dev/xvdf /Backup

设置启动挂载

查看磁盘UUID

ls -l /dev/disk/by-uuid

备份配置文件(切记,一定要备份后再进行操作)

sudo cp /etc/fstab /etc/fstab_bk

将对应的UUID(例如/dev/sda)添加配置文件中,例如:

UUID=@H_404_12@3820aaf5-a60e-@H_404_12@4da8-b883-@H_404_12@7d789482983f 挂载点 ext4 defaults

重启后即可看到新挂载的硬盘

df -h

猜你在找的Ubuntu相关文章