fdisk添加分区引起的Linux Error: 22: Invalid argument

简介:

在Linux服务器(虚拟机)上使用fdisk添加分区、格式化分区后,遇到了Linux Error: 22: Invalid argument错误,操作步骤如下所示

[root@oracle-server ~]# echo "- - -" > /sys/class/scsi_host/host0/scan
[root@oracle-server ~]# fdisk -l
 
Disk /dev/sda: 584.6 GB, 584646328320 bytes
255 heads, 63 sectors/track, 71079 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1       19441   156151808   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2           19441       44937   204796672   83  Linux
Partition 2 does not end on cylinder boundary.
/dev/sda3           44937       57685   102398336   83  Linux
Partition 3 does not end on cylinder boundary.
/dev/sda4           57685       71080   107595584    5  Extended
Partition 4 does not end on cylinder boundary.
/dev/sda5           57685       70433   102398336   83  Linux
/dev/sda6           70433       70949     4144768   82  Linux swap
/dev/sda7           70949       71080     1052288   83  Linux
 
Disk /dev/sdb: 146.1 GB, 146156158976 bytes
2 heads, 24 sectors/track, 5947109 cylinders
Units = cylinders of 48 * 512 = 24576 bytes
 
   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               3     5947064   142729472   83  Linux
 
Disk /dev/sdc: 107.3 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1       13054   104856223+  83  Linux
 
Disk /dev/sdd: 85.8 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
Disk /dev/sdd doesn't contain a valid partition table
 
 
[root@oracle-server ~]# fdisk /dev/sdd
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
 
 
The number of cylinders for this disk is set to 10443.
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)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
 
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
   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): p
 
Disk /dev/sdd: 85.8 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
   Device Boot      Start         End      Blocks   Id  System
 
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-10443, default 1): 
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-10443, default 10443): 
Using default value 10443
 
Command (m for help): w
The partition table has been altered!
 
Calling ioctl() to re-read partition table.
Syncing disks.
 
[root@oracle-server ~]# mkfs.ext3 /dev/sdd1
mke2fs 1.35 (28-Feb-2004)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
10485760 inodes, 20970841 blocks
1048542 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=20971520
640 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks: 
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
        4096000, 7962624, 11239424, 20480000
 
Writing inode tables: done                            
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
 
This filesystem will be automatically checked every 30 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
 
 
[root@oracle-server ~]# more /etc/fstab
# This file is edited by fstab-sync - see 'man fstab-sync' for details
LABEL=/1                /                       ext3    defaults        1 1
none                    /dev/pts                devpts  gid=5,mode=620  0 0
none                    /dev/shm                tmpfs   defaults        0 0
none                    /proc                   proc    defaults        0 0
none                    /sys                    sysfs   defaults        0 0
LABEL=/tmp              /tmp                    ext3    defaults        1 2
LABEL=/u01              /u01                    ext3    defaults        1 2
LABEL=/u02              /u02                    ext3    defaults        1 2
LABEL=/u03              /u03                    ext3    defaults        1 2
LABEL=SWAP-sda6         swap                    swap    defaults        0 0
/dev/sdb1               /u03/flash_recovery_area        ext3    defaults        1 2
/dev/sdc1               /u04                            ext3    defaults        1 2
192.168.4.21:/volume1/NFSforLinux/7222  /mnt/nfsbak     nfs     defaults        0 0
/dev/hda                /media/cdrecorder       auto    pamconsole,exec,noauto,managed 0 0
/dev/fd0                /media/floppy           auto    pamconsole,exec,noauto,managed 0 0
 
 
[root@oracle-server ~]# vi /etc/fstab
 
# This file is edited by fstab-sync - see 'man fstab-sync' for details
LABEL=/1                /                       ext3    defaults        1 1
none                    /dev/pts                devpts  gid=5,mode=620  0 0
none                    /dev/shm                tmpfs   defaults        0 0
none                    /proc                   proc    defaults        0 0
none                    /sys                    sysfs   defaults        0 0
LABEL=/tmp              /tmp                    ext3    defaults        1 2
LABEL=/u01              /u01                    ext3    defaults        1 2
LABEL=/u02              /u02                    ext3    defaults        1 2
LABEL=/u03              /u03                    ext3    defaults        1 2
LABEL=SWAP-sda6         swap                    swap    defaults        0 0
/dev/sdb1               /u03/flash_recovery_area        ext3    defaults        1 2
/dev/sdc1               /u04                            ext3    defaults        1 2
/dev/sdd1               /u05                            ext3    defaults        1 2
192.168.7.63:/volume1/NFSforLinux/7222  /mnt/nfsbak     nfs     defaults        0 0
/dev/hda                /media/cdrecorder       auto    pamconsole,exec,noauto,managed 0 0
/dev/fd0                /media/floppy           auto    pamconsole,exec,noauto,managed 0 0
 
"/etc/fstab" 17L, 1285C written
 
[root@oracle-server ~]# mkdir /u05
[root@oracle-server ~]# mount -a
[root@oracle-server ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1             147G   90G   51G  65% /
/dev/sda7            1012M   34M  927M   4% /tmp
/dev/sda5              97G   78G   14G  86% /u01
/dev/sda3              97G   77G   15G  85% /u02
/dev/sda2             193G  165G   18G  91% /u03
/dev/sdb1             134G   95G   33G  75% /u03/flash_recovery_area
/dev/sdc1              99G   66G   28G  71% /u04
192.168.7.63:/volume1/NFSforLinux/7222
                      2.7T  1.9T  839G  70% /mnt/nfsbak
/dev/sdd1              79G   89M   75G   1% /u05
[root@oracle-server ~]# chown -R oracle:oinstall /u05
[root@oracle-server ~]# chmod -R 775 /u05
[root@oracle-server ~]# 

处理完成后,登录ORACLE数据库出现错误,检查告警日志,发现如下错误信息:

clip_image001

检查/var/log/messages ,没有发现什么错误信息

image

网上搜索到一篇资料(请见参考资料) 介绍了使用fdisk出现Linux Error: 22: Invalid argument的原因.

Run "kpartx -a" after FDISK is completed to add all partition mappings on the newly-created multipath device

当时没有使用这个命令去操作,因为不敢确认这个命令能否解决问题,于是重启Server来解决问题。下次遇到这种情况也可以使用kpartx命令试试。

kpartx -a /dev/sdd1

相关文章
|
4月前
|
存储 监控 安全
在Linux中,⼀个EXT3的文件分区,当使用touch test.file命令创建⼀个新文件时报错,报错的信息是提示磁盘已满,但是采用df -h命令查看磁盘大小时,只使用了,60%的磁盘空间,为什么会出现这个情况?
在Linux中,⼀个EXT3的文件分区,当使用touch test.file命令创建⼀个新文件时报错,报错的信息是提示磁盘已满,但是采用df -h命令查看磁盘大小时,只使用了,60%的磁盘空间,为什么会出现这个情况?
|
3月前
|
Oracle Java 关系型数据库
Linux下JDK环境的配置及 bash: /usr/local/java/bin/java: cannot execute binary file: exec format error问题的解决
如果遇到"exec format error"问题,文章建议先检查Linux操作系统是32位还是64位,并确保安装了与系统匹配的JDK版本。如果系统是64位的,但出现了错误,可能是因为下载了错误的JDK版本。文章提供了一个链接,指向Oracle官网上的JDK 17 Linux版本下载页面,并附有截图说明。
Linux下JDK环境的配置及 bash: /usr/local/java/bin/java: cannot execute binary file: exec format error问题的解决
|
4月前
|
Ubuntu Linux 编译器
在ubantu/linux系统出现parse error(语法错误)
本文讨论了在Ubuntu/Linux系统中遇到"parse error"(语法错误)的问题,并提供了将非声明语句移动到所有声明语句下方以解决该问题的解决方案。
在ubantu/linux系统出现parse error(语法错误)
|
4月前
|
Java Linux Shell
【Azure 应用服务】部署Jar到App Service for Linux,因启动命令路径配置错误而引起:( Application Error 问题
【Azure 应用服务】部署Jar到App Service for Linux,因启动命令路径配置错误而引起:( Application Error 问题
|
4月前
|
存储 Linux 5G
linux操作系统初始化后,再也不用手动分区了
linux操作系统初始化后,再也不用手动分区了
36 0
|
4月前
|
Linux
在Linux中,如何创建一个分区?
在Linux中,如何创建一个分区?
|
4月前
|
Linux 开发工具
在Linux中,如何创建一个新的分区并格式化为EXT4文件系统?
在Linux中,如何创建一个新的分区并格式化为EXT4文件系统?
|
4月前
|
Oracle Java 关系型数据库
简单记录在Linux上安装JDK环境的步骤,以及解决运行Java程序时出现Error Could not find or load main class XXX问题
本文记录了在Linux系统上安装JDK环境的步骤,并提供了解决运行Java程序时出现的"Error Could not find or load main class XXX"问题的方案,主要是通过重新配置和刷新JDK环境变量来解决。
153 0
|
6月前
|
Unix Docker 容器
使用docker 启动naocs 报错出现:standard_init_linux.go:241: exec user process caused "exec format error"
```markdown Error in Docker container startup: "standard_init_linux.go:241: exec user process caused \"exec format error\"". Occurred at 2024-06-29 09:26:19.910, followed by a failed hook with a syslog delivery error at 09:27:20.193. Seeking solutions from experts. ```
|
6月前
|
Linux Shell 虚拟化
开机自动挂载NTFS分区至Linux:分步指南
在Linux中自动挂载Windows NTFS分区,需创建挂载点(如`/media/c_win`),识别分区(如`/dev/sda1`),获取UUID,并编辑`fstab`文件添加挂载信息。推荐使用UUID以保持稳定性。在VMware环境中可能需添加`force`选项。完成这些步骤后,重启系统,NTFS分区将自动挂载。这对于双系统用户非常方便。