Ubuntu 18.04 交换设备上的读取错误

Ubuntu 18.04 交换设备上的读取错误

我在 Linux Ubuntu 18.04 上使用金士顿 USB 14GB 作为交换区域,今天系统崩溃并抛出一条消息“交换设备上读取错误”,屏幕变黑,我尝试在 shell 之间切换但没有任何效果,所以我使用电源按钮强制关机,这个问题的解决方案是什么?我运行了sudo apt-get updatesudo apt-get upgrade

由于。。。导致的结果smartctl --all /dev/sda

smartctl 6.6 2016-05-31 r4324 [x86_64-linux-4.15.0-33-generic] (local build)
Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Family:     Western Digital Blue Mobile
Device Model:     WDC WD5000LPCX-24C6HT0
Serial Number:    WD-WX51A35HSA1U
LU WWN Device Id: 5 0014ee 6059cbe36
Firmware Version: 02.01A02
User Capacity:    500,107,862,016 bytes [500 GB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
Rotation Rate:    5400 rpm
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   ACS-2 (minor revision not indicated)
SATA Version is:  SATA 3.0, 6.0 Gb/s (current: 3.0 Gb/s)
Local Time is:    Mon Sep  3 21:36:43 2018 WEST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

General SMART Values:
Offline data collection status:  (0x00) Offline data collection activity
                    was never started.
                    Auto Offline Data Collection: Disabled.
Self-test execution status:      (   0) The previous self-test routine completed
                    without error or no self-test has ever 
                    been run.
Total time to complete Offline 
data collection:        ( 9120) seconds.
Offline data collection
capabilities:            (0x7b) SMART execute Offline immediate.
                    Auto Offline data collection on/off support.
                    Suspend Offline collection upon new
                    command.
                    Offline surface scan supported.
                    Self-test supported.
                    Conveyance Self-test supported.
                    Selective Self-test supported.
SMART capabilities:            (0x0003) Saves SMART data before entering
                    power-saving mode.
                    Supports SMART auto save timer.
Error logging capability:        (0x01) Error logging supported.
                    General Purpose Logging supported.
Short self-test routine 
recommended polling time:    (   2) minutes.
Extended self-test routine
recommended polling time:    ( 104) minutes.
Conveyance self-test routine
recommended polling time:    (   5) minutes.
SCT capabilities:          (0x7035) SCT Status supported.
                    SCT Feature Control supported.
                    SCT Data Table supported.

SMART Attributes Data Structure revision number: 16
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x002f   200   200   051    Pre-fail  Always       -       0
  3 Spin_Up_Time            0x0027   151   143   021    Pre-fail  Always       -       1416
  4 Start_Stop_Count        0x0032   078   078   000    Old_age   Always       -       22183
  5 Reallocated_Sector_Ct   0x0033   200   200   140    Pre-fail  Always       -       0
  7 Seek_Error_Rate         0x002f   200   200   051    Pre-fail  Always       -       0
  9 Power_On_Hours          0x0032   091   091   000    Old_age   Always       -       6899
 10 Spin_Retry_Count        0x0032   100   100   000    Old_age   Always       -       0
 11 Calibration_Retry_Count 0x0032   100   100   000    Old_age   Always       -       0
 12 Power_Cycle_Count       0x0032   098   098   000    Old_age   Always       -       2552
192 Power-Off_Retract_Count 0x0032   200   200   000    Old_age   Always       -       137
193 Load_Cycle_Count        0x0032   182   182   000    Old_age   Always       -       55366
194 Temperature_Celsius     0x0022   104   088   000    Old_age   Always       -       39
196 Reallocated_Event_Count 0x0032   200   200   000    Old_age   Always       -       0
197 Current_Pending_Sector  0x0032   200   200   000    Old_age   Always       -       0
198 Offline_Uncorrectable   0x0030   100   253   000    Old_age   Offline      -       0
199 UDMA_CRC_Error_Count    0x0032   200   200   000    Old_age   Always       -       0
200 Multi_Zone_Error_Rate   0x0008   200   200   000    Old_age   Offline      -       0
240 Head_Flying_Hours       0x0032   092   092   000    Old_age   Always       -       6508

SMART Error Log Version: 1
No Errors Logged

SMART Self-test log structure revision number 1
Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
# 1  Vendor (0x50)       Completed without error       00%      1247         -
# 2  Short offline       Completed without error       00%      1247         -

SMART Selective self-test log data structure revision number 1
 SPAN  MIN_LBA  MAX_LBA  CURRENT_TEST_STATUS
    1        0        0  Not_testing
    2        0        0  Not_testing
    3        0        0  Not_testing
    4        0        0  Not_testing
    5        0        0  Not_testing
Selective self-test flags (0x0):
  After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.

sudo smartctl --all /dev/sdb

/dev/sdb: Unknown USB bridge [0x0930:0x6544 (0x100)]

sudo smartctl --all /dev/sdc

Smartctl open device: /dev/sdc failed: No such device

答案1

我通过在根目录中创建交换文件并停止使用 USB 解决了该问题。我做了:

创建交换文件:

sudo fallocate -l 4G /swapfile

使该文件仅对 root 可访问:

sudo chmod 600 /swapfile

使用该文件作为交换空间:

sudo mkswap /swapfile 

如果所有方法均有效并且您想使上述更改永久生效:

sudo echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab

答案2

像这样关闭交换文件:

sudo swapoff -a

在另一个磁盘上创建一个新的交换文件:(其中XY是表示另一个设备的字母)

sudo mkswap -c /dev/XdY

重新打开交换文件:

sudo swapon -a

相关内容