Ubuntu 15.10 新增硬盘详细过程

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

查看硬盘信息

fdisk -l //执行查看命令

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

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

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

Disk /dev/xvdf: 53.7 GB,53687091200 bytes
255 heads,6527 cylinders,total 104857600 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 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 (1-4)

// Step 2

p <enter>

Partition number (1-4):

// Step 3

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 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=3820aaf5-a60e-4da8-b883-7d789482983f 挂载点 ext4 defaults

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

df -h

猜你在找的Ubuntu相关文章