linux vm 加硬盘,VM-linux中增加一块硬盘(学习做记录)

1。增加前先关闭VM,然后编辑VM属性,增加一个vritual disk(scsi),其实是增加一个虚拟磁盘文件。

1afd276b19fa55248d82c2bc25855738.gif

hard disk2就是我新增加的

2。查看目前的磁盘结构

[root@mail ~]# fdisk -l

Disk /dev/sda: 10.7 GB, 10737418240 bytes

255 heads, 63 sectors/track, 1305 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

/dev/sda1 * 1 13 104391 83 Linux

/dev/sda2 14 905 7164990 83 Linux

/dev/sda3 906 1032 1020127+ 83 Linux

/dev/sda4 1033 1305 2192872+ 5 Extended

/dev/sda5 1033 1159 1020096 82 Linux swap / Solaris

/dev/sda6 1160 1305 1172713+ 83 Linux

Disk /dev/sdb: 1073 MB, 1073741824 bytes

255 heads, 63 sectors/track, 130 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

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

//说明磁盘/dev/sdb还没有被系统识别

3。分区

[root@mail ~]# fdisk /dev/sbd

Command (m for help): n//输入m获得帮助信息,n创建分区

Command action

e extended

p primary partition (1-4)

p //创建主分区

Partition number (1-4): 1//指定分区的起始柱面First cylinder (1-130, default 1):

Using default value 1

Last cylinder or +size or +sizeM or +sizeK (1-130, default 130): //设置分区容量,直接回车表示全部

Using default value 130

Command (m for help): t//改变一个分区的系统ID

Selected partition 1

Hex code (type L to list codes): L//查看文件类型对应的Hex

85 Linux extended //linux ext3的hex是85

Hex code (type L to list codes): 85

You cannot change a partition into an extended one or vice versa

Delete it first.

Command (m for help): p//列出当前硬盘的分区

Disk /dev/sdb: 1073 MB, 1073741824 bytes

255 heads, 63 sectors/track, 130 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

/dev/sdb1 1 130 1044193+ 83 Linux

Command (m for help): w//保存

The partition table has been altered!

Calling ioctl() to re-read partition table.

Syncing disks.

4。查看现在的分区

[root@mail ~]# fdisk -l

Disk /dev/sda: 10.7 GB, 10737418240 bytes

255 heads, 63 sectors/track, 1305 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

/dev/sda1 * 1 13 104391 83 Linux

/dev/sda2 14 905 7164990 83 Linux

/dev/sda3 906 1032 1020127+ 83 Linux

/dev/sda4 1033 1305 2192872+ 5 Extended

/dev/sda5 1033 1159 1020096 82 Linux swap / Solaris

/dev/sda6 1160 1305 1172713+ 83 Linux

Disk /dev/sdb: 1073 MB, 1073741824 bytes

255 heads, 63 sectors/track, 130 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

/dev/sdb1 1 130 1044193+ 83 Linux

5。格式化分区

[root@mail ~]# mkfs.ext3 /dev/sdb1 //格式化成ext3格式

6。挂载分区

[root@mail ~]# mount /dev/sdb1 /tmp

[root@mail ~]# df -h /tmp

Filesystem Size Used Avail Use% Mounted on

/dev/sdb1 1004M 1.3M 952M 1% /tmp

7。自动挂载

修改/etc/fstab

增加一行

/dev/sdb1 /sdb1 ext3 defaults 0 0

重起

学习做记录备份,谢谢分享

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值