标签:一个用户 一个 光盘 physical xtend db2 文件系统 奇数 noatime
GPT是什么?GUID磁盘分区表(GUID Partition Table,缩写:GPT)其含义为“全局唯一标识磁盘分区表”,是一个实体硬盘的分区表的结构布局的标准。它是可扩展固件接口(EFI)标准(被Intel用于替代个人计算机的BIOS)的一部分,被用于替代BIOS系统中的一64bits来存储逻辑块地址和大小信息的主开机纪录(MBR)分区表
GPT有哪些功能?
Parted用法个常用选项:
用法:parted [选项]… [设备 [ 命令 [参数]… ]… ]
将带有参数的命令用于设备。如果没有出现命令,则以交互模式运行。
帮助选项:
-h,--help 显示此帮助信息
-l , --list 列出所有设备的分区信息
-I , --interactive 在必要是,提示用户
-s, --script 从不提示用户
-v , --version 显示版本
创建分区
fdisk /dev/sdc
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
Partition number (1-4, default 1):
First sector (2048-41943039, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-41943039, default 41943039): +10G
Partition 1 of type Linux and of size 10 GiB is set
Command (m for help): w
The partition table has been altered!
重读磁盘分区表
kpartx -af /dev/sdc
显示分区
fdisk -l /dev/sdc
Disk /dev/sdc: 21.5 GB, 21474836480 bytes, 41943040 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 label type: dos
Disk identifier: 0xb5878e08
Device Boot Start End Blocks Id System
/dev/sdc1 2048 20973567 10485760 83 Linux
创建文件系统
方法一
mke2fs -t ext4 -b 2048 -L MYDATA -m 2 /dev/sdb1
方法二
mkfs.ext4 -b 2048 -L MYDATA -m 2 /dev/sdb1
创建挂载目录
mkdir -pv /data/mydaa
配置自动挂载
vim /etc/fstab
/dev/sdb1 /data/mydata ext4 defaults,noexec,noatime 0 0
创建分区
fdisk /dev/sdc
Command (m for help): n
Partition type:
p primary (1 primary, 0 extended, 3 free)
e extended
Select (default p): p
Partition number (2-4, default 2):
First sector (20973568-41943039, default 20973568):
Using default value 20973568
Last sector, +sectors or +size{K,M,G} (20973568-41943039, default 41943039): +1G
Partition 2 of type Linux and of size 1 GiB is set
Command (m for help): t
Partition number (1,2, default 2):
Hex code (type L to list all codes): 82
Changed type of partition ‘Linux‘ to ‘Linux swap / Solaris‘
Command (m for help): p
Disk /dev/sdc: 21.5 GB, 21474836480 bytes, 41943040 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 label type: dos
Disk identifier: 0xb5878e08
Device Boot Start End Blocks Id System
/dev/sdc1 2048 20973567 10485760 83 Linux
/dev/sdc2 20973568 23070719 1048576 82 Linux swap / Solaris
Command (m for help): w
The partition table has been altered!
重读磁盘分区表
kpartx -af /dev/sdc
创建交换分区
mkswap /dev/sdb2
创建自动挂载
vim /etc/fstab
/dev/sdb2 swap swap defaults 0 0
显示交换分区
swapon --show
方法二
dd if=/dev/zero of=/swapfile bs=1G count=1
chmod 600 /swapfile
mkswap /swapfile
vim /etc/fstab
/swapfile swap swap defaults 0 0
#!/bin/bash
#
id1=$(head -10 /etc/passwd | tail -1 | awk -F : ‘{print $3}‘)
id2=$(head -20 /etc/passwd | tail -1 | awk -F : ‘{print $3}‘)
echo sum=$[$id1+$id2]
hostName=$(hostname)
[ -z "$hostName" -o "$hostName" == "localhost.localdomain" -o "$hostName" == "localhost" ] && hostname www.magedu.com
#!/bin/bash
#
if [ $[ $(id -u $1)%2 ] -eq 0 ]
then
echo $1 ID is Even numbers
else
echo $1 ID is Odd numbers
fi
方法二
#!/bin/bash
#
[ $[ $(id -u $1)%2 ] -eq 0 ] && echo $1 ID is Even numbers || echo $1 ID is Odd numbers
标签:一个用户 一个 光盘 physical xtend db2 文件系统 奇数 noatime
原文地址:http://blog.51cto.com/14074807/2336789