파티션 정보 확인

[root@server /]# fdisk -l


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: 0x0009458d


    Device Boot      Start         End      Blocks   Id  System

/dev/xvda1   *           1         131     1048576   83  Linux

Partition 1 does not end on cylinder boundary.

/dev/xvda2             131         392     2097152   82  Linux swap / Solaris

Partition 2 does not end on cylinder boundary.

/dev/xvda3             392        2611    17824768   83  Linux


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



파티션 만들기

[root@server /]# 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 0xd56ebe5a.

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: 0xd56ebe5a


    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): 엔터(기본으로 1 적용)

Using default value 1

Last cylinder, +cylinders or +size{K,M,G} (1-10443, default 10443): 엔터(기본으로 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 <3 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.



파티션 확인

[root@server /]# fdisk -l


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: 0x0009458d


    Device Boot      Start         End      Blocks   Id  System

/dev/xvda1   *           1         131     1048576   83  Linux

Partition 1 does not end on cylinder boundary.

/dev/xvda2             131         392     2097152   82  Linux swap / Solaris

Partition 2 does not end on cylinder boundary.

/dev/xvda3             392        2611    17824768   83  Linux


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: 0xd56ebe5a


    Device Boot      Start         End      Blocks   Id  System

/dev/xvdb1               1       10443    83883366   8e  Linux LVM



LV(Logical Volume) 작업 - PV(Pysical Volume) 생성

[root@server /]# pvcreate /dev/xvdb1


Physical volume "/dev/xvdb1" successfully created



LV(Logical Volume) 작업 - PV 생성 확인

[root@server /]# pvscan


PV /dev/xvdb1                      lvm2 [80.00 GiB]

Total: 1 [80.00 GiB] / in use: 0 [0   ] / in no VG: 1 [80.00 GiB]



LV(Logical Volume) 작업 - PV 정보 보기

[root@server /]# 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               Q3LGAX-jhK4-w6eL-XA3t-Y1Mg-ICP0-IFzBOE



LV(Logical Volume) 작업 - VG(Volume Group) 생성

[root@server /]# vgcreate DataVG /dev/xvdb1


Volume group "DataVG" successfully created



LV(Logical Volume) 작업 - VG 생성 확인

[root@server /]# 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   ]



LV(Logical Volume) 작업 - VG 정보 보기

[root@server /]# 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               7aEQ4r-ecmp-1S5r-mcId-YIFB-aLXf-CLSTJc



LV(Logical Volume) 작업 - LV(Logical Volume) 생성

[root@server /]# lvcreate -L 80g -n Data00 DataVG


Volume group "DataVG" has insufficient free space (20479 extents): 20480 required.

[root@server /]# lvcreate -l 20479 -n Data00 DataVG


Logical volume "Data00" created



LV(Logical Volume) 작업 - LV 정보 보기

[root@server /]# lvdisplay


--- Logical volume ---

LV Path                /dev/DataVG/Data00

LV Name                Data00

VG Name                DataVG

LV UUID                NiQ37f-ilLm-m5iE-JNEl-UBP1-eNJt-mgQA7r

LV Write Access        read/write

LV Creation host, time VM1495178951968.localdomain, 2018-09-18 22:02:07 +0900

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           253:0



파일 시스템 생성

[root@server /]# mkfs.ext3 /dev/DataVG/Data00


mke2fs 1.41.12 (17-May-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 24 mounts or

180 days, whichever comes first.  Use tune2fs -c or -i to override.


마운트 작업 - 마운트 할 디렉토리 생성

[root@server /]# mkdir /data

마운트 작업 - /dev/DataVG/Data00를 /data에 마운트

[root@server /]# mount /dev/DataVG/Data00 /data


마운트 작업 - 마운트 확인

[root@server /]# mount


/dev/xvda3 on / type ext4 (rw)

proc on /proc type proc (rw)

sysfs on /sys type sysfs (rw)

devpts on /dev/pts type devpts (rw,gid=5,mode=620)

tmpfs on /dev/shm type tmpfs (rw)

/dev/xvda1 on /boot type ext4 (rw)

none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)

none on /proc/xen type xenfs (rw)

sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)

/dev/mapper/DataVG-Data00 on /data type ext3 (rw)

[root@server /]# df -h


Filesystem            Size  Used Avail Use% Mounted on

/dev/xvda3             17G   15G  1.4G  92% /

tmpfs                 1.9G     0  1.9G   0% /dev/shm

/dev/xvda1           1008M   56M  901M   6% /boot

/dev/mapper/DataVG-Data00

                       79G  184M   75G   1% /data



마운트 작업 - /etc/fstab에 마운트 정보 추가

[root@server /]# vi /etc/fstab


#

# /etc/fstab

# Created by anaconda on Wed Mar 16 15:52:09 2016

#

# Accessible filesystems, by reference, are maintained under '/dev/disk'

# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info

#

UUID=cc0565f7-adc2-4995-92d8-03d03830e0b3 /                       ext4    defaults        1 1

UUID=ab5b8d4a-1997-4b82-a764-05dbdf44dac2 /boot                   ext4    defaults        1 2

UUID=5cb8d624-6c99-478d-b05d-566b756ae6a5 swap                    swap    defaults        0 0

tmpfs                   /dev/shm                tmpfs   defaults        0 0

devpts                  /dev/pts                devpts  gid=5,mode=620  0 0

sysfs                   /sys                    sysfs   defaults        0 0

proc                    /proc                   proc    defaults        0 0

/dev/DataVG/Data00 /data ext3 defaults 1 2 <<= 추가한 내용


+ Recent posts