转贴 解决sd卡的读写问题

最近sd卡读写出了问题,参考一篇网志解决。

http://sns.linuxpk.com/space-1717-do-blog-id-15748.html

 

embedded linux 下插上一个 U 盘,在 /dev/scsi/ 目录下,出现了 4 part 。把该 U 盘插在 pc 机,在 windows 下正常。在 Redhat linux 系统下 mount 的时候出现错误。在使用 fdisk –l 命令。显示问题如下。

Disk /dev/sdb: 1023 MB, 1023409152 bytes
32 heads, 61 sectors/track, 1023 cylinders
Units = cylinders of 1952 * 512 = 999424 bytes
This doesn't look like a partition table
Probably you selected the wrong device.

 

 Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   ?      398636      983425   570754815+  72  Unknown
Partition 1 has different physical/logical beginnings (non-Linux?):
     phys=(357, 116, 40) logical=(398635, 6, 23)
Partition 1 has different physical/logical endings:
     phys=(357, 32, 45) logical=(983424, 30, 61)
Partition 1 does not end on cylinder boundary.
/dev/sdb2   ?       86419     1078237   968014120   65  Novell Netware 386
Partition 2 has different physical/logical beginnings (non-Linux?):
     phys=(288, 115, 43) logical=(86418, 26, 1)
Partition 2 has different physical/logical endings:
     phys=(367, 114, 50) logical=(1078236, 17, 53)
Partition 2 does not end on cylinder boundary.
/dev/sdb3   ?      957932     1949749   968014096   79  Unknown
Partition 3 has different physical/logical beginnings (non-Linux?):
     phys=(366, 32, 33) logical=(957931, 2, 32)
Partition 3 has different physical/logical endings:
     phys=(357, 32, 43) logical=(1949748, 25, 36)
Partition 3 does not end on cylinder boundary.
/dev/sdb4   ?     1478321     1478349       27749+   d  Unknown
Partition 4 has different physical/logical beginnings (non-Linux?):
     phys=(372, 97, 50) logical=(1478320, 8, 25)
Partition 4 has different physical/logical endings:
     phys=(0, 10, 0) logical=(1478348, 22, 13)
Partition 4 does not end on cylinder boundary.


Partition table entries are not in disk order

 

经过网上查找和自己动手,找到解决方法。

fdisk   /dev/sdb1 ( 此处改为 u 盘的 Device Boot  )

The number of cylinders for this disk is set to 9729.
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

显示 目前 U 盘状态。

 

Command (m for help): d
Partition number (1-4): 4

Command (m for help): d
Partition number (1-4): 3

Command (m for help): d
Partition number (1-4): 2

Command (m for help): d

Command (m for help): p
Disk /dev/sdb: 1023 MB, 1023409152 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 Device Boot      Start         End      Blocks   Id  System

 

Command (m for help): n
Command action
   l   logical (5 or over)
   p   primary partition (1-4)

P

Partition number (1-4): 1

 

Command (m for help): p 

显示目前的 U 盘状态。

Command (m for help): x
Expert command (m for help): m
Command action
   b   move beginning of data in a partition
   c   change number of cylinders
   d   print the raw data in the partition table
   e   list extended partitions
   f   fix partition order
   g   create an IRIX (SGI) partition table
   h   change number of heads
   m   print this menu
   p   print the partition table
   q   quit without saving changes
   r   return to main menu
   s   change number of sectors/track
   v   verify the partition table
   w   write table to disk and exit

Expert command (m for help): f
Done.

Expert command (m for help): r

Command (m for help): p

显示 U 盘当前状态。

Command (m for help): w  // 保存你所做的工作并且退出。

 

以上就是对 U 盘进行重新分区。把 4 part 合为一个。

这时的 U 盘还没有格式化。你需要对 U 盘进行格式化。

先卸载 u
#umount /dev/sdb1
#
注意 /dev/ 后面的设备要根据你的实际情况而定
格式化并建立 VFAT 文件系统
#mkfs.vfat /dev/sdb1
最后再 mount 上就成了 , 或者把 U 盘拨了再插上 , 系统可能会自动 mount , 就可以用 U 盘了

 

这样在 pc linux 系统和 embedded linux 系统下就可以一个 U 盘对应一个设备名了。并且可以正常使用。

你可能感兴趣的:(linux,command,table,action,menu,disk)