LINUX SWAP的檢視與維護
1.檢視SWAP
[root@rose /]# cat /proc/swaps
Filename Type Size Used Priority
/dev/sdb1 partition 2096440 8 -1
/tmp/swap file 65520 0 -3
2.透過DD建立
boot etc initrd lost+found misc opt root selinux sys test1 usr
[root@rose /]# dd if=/dev/zero f=/tmp/swap bs=4k count=16382
讀入了 16382+0 個塊
輸出了 16382+0 個塊
[root@rose /]# mkswap /tmp/swap
Setting up swapspace version 1, size = 67096 kB
[root@rose /]# free
total used free shared buffers cached
Mem: 384704 364624 20080 0 17180 305472
-/+ buffers/cache: 41972 342732
Swap: 2096440 8 2096432
swapon [-s]
[root@rose /]# swapon /tmp/swap
[root@rose /]# free
total used free shared buffers cached
Mem: 384704 364560 20144 0 17196 305456
-/+ buffers/cache: 41908 342796
Swap: 2161960 8 2161952
開機自動啟動:
LABEL=/ / ext3 defaults 1 1
LABEL=/home /home ext3 defaults 1 2
LABEL=/var /var ext3 defaults 1 2
LABEL=/tmp /tmp ext3 defaults 1 2
LABEL=/usr /usr ext3 defaults 1 2
LABEL=/boot /boot ext3 defaults 1 2
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
LABEL=SWAP swap swap defaults 0 0
/home/swap swap swap defaults 0 0
3.直接再加一棵硬碟,並且將其中某個扇區規劃為 swap 的 filesystem
[root@rose /]# fdisk /dev/sdc
The number of cylinders for this disk is set to 1044.
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): t
Partition number (1-5): 3
Hex code (type L to list codes): L
0 Empty 1e Hidden W95 FAT1 75 PC/IX be Solaris boot
1 FAT12 24 NEC DOS 80 Old Minix bf Solaris
2 XENIX root 39 Plan 9 81 Minix / old Lin c1 DRDOS/sec (FAT-
3 XENIX usr 3c PartitionMagic 82 Linux swap c4 DRDOS/sec (FAT-
4 FAT16 <32M 40 Venix 80286 83 Linux c6 DRDOS/sec (FAT-
5 Extended 41 PPC PReP Boot 84 OS/2 hidden C: c7 Syrinx
6 FAT16 42 SFS 85 Linux extended da Non-FS data
7 HPFS/NTFS 4d QNX4.x 86 NTFS volume set db CP/M / CTOS / .
8 AIX 4e QNX4.x 2nd part 87 NTFS volume set de Dell Utility
9 AIX bootable 4f QNX4.x 3rd part 8e Linux LVM df BootIt
a OS/2 Boot Manag 50 OnTrack DM 93 Amoeba e1 DOS access
b W95 FAT32 51 OnTrack DM6 Aux 94 Amoeba BBT e3 DOS R/O
c W95 FAT32 (LBA) 52 CP/M 9f BSD/OS e4 SpeedStor
e W95 FAT16 (LBA) 53 OnTrack DM6 Aux a0 IBM Thinkpad hi eb BeOS fs
f W95 Ext'd (LBA) 54 OnTrackDM6 a5 FreeBSD ee EFI GPT
10 OPUS 55 EZ-Drive a6 OpenBSD ef EFI (FAT-12/16/
11 Hidden FAT12 56 Golden Bow a7 NeXTSTEP f0 Linux/PA-RISC b
12 Compaq diagnost 5c Priam Edisk a8 Darwin UFS f1 SpeedStor
14 Hidden FAT16 <3 61 SpeedStor a9 NetBSD f4 SpeedStor
16 Hidden FAT16 63 GNU HURD or Sys ab Darwin boot f2 DOS secondary
17 Hidden HPFS/NTF 64 Novell Netware b7 BSDI fs fd Linux raid auto
18 AST SmartSleep 65 Novell Netware b8 BSDI swap fe LANstep
1b Hidden W95 FAT3 70 DiskSecure Mult bb Boot Wizard hid ff BBT
1c Hidden W95 FAT3
Hex code (type L to list codes): 82
Changed system type of partition 3 to 82 (Linux swap)
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: 裝置或資源忙.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
[root@rose /]# mkswap /dev/sdc3
Setting up swapspace version 1, size = 329007 kB
[root@rose /]# swapon /dev/sdc3
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/22034023/viewspace-673193/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 物化檢視日誌的維護
- Linux檢視佔用swap的程式指令碼Linux指令碼
- swap檔案檢視
- linux系統檢視調整swap空間Linux
- 檢視swap記憶體記憶體
- Jtti:linux怎麼檢視swap是否開啟JttiLinux
- 管理與維護Linux系統Linux
- unix CPU、Disk、Mem、Swap檢視工具
- ●linux程式的檢視與操作●Linux
- 巧用事件檢視器維護伺服器安全事件伺服器
- 資料庫維護常用操作3--DDL語句檢視資料庫
- 專案二 管理與維護Linux系統Linux
- 專案二 管理與維護Linux系統Linux
- Android 怎樣檢視系統的memory swap 資訊/資訊Android
- Linux的bash shell與man檢視手冊Linux
- 檢視ubuntu版本與linux核心版本UbuntuLinux
- linux檢視組與使用者Linux
- swapinfo可以檢視swap區的大小和掛載的邏輯卷API
- ORACLE 11G 維護視窗和自動維護任務Oracle
- linux中oracle的日常維護命令LinuxOracle
- Oracle AWR管理與維護Oracle
- RMAN配置與維護命令
- postgresql 優化與維護SQL優化
- 【LINUX學習】檢視磁碟與目錄的資訊Linux
- Linux 字元編碼 檢視與轉換Linux字元
- hp-ux與linux日誌檢視Linux
- Windows網路的管理與維護(轉)Windows
- linux軟RAID的建立和維護LinuxAI
- Linux-Unix系統操作與維護常用命令Linux
- 病毒預防與硬碟使用與維護硬碟
- Linux RHCS 基礎維護命令Linux
- 如何在Linux命令列下檢視幫助?學習linux運維Linux命令列運維
- Linux新增SWAPLinux
- linux swap(交換)Linux
- Tidb 運維--叢集檢視的使用TiDB運維
- 檢視文字[Linux]Linux
- LINUX 檢視埠Linux
- SAP 物料主分類檢視維護的批次分類特性值不能在批次裡被覆蓋