centos创建交换分区并自动挂载
2013-10-18 21:16
351 查看
一.先创建一个分区
[root@magedu ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x30783445.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-261, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-261, default 261): +1G
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 82
Changed system type of partition 1 to 82 (Linux swap / Solaris)
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
好了,现在已经创建出了一个交换分区,最好重启电脑一下。如果不重启,则输入命令;
[root@magedu ~]# partprobe
Warning: WARNING: the kernel failed to re-read the partition table on /dev/sda (Device or resource busy). As a result, it may not reflect all of your changes until after reboot.
Warning: Unable to open /dev/sr0 read-write (Read-only file system). /dev/sr0 has been opened read-only.
让内核重新读取分区表
二:
[root@magedu ~]# mkswap /dev/sdb1
Setting up swapspace version 1, size = 1060252 KiB
no label, UUID=11c8dda0-d607-4aec-81f6-43edff562ec8
获得/dev/sdb1的UUID ,
三:实现自动挂载:
[root@magedu ~]# echo " UUID=11c8dda0-d607-4aec-81f6- 43edff562ec8 swap swap defaults 0 0" >> /etc/fstab
[root@magedu ~]# swapon -a
[root@magedu ~]# swapon -s
FilenameTypeSizeUsedPriority
/dev/sda3 partition10485680-1
/dev/sdb1 partition10602480-2
好了,已经实现了自动挂载
本文出自 “伤城” 博客,请务必保留此出处http://xieerdun.blog.51cto.com/7980122/1311049
[root@magedu ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x30783445.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-261, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-261, default 261): +1G
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 82
Changed system type of partition 1 to 82 (Linux swap / Solaris)
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
好了,现在已经创建出了一个交换分区,最好重启电脑一下。如果不重启,则输入命令;
[root@magedu ~]# partprobe
Warning: WARNING: the kernel failed to re-read the partition table on /dev/sda (Device or resource busy). As a result, it may not reflect all of your changes until after reboot.
Warning: Unable to open /dev/sr0 read-write (Read-only file system). /dev/sr0 has been opened read-only.
让内核重新读取分区表
二:
[root@magedu ~]# mkswap /dev/sdb1
Setting up swapspace version 1, size = 1060252 KiB
no label, UUID=11c8dda0-d607-4aec-81f6-43edff562ec8
获得/dev/sdb1的UUID ,
三:实现自动挂载:
[root@magedu ~]# echo " UUID=11c8dda0-d607-4aec-81f6- 43edff562ec8 swap swap defaults 0 0" >> /etc/fstab
[root@magedu ~]# swapon -a
[root@magedu ~]# swapon -s
FilenameTypeSizeUsedPriority
/dev/sda3 partition10485680-1
/dev/sdb1 partition10602480-2
好了,已经实现了自动挂载
本文出自 “伤城” 博客,请务必保留此出处http://xieerdun.blog.51cto.com/7980122/1311049
相关文章推荐
- CentOS 自动挂载与卸载 ntfs 分区
- Linux(Centos) 加硬盘,分区和设置自动挂载
- Linux(Centos) 加硬盘,分区和设置自动挂载
- CentOS5.5 添加一块新硬盘,分区并设置系统启动自动挂载的方法
- Centos添加新硬盘、分区、格式化、自动挂载
- centos6.5下磁盘创建交换分区
- linux系统--free,交换分区,mkswap,swapon,swapoff,dd,自动挂载,fuser
- suse11下创建分区,并设置开机自动挂载
- Linux创建分区开机自动挂载
- 阿里云 Cent OS 6.3版本自动挂载交换分区失败原因
- CentOS5.5 添加一块新硬盘,分区并设置系统启动自动挂载的方法
- linux回环设备,交换分区和自动挂载
- suse11下创建分区,并设置开机自动挂载
- 2、自动挂载分区--创建小型linux
- Linux新硬盘、分区、格式化、自动挂载
- 一个自己写的自动格式化,开机挂载,创建用户和管理ACL权限的shell脚本
- Ubuntu下在新硬盘上创建分区,格式化,挂载
- Linux系统开机自动挂载windows分区
- 管理磁盘及分区 创建文件系统 挂载,卸载
- 如何在 Linux 下挂载大于 2T 的 LUN? 使用 parted 创建 GPT 分区