解决:Volume was not properly unmounted. Some data may be corrupt. Please run fsck.

转自:https://blog.csdn.net/yzyssg1/article/details/77151551

现象:非正常关机后,在开机信息最末尾出现

1

[   15.721411] FAT-fs (mmcblk0p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.

原因:非正常关机,比如没执行 sudo poweroff 关机就拔掉 MicroUSB 供电插头。

解决:

  • 方法1:最方便的是,将TF卡取下,用USB读卡器插入Windows系统,用磁盘修复即可。
  • 方法2:在树莓派里使用 dosfstool,参见 http://www.raspberrypi.org/forums/viewtopic.php?f=28&t=64843

    1

    2

    3

    4

    5

    6

    7

    8

    9

    10

    11

    12

    13

    14

    15

    16

    17

    18

    19

    20

    21

    22

    23

    24

    25

    # umount /boot

    # git clone http://daniel-baumann.ch/git/software/dosfstools.git

     

    # cd dosfstools

     

    # make

    cc -O2 -fomit-frame-pointer -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Wall -Wextra -Wno-sign-compare -Wno-missing-field-initializers -Wmissing-prototypes -Wstrict-prototypes -g   -c -o fatlabel.o src/fatlabel.c

    .

    .

    .

    cc   mkfs.fat.o   -o mkfs.fat

    # ./fsck.fat -V /dev/mmcblk0p1

    fsck.fat 3.0.24 (2013-11-23)

    0x25: Dirty bit is set. Fs was not properly unmounted and some data may be corrupt.

    1) Remove dirty bit

    2) No action

    ? 1

    Starting check/repair pass.

    Starting verification pass.

    Leaving filesystem unchanged.

    /dev/mmcblk0p1: 14 files, 2383/7161 clusters

     

    ./fsck.fat -a /dev/mmcblk0p1

     

    #mount /boot

  • 方法3:直接使用我编译好的 fsck.fat

    1

    2

    3

    4

    5

    6

    7

    8

    9

    10

    11

    12

    13

    14

    15

    16

    pi@raspberrypi ~ $ git clone https://github.com/davidrobot/myRaspi.git

    Cloning into 'myRaspi'...

    remote: Counting objects: 5, done.

    remote: Compressing objects: 100% (3/3), done.

    remote: Total 5 (delta 0), reused 5 (delta 0)

    Unpacking objects: 100% (5/5), done.

    pi@raspberrypi ~ $ cd myRaspi/bin/

    pi@raspberrypi ~/myRaspi/bin $ chmod +x fsck.fat

    pi@raspberrypi ~/myRaspi/bin $ sudo cp fsck.fat /usr/bin

    pi@raspberrypi ~/myRaspi/bin $ sudo fsck.fat -a /dev/mmcblk0p1

    fsck.fat 3.0.26 (2014-03-07)

    0x25: Dirty bit is set. Fs was not properly unmounted and some data may be corrupt.

     Automatically removing dirty bit.

    Performing changes.

    /dev/mmcblk0p1: 13 files, 1231/7161 clusters

    pi@raspberrypi ~/myRaspi/bin $

  • 方法4:升级系统即可

    1

    2

    3

    sudo apt-get update

    sudo apt-get upgrade

    sudo apt-get dist-upgrade

    或者使用全新的2014-12-24镜像。

2. 挂载U盘后必须要sudo才有写权限

现象:用户pi无写权限,必须sudo

原因:挂载时没有制定相关选项 uid 和 gid

解决:

  • 先用 id 获取 uid gid再挂载

    1

    2

    3

    4

    pi@raspberrypi ~ $ id

    uid=1000(pi) gid=1000(pi) groups=1000(pi),4(adm),20(dialout),24(cdrom),27(sudo),29(audio),44(video),46(plugdev),60(games),100(users),105(netdev),999(input),1002(spi),1003(gpio)

    pi@raspberrypi ~ $ sudo mount -o iocharset=utf8,uid=1000,gid=1000 /dev/sda4 /media/udisk/

    pi@raspberrypi ~ $

你可能感兴趣的:(解决:Volume was not properly unmounted. Some data may be corrupt. Please run fsck.)