IT/server

[ubuntu]_소프트레이드

Ne...Pa~~~~~ 2012. 2. 23. 17:03
회사 서버를 운영하다 500G 하드 2개를 묶으서 사용하고 싶어서 ~ 이곳저곳 찾은 정보를

이곳에 간략해서 정리해서 올려본다.
 
묶을 하드 2개 미리 선택

[root@/ 16:26:14]$fdisk -l
 
Disk /dev/sdc: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xa562a11a

Disk /dev/sde: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x7056d51a

요 2개를 1테라로 묶어 버리자.

[root@/ 16:26:14]$ fdisk /dev/sdc

The number of cylinders for this disk is set to 19457.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)Command (m for help): <-- m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)Command (m for help): <-- n
Command action
e extended
p primary partition (1-4)
<-- p
Partition number (1-4): <-- 1
First cylinder (1-19457, default 1): <-- <enter>
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-19457, default 19457): <-- <enter>
Command (m for help): <-- t
Selected partition: <-- 1 

Selected partition 1Hex code (type L to list codes): <-- 8e
Changed system type of partition 1 to 8e (Linux LVM)

Command (m for help): <-- w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

and repeat the porcess fot the other 1disk or~ other disk 
다른 디스크로 요렇게 한번 더! 

$ sudo pvdisplay
--- NEW Physical volume ---
PV Name /dev/sdc1
VG Name
PV Size 499.05 GB
Allocatable NO
PE Size (KByte) 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID **


확인한다 

You can now see that our physical volumes are all set up.
그리고 나머지 모두를 pvcreate 명령을 이용하여 Physical Volume 생성 

$ pvcreate /dev/sdc1
$ pvcreate /dev/sde1

Now you should be able to list the contents of your volume group

이제 2개의  Physical Volume  을  Volume 그룹으로 묶는다.

$ vgcreate [Volume name] /dev/sdc1 /dev/sde1 

$ vgcreate fileserver /dev/sdc1 /dev/sde1  [난 요렇게 이름정하고 continue

Now you should be able to list the contents of your volume group
 
Volume Group 정보를 확인한다 

$ vgdisplay

--- Volume group ---
VG Name fileserver
System ID
Format lvm2
Metadata Areas 4
Metadata Sequence No 1
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 0
Open LV 0
Max PV 0
Cur PV 4
Act PV 4
VG Size 940.62 GB
PE Size 4.00 MB
Total PE 314780
Alloc PE / Size 0 / 0
Free PE / Size 314780 / 940.62 GB
VG UUID

Finally we’ll create some logical volumes on the volume group

$ lvcreate --name share --size 100G fileserver

$ lvcreate --name backup --size 400G fileserver

$ lvcreate --name filestore --size 400G fileserver 



위 명령어가 실행 안 될시 

오류 내용

/proc/misc: No entry for device-mapper found
Is device-mapper driver missing from kernel?
Failure to communicate with kernel device-mapper driver.
/proc/misc: No entry for device-mapper found
Is device-mapper driver missing from kernel?
Failure to communicate with kernel device-mapper driver.
Incompatible libdevmapper 1.02.20 (2007-06-15)(compat) and kernel driver
striped: Required device-mapper target(s) not detected in your kernel
lvcreate: Create a logical volume
lvcreate
[-A|--autobackup {y|n}]
[--addtag Tag]
[--alloc AllocationPol


dm_mod 를 먼저 로드해주어야 하므로 
 $ modprobe dm_mod  <실행

 


Now, lets throw a filesystem on our logical volumes
위 명령을 실행하면 /dev/fileserver 디렉토리에 각 share, backup, filestore Symbolic Link 파일이 생성됨
마지막으로 포맷하고 마운트 하면 끝!~~~~~~!

$ mkfs.ext3 /dev/fileserver/share
$ mkfs.ext3 /dev/fileserver/backup 
$ mkfs.ext3 /dev/fileserver/media  


$ mkdir /var/share /var/backup /var/filestore 

$ mount /dev/fileserver/share /var/share
$ mount /dev/fileserver/backup /var/backup
$ mount /dev/fileserver/media /var/media