ucloud server에 Data 디스크의 파티션 생성과 마운트하기

Posted on Updated on

KT의 cloud server를 신청하면 100G 디스크가 기본으로 생성되는데 20G의 Root disk와 80G의 Data disk가 만들어 진다.

이때 Root disk는 마운트가 되고 Data disk는 마운트 되지 않으므로 먼저 파티션 작업을 하고 Logical Volume을 만들어 마운트 작업을 해야 합니다.

파티션 작업

1. 파티션 확인

root@7aed9d45-fdfc-4477-9d31-013db0f92ddd:~# fdisk -l

Disk /dev/xvdb: 85.9 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/xvdb doesn't contain a valid partition table  <<= 파티션이 안되어 있다는 정보

Disk /dev/xvda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000ed7e1

Device Boot      Start         End      Blocks   Id  System
/dev/xvda1           1        2611    20969472   83  Linux

2. 파티션 만들기

root@7aed9d45-fdfc-4477-9d31-013db0f92ddd:~# fdisk -l

Disk /dev/xvdb: 85.9 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/xvdb doesn't contain a valid partition table

Disk /dev/xvda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000ed7e1

    Device Boot      Start         End      Blocks   Id  System
/dev/xvda1               1        2611    20969472   83  Linux
root@7aed9d45-fdfc-4477-9d31-013db0f92ddd:~# fdisk  /dev/xvdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xbacc7a5b.
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): 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): p <<= 파티션 테이블 확인

Disk /dev/xvdb: 85.9 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xbacc7a5b

    Device Boot      Start         End      Blocks   Id  System

Command (m for help): n <<= 새 파티션을 추가
Command action
   e   extended
   p   primary partition (1-4)
p <<= 프라이머리 파티션 선택
Partition number (1-4): 1 <<= 1번 파티션 입력
First cylinder (1-10443, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-10443, default 10443):
Using default value 10443

Command (m for help): t <<= 생성한 파티션의 id를 선택하기 위해 입력
Selected partition 1
Hex code (type L to list codes): L

 0  Empty           24  NEC DOS         81  Minix / old Lin bf  Solaris       
 1  FAT12           39  Plan 9          82  Linux swap / So c1  DRDOS/sec (FAT-
 2  XENIX root      3c  PartitionMagic  83  Linux           c4  DRDOS/sec (FAT-
 3  XENIX usr       40  Venix 80286     84  OS/2 hidden C:  c6  DRDOS/sec (FAT-
 4  FAT16 <32M      41  PPC PReP Boot   85  Linux extended  c7  Syrinx        
 5  Extended        42  SFS             86  NTFS volume set da  Non-FS data   
 6  FAT16           4d  QNX4.x          87  NTFS volume set db  CP/M / CTOS / .
 7  HPFS/NTFS       4e  QNX4.x 2nd part 88  Linux plaintext de  Dell Utility  
 8  AIX             4f  QNX4.x 3rd part 8e  Linux LVM       df  BootIt        
 9  AIX bootable    50  OnTrack DM      93  Amoeba          e1  DOS access    
 a  OS/2 Boot Manag 51  OnTrack DM6 Aux 94  Amoeba BBT      e3  DOS R/O       
 b  W95 FAT32       52  CP/M            9f  BSD/OS          e4  SpeedStor     
 c  W95 FAT32 (LBA) 53  OnTrack DM6 Aux a0  IBM Thinkpad hi eb  BeOS fs       
 e  W95 FAT16 (LBA) 54  OnTrackDM6      a5  FreeBSD         ee  GPT           
 f  W95 Ext'd (LBA) 55  EZ-Drive        a6  OpenBSD         ef  EFI (FAT-12/16/
10  OPUS            56  Golden Bow      a7  NeXTSTEP        f0  Linux/PA-RISC b
11  Hidden FAT12    5c  Priam Edisk     a8  Darwin UFS      f1  SpeedStor     
12  Compaq diagnost 61  SpeedStor       a9  NetBSD          f4  SpeedStor     
14  Hidden FAT16 ❤ 63  GNU HURD or Sys ab  Darwin boot     f2  DOS secondary 
16  Hidden FAT16    64  Novell Netware  af  HFS / HFS+      fb  VMware VMFS   
17  Hidden HPFS/NTF 65  Novell Netware  b7  BSDI fs         fc  VMware VMKCORE
18  AST SmartSleep  70  DiskSecure Mult b8  BSDI swap       fd  Linux raid auto
1b  Hidden W95 FAT3 75  PC/IX           bb  Boot Wizard hid fe  LANstep       
1c  Hidden W95 FAT3 80  Old Minix       be  Solaris boot    ff  BBT           
1e  Hidden W95 FAT1
Hex code (type L to list codes): 8e <<= Linux LVM 타입으로 선택
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.

3. 파티션 확인

root@7aed9d45-fdfc-4477-9d31-013db0f92ddd:~# fdisk -l

Disk /dev/xvdb: 85.9 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xbacc7a5b

    Device Boot      Start         End      Blocks   Id  System
/dev/xvdb1               1       10443    83883366   8e  Linux LVM <<= 파티션의 생성을 확인

Disk /dev/xvda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000ed7e1

    Device Boot      Start         End      Blocks   Id  System
/dev/xvda1               1        2611    20969472   83  Linux

LV(Logical Volume) 작업

1. PV(Pysical Volume) 생성

root@7aed9d45-fdfc-4477-9d31-013db0f92ddd:~# pvcreate /dev/xvdb1
  Physical volume "/dev/xvdb1" successfully created

2. PV 생성 확인

root@7aed9d45-fdfc-4477-9d31-013db0f92ddd:~# pvscan
  PV /dev/xvdb1                      lvm2 [80.00 GiB]
  Total: 1 [80.00 GiB] / in use: 0 [0   ] / in no VG: 1 [80.00 GiB]

3. PV 정보 보기

root@7aed9d45-fdfc-4477-9d31-013db0f92ddd:~# pvdisplay
  "/dev/xvdb1" is a new physical volume of "80.00 GiB"
  --- NEW Physical volume ---
  PV Name               /dev/xvdb1
  VG Name              
  PV Size               80.00 GiB
  Allocatable           NO
  PE Size               0  
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               ljFxMc-WjHW-JZt4-mM3t-Z0eI-sQuw-lj3rS8

4. VG(Volume Group) 생성

root@7aed9d45-fdfc-4477-9d31-013db0f92ddd:~# vgcreate DataVG /dev/xvdb1
  Volume group "DataVG" successfully created

5. VG 생성 확인

root@7aed9d45-fdfc-4477-9d31-013db0f92ddd:~# pvscan
  PV /dev/xvdb1   VG DataVG   lvm2 [80.00 GiB / 80.00 GiB free]
  Total: 1 [80.00 GiB] / in use: 1 [80.00 GiB] / in no VG: 0 [0   ]

6. VG 정보 보기

root@7aed9d45-fdfc-4477-9d31-013db0f92ddd:~# vgdisplay
  --- Volume group ---
  VG Name               DataVG
  System ID            
  Format                lvm2
  Metadata Areas        1
  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                1
  Act PV                1
  VG Size               80.00 GiB
  PE Size               4.00 MiB
  Total PE              20479
  Alloc PE / Size       0 / 0  
  Free  PE / Size       20479 / 80.00 GiB
  VG UUID               KZVjzn-V70U-mm6R-cA8N-hayF-2QaK-MID6fk

7. LV(Logical Volume) 생성

root@7aed9d45-fdfc-4477-9d31-013db0f92ddd:~# lvcreate -L 80g -n Data00 DataVG
  Insufficient free extents (20479) in volume group DataVG: 20480 required
root@7aed9d45-fdfc-4477-9d31-013db0f92ddd:~# lvcreate -l 20479 -n Data00 DataVG
  Logical volume "Data00" created

8. LV 정보 보기

root@7aed9d45-fdfc-4477-9d31-013db0f92ddd:~# lvdisplay
  --- Logical volume ---
  LV Name                /dev/DataVG/Data00
  VG Name                DataVG
  LV UUID                6TNCRB-VzcX-cZTf-qXrl-HzW2-M0xX-rHV6dZ
  LV Write Access        read/write
  LV Status              available
  # open                 0
  LV Size                80.00 GiB
  Current LE             20479
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           251:0

파일 시스템 생성

root@7aed9d45-fdfc-4477-9d31-013db0f92ddd:~# mkfs.ext3 /dev/DataVG/Data00
mke2fs 1.41.14 (22-Dec-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
5242880 inodes, 20970496 blocks
1048524 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
640 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
     32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
     4096000, 7962624, 11239424, 20480000

Writing inode tables: done                           
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 28 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

마운트 작업

1. 마운트 할 디렉토리 생성

root@7aed9d45-fdfc-4477-9d31-013db0f92ddd:~# mkdir /mnt/data

2. /dev/DataVG/Data00를 /mnt/data에 마운트

root@7aed9d45-fdfc-4477-9d31-013db0f92ddd:~# mount /dev/DataVG/Data00 /mnt/data

3. 마운트 확인

root@7aed9d45-fdfc-4477-9d31-013db0f92ddd:~# mount
/dev/xvda1 on / type ext3 (rw,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
none on /sys type sysfs (rw,noexec,nosuid,nodev)
fusectl on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
none on /dev type devtmpfs (rw,mode=0755)
none on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
none on /dev/shm type tmpfs (rw,nosuid,nodev)
none on /var/run type tmpfs (rw,nosuid,mode=0755)
none on /var/lock type tmpfs (rw,noexec,nosuid,nodev)
none on /proc/xen type xenfs (rw)
/dev/mapper/DataVG-Data00 on /mnt/data type ext3 (rw)

root@7aed9d45-fdfc-4477-9d31-013db0f92ddd:~# df -h
Filesystem                 Size  Used Avail Use% Mounted on
/dev/xvda1                 20G   808M   18G   5% /
none                       490M  124K  490M   1% /dev
none                       498M     0  498M   0% /dev/shm
none                       498M   44K  498M   1% /var/run
none                       498M     0  498M   0% /var/lock
/dev/mapper/DataVG-Data00  79G   184M   75G   1% /mnt/data

4. /etc/fstab에 마운트 정보 추가

root@7aed9d45-fdfc-4477-9d31-013db0f92ddd:/etc# vi fstab 
# /etc/fstab: static file system information.
#
# Use 'blkid -o value -s UUID' to print the universally unique identifier
# for a device; this may be used with UUID= as a more robust way to name
# devices that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    nodev,noexec,nosuid 0       0
# / was on /dev/xvda1 during installation
UUID=00cf8b97-f9d2-4733-95e7-ef6352cdf125 /               ext3    errors=remount-ro 0       1
/dev/DataVG/Data00 /mnt/data ext3 defaults 1 2 <<= 추가한 내용

 

Advertisements

7 thoughts on “ucloud server에 Data 디스크의 파티션 생성과 마운트하기

    나그네 said:
    2013/07/08 03:27

    정말 감사드립니다. 큰 도움이 되었습니다^^

    […] ucloud server에 Data 디스크의 파티션 생성과 마운트하기 자료를 참고하시면 KT ucloud server를 처음 이용하실 때 도움이 될 것입니다. […]

    조소연 said:
    2015/02/02 17:25

    짱짱맨 ㅜㅜ

    […] ucloud server에 Data 디스크의 파티션 생성과 마운트하기 자료를 참고하시면 KT ucloud server를 처음 이용하실 때 도움이 될 것입니다. […]

    […] ucloud server에 Data 디스크의 파티션 생성과 마운트하기 자료를 참고하시면 KT ucloud server를 처음 이용하실 때 도움이 될 것입니다. […]

    […] ucloud server에 Data 디스크의 파티션 생성과 마운트하기 자료를 참고하시면 KT ucloud server를 처음 이용하실 때 도움이 될 것입니다. […]

답글 남기기

아래 항목을 채우거나 오른쪽 아이콘 중 하나를 클릭하여 로그 인 하세요:

WordPress.com 로고

WordPress.com의 계정을 사용하여 댓글을 남깁니다. 로그아웃 / 변경 )

Twitter 사진

Twitter의 계정을 사용하여 댓글을 남깁니다. 로그아웃 / 변경 )

Facebook 사진

Facebook의 계정을 사용하여 댓글을 남깁니다. 로그아웃 / 변경 )

Google+ photo

Google+의 계정을 사용하여 댓글을 남깁니다. 로그아웃 / 변경 )

%s에 연결하는 중