linux6.5怎样增加硬盘,linux-centOs6.5 添加新的硬盘

添加的思路为:

扩展硬盘---添加新的主分区--分区格式为文件--挂载--自动挂载设置

一、扩展硬盘

Vmware增大硬盘空间

20180414212614465148.png

二、添加新的主分区

查看分区 fdisk -l

[[email protected] ~]# fdisk -l

Disk/dev/sda: 32.2 GB, 32212254720bytes255 heads, 63 sectors/track, 3916cylinders

Units= cylinders of 16065 * 512 = 8225280bytes

Sector size (logical/physical): 512 bytes / 512bytes

I/O size (minimum/optimal): 512 bytes / 512bytes

Disk identifier:0x00064f31Device Boot Start End Blocks Id System/dev/sda1 * 1 39 307200 83Linux

Partition1does not end on cylinder boundary./dev/sda2 39 2350 18566144 83Linux/dev/sda3 2350 2611 2097152 82 Linux swap /Solaris

创建分区

[[email protected] ~]# fdisk /dev/sda

WARNING: DOS-compatible mode is deprecated. It‘s strongly recommended to

switch off the mode (command ‘c‘) and change display units to

sectors (command‘u‘).

Command (mforhelp): n

Command action

e extended

p primary partition (1-4)

p

Selected partition4First cylinder (2611-3916, default 2611):

Using default value2611Last cylinder,+cylinders or +size{K,M,G} (2611-3916, default 3916):

Using default value3916Command (mfor help): wThe partition table has been altered!Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.

The kernel still uses the old table. The new table will be used at

the next reboot or after you run partprobe(8) or kpartx(8)

Syncing disks.

再次查看分区

[[email protected] ~]# fdisk -l

Disk/dev/sda: 32.2 GB, 32212254720bytes255 heads, 63 sectors/track, 3916cylinders

Units= cylinders of 16065 * 512 = 8225280bytes

Sector size (logical/physical): 512 bytes / 512bytes

I/O size (minimum/optimal): 512 bytes / 512bytes

Disk identifier:0x00064f31Device Boot Start End Blocks Id System/dev/sda1 * 1 39 307200 83Linux

Partition1does not end on cylinder boundary./dev/sda2 39 2350 18566144 83Linux/dev/sda3 2350 2611 2097152 82 Linux swap /Solaris/dev/sda4 2611 3916 10483750 83 Linux

partx -a /dev/sda4 /dev/sda ###########这个地方如果用partprobe会报错,这个是虚拟机下linux-centOs6.5的BUG

三、 分区格式为文件

]# reboot

##如果不重启。格式化会报错。

[[email protected]~]# mkfs.ext4 /dev/sda4

mke2fs1.41.12 (17-May-2010) Filesystem label=OS type:

Linux Block size=4096 (log=2) Fragment size=4096 (log=2) Stride=0 blocks, Stripe width=0blocks655360 inodes,

2620937blocks131046 blocks (5.00%) reserved forthe super user First data block=0Maximum filesystem blocks=2684354560 80 block groups 32768 blocks per group,

32768fragments per group8192inodes per group Superblock backups stored on blocks:32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632Writing inode tables:doneCreating journal (32768 blocks): doneWriting superblocks and filesystem accounting information:doneThis filesystem will be automatically checked every33mounts or180 days, whichever comes first. Use tune2fs -c or -i to override.

四、挂载

[[email protected] ~]# mount /dev/sda4 /opt

五、开机自动挂载

vi /etc/fstab

###在末尾加上以下内容

dev/sda4 /opt ext4 defaults 1 2

20180414212614919267.png

六、问题汇总

6.1- partprobe报错

Warning: WARNING: the kernel failed to re-read the partition table on /dev/sda (Device or resource busy).  As a result, it may not reflect all of your changes until after reboot.

请用这个命令: partx -a /dev/sda4 /dev/sda

原文:https://www.cnblogs.com/zhangmin1987/p/8835316.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值