Linux 使用新磁盘

[root@node3 ~]# fdisk -l
Disk /dev/sda: 450.1 GB, 450098159616 bytes, 879097968 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: 0x0008bf0a
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048   307202047   153600000   83  Linux
/dev/sda2       307202048   311396351     2097152   82  Linux swap / Solaris
/dev/sda3       311396352   879097855   283850752   83  Linux
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.

Disk /dev/sdb: 2000.4 GB, 2000398934016 bytes, 3907029168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk label type: gpt
#         Start          End    Size  Type            Name
 1         2048   3907028991    1.8T  Microsoft basic primary

[root@node3 ~]# blkid
/dev/sda1: UUID="cfaf8070-bbc7-42ab-b067-16f2cd2c42bf" TYPE="xfs"
/dev/sda2: UUID="1570bf23-e3f4-4b42-88b1-ecc1d51ded37" TYPE="swap"
/dev/sda3: UUID="334c3e5e-f584-4702-8560-98fa7e85a10b" TYPE="xfs"
/dev/sdb1: PARTLABEL="primary" PARTUUID="8380a4cd-bd4e-4972-9ecc-2997b7557595"

[root@node3 /]# mkfs.xfs /dev/sdb1
meta-data=/dev/sdb1              isize=256    agcount=4, agsize=122094592 blks
         =                       sectsz=4096  attr=2, projid32bit=1
         =                       crc=0        finobt=0
data     =                       bsize=4096   blocks=488378368, imaxpct=5
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=0
log      =internal log           bsize=4096   blocks=238466, version=2
         =                       sectsz=4096  sunit=1 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0

[root@node3 /]# mkdir sdb

[root@node3 /]# mount /dev/sdb1 /sdb/


[root@node3 /]# mount -a
[root@node3 /]# mount


[root@node3 /]# blkid
/dev/sda1: UUID="cfaf8070-bbc7-42ab-b067-16f2cd2c42bf" TYPE="xfs"
/dev/sda2: UUID="1570bf23-e3f4-4b42-88b1-ecc1d51ded37" TYPE="swap"
/dev/sda3: UUID="334c3e5e-f584-4702-8560-98fa7e85a10b" TYPE="xfs"
/dev/sdb1: UUID="a7cb920d-db34-45d0-a4ad-d968a241119f" TYPE="xfs" PARTLABEL="primary" PARTUUID="8380a4cd-bd4e-4972-9ecc-2997b7557595"

设置开机启动自动挂载
[root@node3 /]# vi /etc/fstab

#
# /etc/fstab
# Created by anaconda on Sat Dec  3 08:06:02 2016
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=cfaf8070-bbc7-42ab-b067-16f2cd2c42bf /                       xfs     defaults        0 0
UUID=334c3e5e-f584-4702-8560-98fa7e85a10b /data                   xfs     defaults        0 0
UUID=1570bf23-e3f4-4b42-88b1-ecc1d51ded37 swap                    swap    defaults        0 0
UUID=a7cb920d-db34-45d0-a4ad-d968a241119f  /sdb                   xfs     defaults        0 0



2017-06-07 发现挂载的磁盘sdb不能使用了


[root@node3/]# ll
ls: cannot access sdb: Input/output error
total 36
lrwxrwxrwx.   1 root root    7 Dec  3  2016 bin -> usr/bin
dr-xr-xr-x.   4 root root 4096 Dec  3  2016 boot
drwxr-xr-x.   4 root root   27 Apr 27 19:26 data
drwxr-xr-x.  19 root root 3360 Mar  3 13:35 dev
drwxr-xr-x. 147 root root 8192 Jun  7 08:27 etc
drwxr-xr-x.   5 root root   50 Jan 18 14:10 home
lrwxrwxrwx.   1 root root    7 Dec  3  2016 lib -> usr/lib
lrwxrwxrwx.   1 root root    9 Dec  3  2016 lib64 -> usr/lib64
drwxr-xr-x.   2 root root    6 Aug 12  2015 media
drwxr-xr-x.   3 root root   20 Jan 16 09:55 mnt
drwxr-xr-x.  13 root root 4096 Apr 27 19:25 opt
dr-xr-xr-x. 533 root root    0 Dec  5  2016 proc
dr-xr-x---.  20 root root 4096 May  5 16:16 root
drwxr-xr-x.  45 root root 1400 Jun  7 06:43 run
lrwxrwxrwx.   1 root root    8 Dec  3  2016 sbin -> usr/sbin
???????????   ? ?    ?       ?            ? sdb
drwxr-xr-x.   2 root root    6 Aug 12  2015 srv
dr-xr-xr-x.  13 root root    0 Dec  5  2016 sys
drwxrwxrwt.  18 root root 4096 Jun  7 08:23 tmp
drwxr-xr-x.  14 root root 4096 Dec 17 16:27 usr
drwxr-xr-x.  21 root root 4096 Dec  5  2016 var


寻求解决办法:


[root@node3 /]# fuser /sdb
Cannot stat /sdb: Input/output error
Cannot stat file /proc/26551/fd/14: Input/output error
Cannot stat file /proc/26551/fd/52: Input/output error
Cannot stat file /proc/26551/fd/158: Input/output error


杀死进程
[root@node3 /]# ps -aux | grep 26551
root      6399  0.0  0.0 112648   964 pts/1    S+   08:51   0:00 grep --color=auto 26551
root     26551 33.7  4.7 10618628 6325236 ?    Rsl  May16 10659:32 /usr/lib/vmware/bin/vmware-vmx -s vmx.stdio.keep=TRUE -# product=1;name=VMware Workstation;version=12.5.2;buildnumber=4638234;licensename=VMware Workstation;licenseversion=12.0; -@ duplex=3;msgs=ui /sdb/vmware/nb2/nb1.vmx
[root@node3 /]# kill -9 26551
[root@hds17 /]# ps -aux | grep 26551
root      6428  0.0  0.0 112648   960 pts/1    S+   08:52   0:00 grep --color=auto 26551
[root@node3 /]# fuser /sdb
Cannot stat /sdb: Input/output error

重新挂载

[root@node3 /]# umount /sdb

[root@node3 /]# mount /dev/sdb1 /sdb
[root@node3 /]# df -h
df: ‘/run/vmblock-fuse’: Transport endpoint is not connected
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       147G   30G  117G  21% /
devtmpfs         63G     0   63G   0% /dev
tmpfs            63G  248K   63G   1% /dev/shm
tmpfs            63G  635M   63G   1% /run
tmpfs            63G     0   63G   0% /sys/fs/cgroup
/dev/sda3       271G  796M  270G   1% /data
tmpfs            13G   36K   13G   1% /run/user/1000
tmpfs            13G   32K   13G   1% /run/user/0
/dev/sdb1       1.9T  553G  1.3T  30% /sdb


















你可能感兴趣的:(Linux)