参考文章:
阿里云ECS云服务器数据盘分区及挂载到指定目录
Linux 格式化分区 报错Could not stat /dev/sda3 --- No such file or directory
在阿里云上进行磁盘挂载,出现了这个问题:
fdisk /dev/vda
The number of cylinders for this disk is set to 3002.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): p
Default number (2-4): 2
First sector (41929650-48234495, default 41929650):
Using default value 41929650
Last sector or +size or +sizeM or +sizeK (41929650-48234495, default 48234495):
Using default value 48234495
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.
百度了以下找到一位大神给出的解决方案:Linux 格式化分区 报错Could not stat /dev/sda3 --- No such file or directory
需要partprobe命令加载:
#查看是否安装partprobe
[root@iZm5e7unwrg8d8byylz6dfZ xiaozhou1024] rpm -q parted
parted-3.1-29.el7.x86_64
[root@iZm5e7unwrg8d8byylz6dfZ xiaozhou1024] partprobe
[root@iZm5e7unwrg8d8byylz6dfZ xiaozhou1024] mkfs.ext3 /dev/vda2
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
5251072 inodes, 20972800 blocks
1048640 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
641 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
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
格式化分区完成后,再进行挂载
[root@iZm5e7unwrg8d8byylz6dfZ xiaozhou1024]fdisk -l
Disk /dev/vda: 128.8 GB, 128849018880 bytes, 251658240 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: 0x000b2d99
Device Boot Start End Blocks Id System
/dev/vda1 * 2048 83875364 41936658+ 83 Linux
/dev/vda2 83875840 251658239 83891200 83 Linux
[root@iZm5e7unwrg8d8byylz6dfZ xiaozhou1024]echo "/dev/vda2 /data ext3 defaults 0 0" >> /etc/fstab
[root@iZm5e7unwrg8d8byylz6dfZ xiaozhou1024]mount a
或者这样挂载
[root@iZm5e7unwrg8d8byylz6dfZ xiaozhou1024]mkdir /data
[root@iZm5e7unwrg8d8byylz6dfZ xiaozhou1024]mount /dev/vda2 /data
#查看挂载情况
[root@iZm5e7unwrg8d8byylz6dfZ xiaozhou1024] df -h
网友评论