![为什么添加交换空间是启动过程中最慢的部分?](https://linux22.com/image/56822/%E4%B8%BA%E4%BB%80%E4%B9%88%E6%B7%BB%E5%8A%A0%E4%BA%A4%E6%8D%A2%E7%A9%BA%E9%97%B4%E6%98%AF%E5%90%AF%E5%8A%A8%E8%BF%87%E7%A8%8B%E4%B8%AD%E6%9C%80%E6%85%A2%E7%9A%84%E9%83%A8%E5%88%86%EF%BC%9F%20.png)
我可以看到添加交换空间是启动过程中最慢的部分。为什么?
我实际上有大约 4GB 的交换内存和 2GB RAM 内存。
dione@saturno:~$ dmesg | grep -C 4 swap
[ 2.179979] input: Video Bus as /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/LNXVIDEO:00/input/input4
[ 2.180061] ACPI: Video Device [GFX0] (multi-head: yes rom: no post: no)
[ 2.180120] [drm] Initialized i915 1.6.0 20080730 for 0000:00:02.0 on minor 0
[ 2.895482] EXT4-fs (sda5): mounted filesystem with ordered data mode. Opts: (null)
[ 17.840299] Adding 3999740k swap on /dev/sda6. Priority:-1 extents:1 across:3999740k
[ 18.438121] EXT4-fs (sda5): re-mounted. Opts: errors=remount-ro
[ 18.688222] EXT4-fs (sda7): mounted filesystem with ordered data mode. Opts: (null)
[ 18.834834] ADDRCONF(NETDEV_UP): eth0: link is not ready
[ 19.047922] udevd[419]: starting version 175
这些是前十名的三角洲时间,
dione@saturno:~$ dmesg -d | cut -d "<" -f 2 | sort -nr | head
14,944817>] Adding 3999740k swap on /dev/sda6. Priority:-1 extents:1 across:3999740k
8,241362>] wlan0: no IPv6 routers present
2,100332>] wlan0: authenticate with 64:70:02:a0:5d:28 (try 1)
1,830923>] init: plymouth-stop pre-start process (1686) terminated with status 1
0,973801>] psmouse serio1: synaptics: Touchpad model: 1, fw: 7.4, id: 0x1e0b1, caps: 0xd04773/0xe40000/0xa0400
0,715362>] EXT4-fs (sda5): mounted filesystem with ordered data mode. Opts: (null)
0,597822>] EXT4-fs (sda5): re-mounted. Opts: errors=remount-ro
0,513048>] cfg80211: Updating information on frequency 2412 MHz for a 20 MHz width channel with regulatory rule:
0,318977>] init: failsafe main process (728) killed by TERM signal
编辑:我想我一直有这个问题
...
[ 3.271945] EXT4-fs (sda5): INFO: recovery required on readonly filesystem
[ 3.271949] EXT4-fs (sda5): write access will be enabled during recovery
[ 4.220562] EXT4-fs (sda5): recovery complete
[ 4.231392] EXT4-fs (sda5): mounted filesystem with ordered data mode. Opts: (null)
[ 90.312561] Adding 3905532k swap on /dev/sda6. Priority:-1 extents:1 across:3905532k FS
[ 90.467351] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[ 90.772432] systemd-udevd[333]: starting version 204
[ 91.146942] lp: driver loaded but no devices found
[ 91.152406] ppdev: user-space parallel port driver
...
dione@saturno:~$ LANG=us sudo fdisk -l
Disk /dev/sda: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders, total 625142448 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x793a8e8d
Device Boot Start End Blocks Id System
/dev/sda1 * 325117952 591443967 133163008 7 HPFS/NTFS/exFAT
/dev/sda2 591443968 624928767 16742400 7 HPFS/NTFS/exFAT
/dev/sda3 624928768 625141759 106496 c W95 FAT32 (LBA)
/dev/sda4 2046 325117951 162557953 5 Extended
/dev/sda5 2048 39064547 19531250 83 Linux
/dev/sda6 39065600 46876671 3905536 82 Linux swap / Solaris
/dev/sda7 46878720 325117951 139119616 83 Linux
Partition table entries are not in disk order