Parted

 
命令行方式 
parted /dev/sdb mkpart 0 2000G #新硬盘执行后报错 
Error: Unable to open /dev/sdb - unrecognised disk label 

解决办法 
parted /dev/sdb mklabel msdos  #一般linux或是windows分区用这个都OK 
再从新创建分区 
parted /dev/sdb mkpart 0 2000G 
 
交互模式下 

print free  #显示空余磁盘 
print all   #显示全部磁盘 
print       #显示当前分区 
 
parted /dev/sdb 
mkpartfs 0 -1 

转换分区为xfs文件系统 
mkfs.xfs -L label-name -f /dev/sdb #-L设置label名 

2、安装相应的软件包 
xfs在默认的系统安装上是不被支持的,需要自己手动安装默认的包。 
先修过yum的配置文件 
# vim /etc/yum.repos.d/CentOS-Base.repo 
[centosplus] 
enabled=1                //把0改为1 
# yum install xfsprogs kmod-xfs         //安装软件包 

3、创建分区并格式化 
# fdisk /dev/sdb                        //创建一个分区 
Command (m for help): p 
Disk /dev/sdb: 160.0 GB, 160041885696 bytes 
255 heads, 63 sectors/track, 19457 cylinders 
Units = cylinders of 16065 * 512 = 8225280 bytes 
   Device Boot      Start         End      Blocks   Id  System 
Command (m for help): n 
Command action 
   e   extended 
   p   primary partition (1-4) 
1 
Invalid partition number for type `1' 
Command action 
   e   extended 
   p   primary partition (1-4) 
p 
Partition number (1-4): 1 
First cylinder (1-19457, default 1): 
Using default value 1 
Last cylinder or +size or +sizeM or +sizeK (1-19457, default 19457): +50000M 
Command (m for help): w 
The partition table has been altered! 
Calling ioctl() to re-read partition table. 
Syncing disks. 
# mkfs.xfs -f /dev/sdb1                //把sdb1格式化为xfs文件系统 
# parted /dev/sdb                      //查看分区的文件系统 
GNU Parted 1.8.1 
Using /dev/sdb 
Welcome to GNU Parted! Type 'help' to view a list of commands. 
(parted) p                                                                
Model: ATA ST3160811AS (scsi) 
Disk /dev/sdb: 160GB 
Sector size (logical/physical): 512B/512B 
Partition Table: msdos 
Number  Start   End     Size    Type     File system  Flags 
1      32.3kB  5009MB  5009MB  primary  xfs               

4、挂载分区 
# modprobe xfs               //载入xfs文件系统模块,如果不行要重启服务器 
# lsmod |grep xfs            //查看是否载入了xfs模块 
# mkdir /hehe 
# mount -t xfs /dev/sdb1 /hehe           //把分区挂载到目录上 
/home1/yepnnet/public_html/wiki/data/pages/parted.txt · 最后更改: 2009/12/11 00:18 由 admin
到顶部
chimeric.de = chi`s home Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0