sr358f服务器的硬盘,VM虚拟机模拟Linux服务器新增物理硬盘

1、关闭虚拟机,增加2张磁盘,模拟新增2块物理硬盘

00d9b24dceae359f821072bac4ccf0cb.png

099e52f7e75dc9138f37c57914017b5e.png

f22cc78261ad4363dacf988de29edba0.png

8531943f8ee721ed3bdccdacc550fd56.png

根据需求修改磁盘大小

aa2f14c93860b9f43895985c64e11868.png

1231506c8d425867d55201bb9e820159.png

添加完成后如图所示

2、启动服务器,以root登录

3、查看磁盘信息

[root@localhost /]# fdisk -l

Disk /dev/sda: 37.6 GB, 37580963840 bytes, 73400320 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 label type: dos

Disk identifier: 0x000ae75e

Device Boot Start End Blocks Id System

/dev/sda1 * 2048 2099199 1048576 83 Linux

/dev/sda2 2099200 62914559 30407680 8e Linux LVM

Disk /dev/sdb: 1073 MB, 1073741824 bytes, 2097152 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 /dev/sdc: 2147 MB, 2147483648 bytes, 4194304 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

4、分别对每个磁盘进行分区

[root@localhost /]# fdisk /dev/sdb

Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.

Be careful before using the write command.

Device does not contain a recognized partition table

Building a new DOS disklabel with disk identifier 0xa8bf9e37.

Command (m for help): m

Command action

a toggle a bootable flag

b edit bsd disklabel

c toggle the dos compatibility flag

d delete a partition

g create a new empty GPT partition table

G create an IRIX (SGI) partition table

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)

Command (m for help): n

Partition type:

p primary (0 primary, 0 extended, 4 free) #逻辑分区

e extended                                #扩展分区

Select (default p): p

Partition number (1-4, default 1):            #按回车取默认值

First sector (2048-2097151, default 2048):    #按回车取默认值

Using default value 2048

Last sector, +sectors or +size{K,M,G} (2048-2097151, default 2097151):

Using default value 2097151

Partition 1 of type Linux and of size 1023 MiB is set

Command (m for help): w                        #w回车保存设置

The partition table has been altered!

Calling ioctl() to re-read partition table.

Syncing disks.

[root@localhost /]# fdisk /dev/sdc

Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.

Be careful before using the write command.

Device does not contain a recognized partition table

Building a new DOS disklabel with disk identifier 0xe7c0c272.

Command (m for help): n

Partition type:

p primary (0 primary, 0 extended, 4 free)

e extended

Select (default p): p

Partition number (1-4, default 1):

First sector (2048-4194303, default 2048):

Using default value 2048

Last sector, +sectors or +size{K,M,G} (2048-4194303, default 4194303):

Using default value 4194303

Partition 1 of type Linux and of size 2 GiB is set

Command (m for help): w

The partition table has been altered!

Calling ioctl() to re-read partition table.

Syncing disks.

5、新增分区后再次查看磁盘信息

[root@localhost /]# fdisk -l

Disk /dev/sda: 37.6 GB, 37580963840 bytes, 73400320 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 label type: dos

Disk identifier: 0x000ae75e

Device Boot Start End Blocks Id System

/dev/sda1 * 2048 2099199 1048576 83 Linux

/dev/sda2 2099200 62914559 30407680 8e Linux LVM

Disk /dev/sdb: 1073 MB, 1073741824 bytes, 2097152 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 label type: dos

Disk identifier: 0xa8bf9e37

Device Boot Start End Blocks Id System

/dev/sdb1 2048 2097151 1047552 83 Linux

Disk /dev/sdc: 2147 MB, 2147483648 bytes, 4194304 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 label type: dos

Disk identifier: 0xe7c0c272

Device Boot Start End Blocks Id System

/dev/sdc1 2048 4194303 2096128 83 Linux

6、格式化分区

[root@localhost /]# mkfs -t ext4 /dev/sdb1

mke2fs 1.42.9 (28-Dec-2013)

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

Stride=0 blocks, Stripe width=0 blocks

65536 inodes, 261888 blocks

13094 blocks (5.00%) reserved for the super user

First data block=0

Maximum filesystem blocks=268435456

8 block groups

32768 blocks per group, 32768 fragments per group

8192 inodes per group

Superblock backups stored on blocks:

32768, 98304, 163840, 229376

Allocating group tables: done

Writing inode tables: done

Creating journal (4096 blocks): done

Writing superblocks and filesystem accounting information: done

[root@localhost /]# mkfs -t xfs /dev/sdc1

meta-data=/dev/sdc1 isize=512 agcount=4, agsize=131008 blks

= sectsz=512 attr=2, projid32bit=1

= crc=1 finobt=0, sparse=0

data = bsize=4096 blocks=524032, imaxpct=25

= sunit=0 swidth=0 blks

naming =version 2 bsize=4096 ascii-ci=0 ftype=1

log =internal log bsize=4096 blocks=2560, version=2

= sectsz=512 sunit=0 blks, lazy-count=1

realtime =none extsz=4096 blocks=0, rtextents=0

8、格式化后再次查看磁盘信息

[root@localhost /]# lsblk -f

NAME FSTYPE LABEL UUID MOUNTPOINT

sda

├─sda1 xfs e008266f-d10b-4b54-b2ce-902e28f1f8fe /boot

└─sda2 LVM2_member pCRmuu-Qdz1-BGnm-Z4hZ-3Eic-4uRx-CeEL5o

├─cl-root xfs 82e0dbc6-4e34-4ce3-8c51-2a37779e1041 /

└─cl-swap swap a9fdb3a2-c3be-4d58-9aca-d5308dd24c63 [SWAP]

sdb

└─sdb1 ext4 4698d481-b50d-433c-8476-855fe7ff5f64

sdc

└─sdc1 xfs 790ed65d-110d-40ee-b997-4a74274c5c70

sr0 iso9660 CentOS 7 x86_64 2016-12-05-13-55-45-00

9、新建文件夹并挂载分区

mkdir /data1/

mkdir /data2/

[root@localhost /]# mount /dev/sdb1 /data1/

[root@localhost /]# mount /dev/sdc1 /data2/

10、查看硬盘大小及挂载分区

[root@localhost /]# df -h

Filesystem Size Used Avail Use% Mounted on

/dev/mapper/cl-root 26G 8.1G 18G 32% /

devtmpfs 473M 0 473M 0% /dev

tmpfs 489M 84K 489M 1% /dev/shm

tmpfs 489M 7.1M 482M 2% /run

tmpfs 489M 0 489M 0% /sys/fs/cgroup

/dev/sda1 1014M 173M 842M 18% /boot

tmpfs 98M 0 98M 0% /run/user/0

tmpfs 98M 16K 98M 1% /run/user/42

/dev/sdb1 991M 2.6M 922M 1% /data1

/dev/sdc1 2.0G 33M 2.0G 2% /data2

[root@localhost /]# lsblk -f

NAME        FSTYPE      LABEL           UUID                                   MOUNTPOINT

sda

├─sda1      xfs                         e008266f-d10b-4b54-b2ce-902e28f1f8fe   /boot

└─sda2      LVM2_member                 pCRmuu-Qdz1-BGnm-Z4hZ-3Eic-4uRx-CeEL5o

├─cl-root xfs                         82e0dbc6-4e34-4ce3-8c51-2a37779e1041   /

└─cl-swap swap                        a9fdb3a2-c3be-4d58-9aca-d5308dd24c63   [SWAP]

sdb

└─sdb1      ext4                        4698d481-b50d-433c-8476-855fe7ff5f64   /data1

sdc

└─sdc1      xfs                         790ed65d-110d-40ee-b997-4a74274c5c70   /data2

sr0         iso9660     CentOS 7 x86_64 2016-12-05-13-55-45-00

11、配置开机自动挂载

[root@localhost /]# vim /etc/fstab

在最后加入下面内容

/dev/sdb1 /data1 ext4 defaults 0 0

/dev/sdc2 /data2 xfs defaults 0 0

12、重启服务器看配置是否生效

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值