龙空技术网

Linux系统下挂载本地或存储磁盘

鞍山土特产 224

前言:

此时朋友们对“centos挂载fc存储磁盘”大致比较注重,姐妹们都想要学习一些“centos挂载fc存储磁盘”的相关内容。那么小编也在网上收集了一些对于“centos挂载fc存储磁盘””的相关内容,希望朋友们能喜欢,姐妹们快快来学习一下吧!

[root@localhost hyt]# fdisk -l

WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.

磁盘 /dev/sdb:1099.5 GB, 1099511627776 字节,2147483648 个扇区

Units = 扇区 of 1 * 512 = 512 bytes

扇区大小(逻辑/物理):512 字节 / 512 字节

I/O 大小(最小/最佳):32768 字节 / 32768 字节

磁盘 /dev/sdc:2199.0 GB, 2199023255552 字节,4294967296 个扇区

Units = 扇区 of 1 * 512 = 512 bytes

扇区大小(逻辑/物理):512 字节 / 512 字节

I/O 大小(最小/最佳):32768 字节 / 32768 字节

[root@localhost hyt]# lsblk

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT

sda 8:0 0 67.1G 0 disk

├─sda1 8:1 0 500M 0 part /boot/efi

├─sda2 8:2 0 500M 0 part /boot

└─sda3 8:3 0 66.1G 0 part

├─centos-root 253:0 0 62.1G 0 lvm /

└─centos-swap 253:1 0 4G 0 lvm [SWAP]

sdb 8:16 0 1T 0 disk

sdc 8:32 0 2T 0 disk

sr0 11:0 1 1024M 0 rom

[root@localhost hyt]# df -h

文件系统 容量 已用 可用 已用% 挂载点

devtmpfs 3.5G 0 3.5G 0% /dev

tmpfs 3.5G 0 3.5G 0% /dev/shm

tmpfs 3.5G 11M 3.5G 1% /run

tmpfs 3.5G 0 3.5G 0% /sys/fs/cgroup

/dev/mapper/centos-root 63G 5.3G 57G 9% /

/dev/sda2 494M 162M 332M 33% /boot

/dev/sda1 500M 12M 489M 3% /boot/efi

tmpfs 712M 24K 712M 1% /run/user/1000

--------------- 对低于2T的磁盘分区--------------------

[root@localhost hyt]# fdisk /dev/sdb 对sdb分区

欢迎使用 fdisk (util-linux 2.23.2)。

更改将停留在内存中,直到您决定将更改写入磁盘。

使用写入命令前请三思。

Device does not contain a recognized partition table

使用磁盘标识符 0x47b09eab 创建新的 DOS 磁盘标签。

命令(输入 m 获取帮助):m

命令操作

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)

命令(输入 m 获取帮助):n 新分区

Partition type:

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

e extended

Select (default p): p

分区号 (1-4,默认 1):1 分区号

起始 扇区 (2048-2147483647,默认为 2048):

将使用默认值 2048

Last 扇区, +扇区 or +size{K,M,G} (2048-2147483647,默认为 2147483647):

将使用默认值 2147483647

分区 1 已设置为 Linux 类型,大小设为 1024 GiB

命令(输入 m 获取帮助):w 保存

The partition table has been altered!

Calling ioctl() to re-read partition table.

正在同步磁盘。

[root@localhost hyt]# lsblk

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT

sda 8:0 0 67.1G 0 disk

├─sda1 8:1 0 500M 0 part /boot/efi

├─sda2 8:2 0 500M 0 part /boot

└─sda3 8:3 0 66.1G 0 part

├─centos-root 253:0 0 62.1G 0 lvm /

└─centos-swap 253:1 0 4G 0 lvm [SWAP]

sdb 8:16 0 1T 0 disk

└─sdb1 8:17 0 1024G 0 part

sdc 8:32 0 2T 0 disk

sr0 11:0 1 1024M 0 rom

[root@localhost hyt]# mkfs -t ext4 /dev/sdb1 格式化磁盘

mke2fs 1.42.9 (28-Dec-2013)

文件系统标签=

OS type: Linux

块大小=4096 (log=2)

分块大小=4096 (log=2)

Stride=8 blocks, Stripe width=8 blocks

67108864 inodes, 268435200 blocks

13421760 blocks (5.00%) reserved for the super user

第一个数据块=0

Maximum filesystem blocks=2415919104

8192 block groups

32768 blocks per group, 32768 fragments per group

8192 inodes per group

Superblock backups stored on blocks:

32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,

4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,

102400000, 214990848

Allocating group tables: 完成

正在写入inode表: 完成

Creating journal (32768 blocks): 完成

Writing superblocks and filesystem accounting information: 完成

[root@localhost hyt]# lsblk -f

NAME FSTYPE LABEL UUID MOUNTPOINT

sda

├─sda1 vfat 3BA6-CE02 /boot/efi

├─sda2 xfs 06042703-5ccb-4efc-9b9c-9f0e299a008f /boot

└─sda3 LVM2_member FJYBBO-GEzk-yUP3-T3rF-g8ph-dJU9-1351iw

├─centos-root xfs e813e80a-049c-44d0-9699-1c6ddb20e8f0 /

└─centos-swap swap 35b7ff03-dde9-4bef-827f-ea89514c8b4d [SWAP]

sdb

└─sdb1 ext4 4ee56c29-3259-41dd-91de-bad3a67fe02c

sdc

sr0

[root@localhost hyt]# cd /

[root@localhost /]# mkdir newdisk 创建newdisk挂载目录

[root@localhost /]# mount /dev/sdb1 /newdisk 挂载sdb1到newdisk

[root@localhost /]# lsblk -f

NAME FSTYPE LABEL UUID MOUNTPOINT

sda

├─sda1 vfat 3BA6-CE02 /boot/efi

├─sda2 xfs 06042703-5ccb-4efc-9b9c-9f0e299a008f /boot

└─sda3 LVM2_member FJYBBO-GEzk-yUP3-T3rF-g8ph-dJU9-1351iw

├─centos-root xfs e813e80a-049c-44d0-9699-1c6ddb20e8f0 /

└─centos-swap swap 35b7ff03-dde9-4bef-827f-ea89514c8b4d [SWAP]

sdb

└─sdb1 ext4 4ee56c29-3259-41dd-91de-bad3a67fe02c /newdisk

sdc

└─sdc1 ext4 28ecb7ae-4a9a-481e-88f1-f20c3e971e94

sr0

[

sda 8:0 0 67.1G 0 disk

├─sda1 8:1 0 500M 0 part /boot/efi

├─sda2 8:2 0 500M 0 part /boot

└─sda3 8:3 0 66.1G 0 part

├─centos-root 253:0 0 62.1G 0 lvm /

└─centos-swap 253:1 0 4G 0 lvm [SWAP]

sdb 8:16 0 1T 0 disk

└─sdb1 8:17 0 1024G 0 part /newdisk

sdc 8:32 0 2T 0 disk

└─sdc1 8:33 0 2T 0 part /newdisk

sr0 11:0 1 1024M 0 rom

[root@localhost /]# blkid

/dev/mapper/centos-root: UUID="e813e80a-049c-44d0-9699-1c6ddb20e8f0" TYPE="xfs"

/dev/sda3: UUID="FJYBBO-GEzk-yUP3-T3rF-g8ph-dJU9-1351iw" TYPE="LVM2_member" PARTUUID="21fc02d5-cfd4-4c9b-8085-039f546b32f6"

/dev/sda1: SEC_TYPE="msdos" UUID="3BA6-CE02" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="bb4def31-0b2b-4543-90dd-27d690636b8e"

/dev/sda2: UUID="06042703-5ccb-4efc-9b9c-9f0e299a008f" TYPE="xfs" PARTUUID="f10cc19b-9b40-435c-8944-983773f957c5"

/dev/mapper/centos-swap: UUID="35b7ff03-dde9-4bef-827f-ea89514c8b4d" TYPE="swap"

/dev/sdb1: UUID="4ee56c29-3259-41dd-91de-bad3a67fe02c" TYPE="ext4"

/dev/sdc1: UUID="28ecb7ae-4a9a-481e-88f1-f20c3e971e94" TYPE="ext4"

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

按insert开始输入

最后两行

/dev/sdb1 /newdisk2 auto nosuid,nodev,nofail,x-gvfs-show,_netdev 0 0

Esc 输入 :wq 保存退出

[root@localhost /]# mount -a 挂载

--------------- 对高于2T的磁盘分区--------------------

磁盘 /dev/sdd:3298.5 GB, 3298534883328 字节,6442450944 个扇区

Units = 扇区 of 1 * 512 = 512 bytes

扇区大小(逻辑/物理):512 字节 / 512 字节

I/O 大小(最小/最佳):32768 字节 / 32768 字节

(parted) quit

[root@localhost /]# lsblk

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT

sda 8:0 0 67.1G 0 disk

├─sda1 8:1 0 500M 0 part /boot/efi

├─sda2 8:2 0 500M 0 part /boot

└─sda3 8:3 0 66.1G 0 part

├─centos-root 253:0 0 62.1G 0 lvm /

└─centos-swap 253:1 0 4G 0 lvm [SWAP]

sdb 8:16 0 1T 0 disk

└─sdb1 8:17 0 1024G 0 part /newdisk2

sdc 8:32 0 2T 0 disk

└─sdc1 8:33 0 2T 0 part /newdisk

sdd 8:48 0 3T 0 disk

sr0 11:0 1 1024M 0 rom

[root@localhost /]# parted /dev/sdd 高于2T分区用parted

GNU Parted 3.1

使用 /dev/sdd

Welcome to GNU Parted! Type 'help' to view a list of commands.

(parted) print

Model: INSPUR MCS (scsi)

Disk /dev/sdd: 3299GB

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

Partition Table: msdos

Disk Flags:

Number Start End Size Type File system 标志

(parted) mklabel gpt

警告: The existing disk label on /dev/sdd will be destroyed and all data on

this disk will be lost. Do you want to continue?

是/Yes/否/No? yes

(parted) print

Model: INSPUR MCS (scsi)

Disk /dev/sdd: 3299GB

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

Partition Table: gpt

Disk Flags:

Number Start End Size File system Name 标志

(parted) mkpart primary 0KB 3299GB

警告: You requested a partition from 0.00B to 3299GB (sectors

0..6442450943).

The closest location we can manage is 17.4kB to 3299GB (sectors

34..6442450910).

Is this still acceptable to you?

是/Yes/否/No? Y

警告: The resulting partition is not properly aligned for best performance.

忽略/Ignore/放弃/Cancel? I

(parted) print

Model: INSPUR MCS (scsi)

Disk /dev/sdd: 3299GB

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

Partition Table: gpt

Disk Flags:

Number Start End Size File system Name 标志

1 17.4kB 3299GB 3299GB primary

(parted) quit

信息: You may need to update /etc/fstab.

[root@localhost /]# lsblk

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT

sda 8:0 0 67.1G 0 disk

├─sda1 8:1 0 500M 0 part /boot/efi

├─sda2 8:2 0 500M 0 part /boot

└─sda3 8:3 0 66.1G 0 part

├─centos-root 253:0 0 62.1G 0 lvm /

└─centos-swap 253:1 0 4G 0 lvm [SWAP]

sdb 8:16 0 1T 0 disk

└─sdb1 8:17 0 1024G 0 part /newdisk2

sdc 8:32 0 2T 0 disk

└─sdc1 8:33 0 2T 0 part /newdisk

sdd 8:48 0 3T 0 disk

└─sdd1 8:49 0 3T 0 part

sr0 11:0 1 1024M 0 rom

[root@localhost /]# mkfs -t ext4 /dev/sdd1 格式化sdd1

mke2fs 1.42.9 (28-Dec-2013)

/dev/sdd1 alignment is offset by 15360 bytes.

This may result in very poor performance, (re)-partitioning suggested.

文件系统标签=

OS type: Linux

块大小=4096 (log=2)

分块大小=4096 (log=2)

Stride=8 blocks, Stripe width=8 blocks

201326592 inodes, 805306359 blocks

40265317 blocks (5.00%) reserved for the super user

第一个数据块=0

Maximum filesystem blocks=2952790016

24576 block groups

32768 blocks per group, 32768 fragments per group

8192 inodes per group

Superblock backups stored on blocks:

32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,

4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,

102400000, 214990848, 512000000, 550731776, 644972544

Allocating group tables: 完成

正在写入inode表: 完成

Creating journal (32768 blocks): 完成

Writing superblocks and filesystem accounting information: 完成

[root@localhost /]# lsblk -f

NAME FSTYPE LABEL UUID MOUNTPOINT

sda

├─sda1 vfat 3BA6-CE02 /boot/efi

├─sda2 xfs 06042703-5ccb-4efc-9b9c-9f0e299a008f /boot

└─sda3 LVM2_member FJYBBO-GEzk-yUP3-T3rF-g8ph-dJU9-1351iw

├─centos-root

xfs e813e80a-049c-44d0-9699-1c6ddb20e8f0 /

└─centos-swap

swap 35b7ff03-dde9-4bef-827f-ea89514c8b4d [SWAP]

sdb

└─sdb1 ext4 4ee56c29-3259-41dd-91de-bad3a67fe02c /newdisk2

sdc

└─sdc1 ext4 28ecb7ae-4a9a-481e-88f1-f20c3e971e94 /newdisk

sdd

└─sdd1 ext4 0b67934e-c50d-49eb-a420-4fdcef64bdcf

sr0

[root@localhost /]# cd /

[root@localhost /]# ls

bin data etc lib media newdisk opt root sbin sys usr

boot dev home lib64 mnt newdisk2 proc run srv tmp var

[root@localhost /]# mkdir newdisk1 创建挂载点 newdisk1

[root@localhost /]# vim /etc/fstab 修改启动文件

按insert开始输入

最后一行添加

/dev/sdd1 /newdisk1 auto nosuid,nodev,nofail,x-gvfs-show,_netdev 0 0

Esc 输入 :wq 保存退出

[root@localhost /]# mount -a 挂载

[root@localhost /]# df -h

文件系统 容量 已用 可用 已用% 挂载点

devtmpfs 3.5G 0 3.5G 0% /dev

tmpfs 3.5G 0 3.5G 0% /dev/shm

tmpfs 3.5G 10M 3.5G 1% /run

tmpfs 3.5G 0 3.5G 0% /sys/fs/cgroup

/dev/mapper/centos-root 63G 5.3G 57G 9% /

/dev/sda2 494M 162M 332M 33% /boot

/dev/sda1 500M 12M 489M 3% /boot/efi

/dev/sdc1 2.0T 81M 1.9T 1% /newdisk

tmpfs 712M 12K 712M 1% /run/user/42

tmpfs 712M 0 712M 0% /run/user/1000

/dev/sdb1 1008G 77M 957G 1% /newdisk2

/dev/sdd1 3.0T 89M 2.9T 1% /newdisk1

标签: #centos挂载fc存储磁盘