작성일 : 11-06-16 15:59
[그린IDC] xfs 파티션 설치 및 설정 (CentOS 5.5 기준)
 글쓴이 : 그린웹
조회 : 6,831  
들어가기에 앞서..
 
ext3 파일 시스템은 최대 크기가 16TB로 제한이 되어 있어 고용량 스토리지에 지원하기 어려운 단점이 있습니다.
이러한 문제를 개선하기 위해 xfs 파티션을 이용하여 16TB 이상의 고용량 파티션을 사용할 수 있습니다.
 
[제한사항]
- xfs 파일시스템 사이즈는 최대 100TB까지 지원됩니다.
- OS 설치 후 만들 수 있습니다.
- root 와 boot 파티션에는 서포트 되지 못합니다.
 
실제 아래 예는 웹하드 업체의 파일스토리지를 토대로 작성 되었습니다.
 
OS : CentOS 5.5 Final
Kernel : 2.6.18-194.el5PAE
 
[설치]
1. xfs 파일 시스템을 만들기 위해 필요한 프로그램을 설치 합니다.
 
[root@localhost ~]# yum install xfsprogs xfsprogs-devel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * addons: centos.tt.co.kr
 * base: centos.tt.co.kr
 * extras: centos.tt.co.kr
 * updates: centos.tt.co.kr
addons                                                                                                            |  951 B     00:00    
addons/primary                                                                                                    |  202 B     00:00    
base                                                                                                              | 1.1 kB     00:00    
base/primary                                                                                                      | 954 kB     00:00    
base                                                                                                                           2683/2683
extras                                                                                                            | 2.1 kB     00:00    
extras/primary_db                                                                                                 | 183 kB     00:00    
updates                                                                                                           | 1.9 kB     00:00    
updates/primary_db                                                                                                | 550 kB     00:00    
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package xfsprogs.i386 0:2.9.4-1.el5.centos set to be updated
---> Package xfsprogs-devel.i386 0:2.9.4-1.el5.centos set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
=========================================================================================================================================
 Package                             Arch                      Version                                 Repository                   Size
=========================================================================================================================================
Installing:
 xfsprogs                            i386                      2.9.4-1.el5.centos                      extras                      1.5 M
 xfsprogs-devel                      i386                      2.9.4-1.el5.centos                      extras                      311 k
Transaction Summary
=========================================================================================================================================
Install       2 Package(s)
Upgrade       0 Package(s)
Total download size: 1.8 M
Is this ok [y/N]: y
Downloading Packages:
(1/2): xfsprogs-devel-2.9.4-1.el5.centos.i386.rpm                                                                 | 311 kB     00:00    
(2/2): xfsprogs-2.9.4-1.el5.centos.i386.rpm                                                                       | 1.5 MB     00:00    
-----------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                    9.9 MB/s | 1.8 MB     00:00    
경고: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID e8562897
extras/gpgkey                                                                                                     | 1.5 kB     00:00    
Importing GPG key 0xE8562897 "CentOS-5 Key (CentOS 5 Official Signing Key) <centos-5-key@centos.org>" from /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : xfsprogs                                                                                                          1/2
  Installing     : xfsprogs-devel                                                                                                    2/2
Installed:
  xfsprogs.i386 0:2.9.4-1.el5.centos                               xfsprogs-devel.i386 0:2.9.4-1.el5.centos                             
Complete!
 
 
2. 커널 xfs 모듈 설치
yum -y install kmod-xfs
* kmod-xfs 설치 시 의존성으로 의해 관련 커널도 같이 설치 됩니다.
 
PAE 커널일 경우
yum -y install kmod-xfs-PAE
 
커널 확인 후 환경에 맞게 설치 합니다.
 
[root@localhost ~]# uname -r
2.6.18-194.el5PAE
 
해당 시스템의 경우 PAE 커널 임으로 아래와 같이 xfs PAE 커널용으로 설치 합니다.
 
[root@localhost ~]# yum install kmod-xfs-PAE
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * addons: data.nicehosting.co.kr
 * base: data.nicehosting.co.kr
 * extras: data.nicehosting.co.kr
 * updates: data.nicehosting.co.kr
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package kmod-xfs-PAE.i686 0:0.4-2 set to be installed
--> Finished Dependency Resolution
Dependencies Resolved
==================================================================================================================
 Package                         Arch                    Version                  Repository                 Size
==================================================================================================================
Installing:
 kmod-xfs-PAE                    i686                    0.4-2                    extras                    262 k
Transaction Summary
==================================================================================================================
Install       1 Package(s)
Upgrade       0 Package(s)
Total download size: 262 k
Is this ok [y/N]: y
Downloading Packages:
kmod-xfs-PAE-0.4-2.i686.rpm                                                                | 262 kB     00:00    
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : kmod-xfs-PAE                                                                               1/1
Installed:
  kmod-xfs-PAE.i686 0:0.4-2                                                                                      
Complete!
 
 
3. parted를 사용하여 파티션을 설정 합니다.
# parted /dev/sdb (xfs 파티션으로 설정할 디바이스명)
 
[root@localhost ~]# parted /dev/sdb
GNU Parted 1.8.1
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted)
(parted) mklabel gpt   * label을 만듭니다.
Warning: The existing disk label on /dev/sdb will be destroyed and all data on this disk will be lost. Do you want
to continue?
parted: invalid token: gpt
Yes/No? yes                                                              
New disk label type?  [gpt]?   
                                          
(parted) print   * 디스크정보를 확인 합니다.                                                        
Model: SMC DATA (scsi)
Disk /dev/sdb: 14.0TB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number  Start  End  Size  File system  Name  Flags
 
(parted) mkpart    * 파티션을 생성 합니다.                                                      
Partition name?  []?       (파티션 이름 입력)                                              
File system type?  [ext2]? xfs      (파일시스템 타입 입력)                                     
Start? 0           (시작점 입력, 0부터 시작)                                                      
End? 100%           (종료점 입력, % 단위로도 가능)
                                                     
(parted) print                                                           
Model: SMC DATA (scsi)
Disk /dev/sdb: 14.0TB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number  Start   End     Size    File system  Name  Flags
 1      17.4kB  14.0TB  14.0TB  xfs      
              
(parted) quit                                                            
Information: Don't forget to update /etc/fstab, if necessary.
 
 
 
4. 파일시스템을 생성 합니다.
 
[root@localhost ~]# mkfs.xfs -f /dev/sdb1
meta-data=/dev/sdb1              isize=256    agcount=32, agsize=106659839 blks
         =                       sectsz=512   attr=0
data     =                       bsize=4096   blocks=3413114848, imaxpct=25
         =                       sunit=0      swidth=0 blks, unwritten=1
naming   =version 2              bsize=4096 
log      =internal log           bsize=4096   blocks=32768, version=1
         =                       sectsz=512   sunit=0 blks, lazy-count=0
realtime =none                   extsz=4096   blocks=0, rtextents=0
 
 
5. 서버가 재부팅 되어도 마운트가 가능하게 fstab 혹은 rc.local 에 등록 합니다.
 
[root@localhost ~]# vi /etc/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
mount -t xfs /dev/sdb1 /home/data1
 
 
6. 재부팅 하여 정상적으로 올라온 후 마운트 되었는지 확인 합니다.
 
[root@localhost ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda3             224G  1.8G  211G   1% /
/dev/sda1              99M   12M   83M  12% /boot
tmpfs                 2.0G     0  2.0G   0% /dev/shm
/dev/sdb1              13T  1.1M   13T   1% /home/data1
 
 
이호스트데이터센터(http://www.ehostidc.co.kr)