Linux 热重启后无法保留任何 root 创建的文件和文件夹

Linux 热重启后无法保留任何 root 创建的文件和文件夹

我安装并运行petalinux在 zynq 板上。它运行良好,启动时间约为 3 秒。为了如此快速地启动,我必须在编译源代码之前进行一些配置。

我现在面临的问题是,系统(热)重启后,我无法保存任何文件或文件夹。我在 /etc 中创建了一个目录,然后创建一个文件并写入一些数据,然后保存。我仔细检查了文件和文件夹确实在那里。然后我重新启动了系统(没有断开电源热启动),但现在我在那里看不到我的文件和文件夹。

另外,我以 root 身份执行所有操作,以下是部分日志消息:

U-BOOT for Xilinx-ZC702-14.7


SF: Detected N25Q128A with page size 64 KiB, total 16 MiB
SF: 3571500 bytes @ 0x520000 Read: OK
## Loading kernel from FIT Image at 01000000 ...
   Using 'conf@1' configuration
   Trying 'kernel@1' kernel subimage
     Description:  PetaLinux Kernel
     Type:         Kernel Image
     Compression:  gzip compressed
     Data Start:   0x010000f0
     Data Size:    3554646 Bytes = 3.4 MiB
     Architecture: ARM
     OS:           Linux
     Load Address: 0x00008000
     Entry Point:  0x00008000
   Verifying Hash Integrity ... OK
## Loading fdt from FIT Image at 01000000 ...
   Using 'conf@1' configuration
   Trying 'fdt@1' fdt subimage
     Description:  Flattened Device Tree blob
     Type:         Flat Device Tree
     Compression:  uncompressed
     Data Start:   0x01363ef8
     Data Size:    11203 Bytes = 10.9 KiB
     Architecture: ARM
     Hash algo:    crc32
     Hash value:   3ade61c7
     Hash algo:    sha1
     Hash value:   bcf959c1b25beb6f43f0d91c1ca67d9041d859ae
   Verifying Hash Integrity ... crc32+ sha1+ OK
   Booting using the fdt blob at 0x1363ef8
   Uncompressing Kernel Image ... OK
   Loading Device Tree to 07ffa000, end 07fffbc2 ... OK

    Starting kernel ...

INIT: version 2.88 booting
Starting Bootlog daemon: bootlogd.
Creating /dev/flash/* device nodes
Configuring network interfaces... ifconfig: socket: Address family not supported by protocol
ifconfig: socket: Address family not supported by protocol
INIT: Entering runlevel: 5
Stopping Bootlog daemon: bootlogd.

 _____       _           _      _
| ___ \     | |         | |    (_)
| |_/ / ___ | |_   __ _ | |     _  _ __   _   _ __  __
|  __/ / _ \| __| / _` || |    | || '_ \ | | | |\ \/ /
| |   |  __/| |_ | (_| || |____| || | | || |_| | >  <
\_|    \___| \__| \__,_|\_____/|_||_| |_| \__,_|/_/\_\

PetaLinux v2013.10 (Yocto 1.4) Xilinx-ZC702-14_7 ttyPS0

 Xilinx-ZC702-14_7 login: root
 Password:
 login[731]: root login  on `ttyPS0'

 root@Xilinx-ZC702-14_7:~# ls
 root@Xilinx-ZC702-14_7:~#

是否存在许可/所有权问题?

root@Xilinx-ZC702-14_7:/# ls -ld *
drwxr-xr-x    2 root     root             0 Mar 12  2014 bin
drwxr-xr-x    2 root     root             0 Mar 12  2014 boot
drwxr-xr-x    5 root     root             0 Jan  1 00:00 dev
drwxr-xr-x   15 root     root             0 Jan  1 00:00 etc
drwxr-xr-x    3 root     root             0 Mar 12  2014 home
lrwxrwxrwx    1 root     root             9 Mar 12  2014 init -> sbin/init
drwxr-xr-x    3 root     root             0 Mar 12  2014 lib
drwxr-xr-x   10 root     root             0 Mar 12  2014 media
drwxr-xr-x    2 root     root             0 Mar 12  2014 mnt
dr-xr-xr-x   40 root     root             0 Jan  1 00:00 proc
drwxr-xr-x    2 root     root             0 Mar 12  2014 sbin
dr-xr-xr-x   11 root     root             0 Jan  1 00:00 sys
lrwxrwxrwx    1 root     root             8 Mar 12  2014 tmp -> /var/tmp
drwxr-xr-x    9 root     root             0 Mar 12  2014 usr
drwxr-xr-x    7 root     root             0 Mar 12  2014 var
root@Xilinx-ZC702-14_7:/#

mount 的输出如下:

root@Xilinx-ZC702-14_7:/# mount
rootfs on / type rootfs (rw,relatime)
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
tmpfs on /dev type tmpfs (rw,relatime,size=64k,mode=0755)
devpts on /dev/pts type devpts (rw,relatime,mode=600)
tmpfs on /var/volatile type tmpfs (rw,relatime)
tmpfs on /media/ram type tmpfs (rw,relatime)

我没有发现任何异常。我以 root 身份登录,应该有权创建文件和文件夹。

请注意,我是从闪存启动的。操作系统实际上是在 ARM Cortex A9 上运行的。

知道发生什么事了吗?

答案1

rootfs on / type rootfs (rw,relatime)

realtime节省磁盘保存次数,实际上应该只在 SSD(类似)驱动器上使用。看看这是否有帮助:

# sync
# reboot

相关内容