快速业务通道

RH135-6-simple-fs

作者 佚名技术 来源 Linux系统 浏览 发布时间 2012-03-29

###Swap Partitions & Files###

Features:
1. Extra, virtual RAM for the OS


Steps:
1. Identify current swap space
a. ''swapon -s'' - enumerates partitions and/or files, which constitute swap storage
b. ''free -m''

2. Select target drive and provision swap partition
a. ''fdisk /dev/sdb''
b. ''n''
c. ''2''
d. ''500''
e. '' 512M'' (cylinder 562) - 63 cylinders are required for 512MB
f. ''t'' - Change Type
g. ''82'' - Linux Swap/Solaris
h. ''w'' - committ changes to disk

3. Create the swap file system on the raw partition: /dev/sdb2
a. ''mkswap /dev/sdb2''

4. Enable swapping - publish the swap space to the kernel
a. ''swapon /dev/sdb2'' - this enables swapping on /dev/sdb2

5. update /etc/fstab
a. ''/dev/sdb2 swap swap defaults 0 0

swapoff /dev/sdb2 - disables swapping on /dev/sdb2

Task:
1. Improve system performance by distributing swapping to /dev/sdb2
a. swapon /dev/sdb2
b. swapoff /dev/sda6
c. disable /dev/sda6 via /etc/fstab


###Create Swap based on File###

Features:
1. The ability to provision swap space based on a file, similar to pagefile.sys in Windows NT, etc. if you have no available disk space to partition
2. Doesn''t waste partitions


Task:
1. Create 512MB swap file
a. ''dd if=/dev/zero of=/home1/swapfile1 bs=1024 count=524288''
b. ''mkswap /home1/swapfile1'' - overlays swap file system
c. ''swapon /home1/swapfile1'' - makes swap space available to the kernel

2. Ensure that when the system reboots, the swapfile is made available to the kernel
a. ''nano /etc/fstab'' - /home1/swapfile1 swap swap default 0 0

3. Create 2GB swap file
a. ''dd if=/dev/zero of=/home1/swapfile2 bs=1M count=2048''


###Encrypt a partition###

Features:
1. Encrypt a Partition


Tasks:
1. Create a partition
a. ''fdisk -cu /dev/vda''

2. Encrypt
a. ''cryptsetup luksFormat /dev/vda5''

3. Open
a. ''cryptsetup luksOpen /dev/vda5 encdisk''

4. Format
a. ''mkfs.ext4 /dev/mapper/encdisk''

5. Use
a. ''mkdir /encdisk''
b. ''mount /dev/mapper/encdisk /encdisk''

6. Auto-mount

a. Edit /etc/crypttab
encdisk /dev/vda5 /root/encdisk

b. ''echo westos > /root/encdisk''
c. ''chown root /root/encdisk
d. ''chmod 600 /root/encdisk
e. ''cryptsetup luksAddKey /dev/vda5 /root/encdisk

凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!

分享到: 更多

Copyright ©1999-2011 厦门凌众科技有限公司 厦门优通互联科技开发有限公司 All rights reserved

地址(ADD):厦门软件园二期望海路63号701E(东南融通旁) 邮编(ZIP):361008

电话:0592-5908028 传真:0592-5908039 咨询信箱:web@lingzhong.cn 咨询OICQ:173723134

《中华人民共和国增值电信业务经营许可证》闽B2-20100024  ICP备案:闽ICP备05037997号