[root@server4 mnt]# fdisk -cu /dev/vda
Command (m for help): p
Disk /dev/vda: 6442 MB, 6442450944 bytes
16 heads, 63 sectors/track, 12483 cylinders, total 12582912 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0003b970
Device Boot Start End Blocks Id System
/dev/vda1 * 2048 526335 262144 83 Linux
/dev/vda2 526336 9914367 4694016 8e Linux LVM
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 3
First sector (9914368-12582911, default 9914368):
Using default value 9914368
Last sector, +sectors or +size{K,M,G} (9914368-12582911, default 12582911): +512M
Command (m for help): p
Disk /dev/vda: 6442 MB, 6442450944 bytes
16 heads, 63 sectors/track, 12483 cylinders, total 12582912 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0003b970
Device Boot Start End Blocks Id System
/dev/vda1 * 2048 526335 262144 83 Linux
/dev/vda2 526336 9914367 4694016 8e Linux LVM
/dev/vda3 9914368 10962943 524288 83 Linux
Command (m for help): t
Partition number (1-4): 3
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
Changed system type of partition 3 to 8e (Linux LVM)
Command (m for help): p
Disk /dev/vda: 6442 MB, 6442450944 bytes
16 heads, 63 sectors/track, 12483 cylinders, total 12582912 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0003b970
Device Boot Start End Blocks Id System
/dev/vda1 * 2048 526335 262144 83 Linux
/dev/vda2 526336 9914367 4694016 8e Linux LVM
/dev/vda3 9914368 10962943 524288 8e Linux LVM
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
You have mail in /var/spool/mail/root
reboot
[root@server4 ~]# fdisk -cul /dev/vda
Disk /dev/vda: 6442 MB, 6442450944 bytes
16 heads, 63 sectors/track, 12483 cylinders, total 12582912 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0003b970
Device Boot Start End Blocks Id System
/dev/vda1 * 2048 526335 262144 83 Linux
/dev/vda2 526336 9914367 4694016 8e Linux LVM
/dev/vda3 9914368 10962943 524288 8e Linux LVM
[root@server4 ~]# pvcreate /dev/vda3
Physical volume "/dev/vda3" successfully created
[root@server4 ~]# pvdisplay
--- Physical volume ---
PV Name /dev/vda2
VG Name vgsrv
PV Size 4.48 GiB / not usable 8.00 MiB
Allocatable yes
PE Size 32.00 MiB
Total PE 143
Free PE 12
Allocated PE 131
PV UUID pDzfZr-vU3O-NKNz-BY9E-a4Cc-5H9I-nCDf6W
"/dev/vda3" is a new physical volume of "512.00 MiB"
--- NEW Physical volume ---
PV Name /dev/vda3
VG Name
PV Size 512.00 MiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID eSOCXp-Xv2M-M3Uh-Ux8b-27s2-z493-32uigb
[root@server4 ~]# vgcreate myvg /dev/vda3
Volume group "myvg" successfully created
[root@server4 ~]# vgdisplay
--- Volume group ---
VG Name myvg
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 508.00 MiB
PE Size 4.00 MiB
Total PE 127
Alloc PE / Size 0 / 0
Free PE / Size 127 / 508.00 MiB
VG UUID NiNBZp-HXvb-Ot1z-7BP6-qPLC-qEfL-EbOqnn
--- Volume group ---
VG Name vgsrv
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 4
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 3
Open LV 3
Max PV 0
Cur PV 1
Act PV 1
VG Size 4.47 GiB
PE Size 32.00 MiB
Total PE 143
Alloc PE / Size 131 / 4.09 GiB
Free PE / Size 12 / 384.00 MiB
VG UUID aczbf9-JX7Z-fZex-QABU-vpfx-cEoT-USUj82
[root@server4 ~]# lvcreate -L 250M -n mylv myvg
Rounding up size to full physical extent 252.00 MiB
Logical volume "mylv" created
[root@server4 ~]# lvdisplay
--- Logical volume ---
LV Name /dev/myvg/mylv
VG Name myvg
LV UUID Ry8NKT-CFgh-6V40-YpWG-tZ44-jRO2-xAcz9R
LV Write Access read/write
LV Status available
# open 0
LV Size 252.00 MiB
Current LE 63
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:3
--- Logical volume ---
LV Name /dev/vgsrv/swap
VG Name vgsrv
LV UUID kujn9Z-lAqm-UWVh-1Q5k-Bafr-bYlz-FD7pBK
LV Write Access read/write
LV Status available
# open 1
LV Size 544.00 MiB
Current LE 17
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
--- Logical volume ---
LV Name /dev/vgsrv/root
VG Name vgsrv
LV UUID K5InPQ-q7Bc-gCyp-PVyg-z3Wc-ZAV6-Wos8M3
LV Write Access read/write
LV Status available
# open 1
LV Size 3.31 GiB
Current LE 106
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1
--- Logical volume ---
LV Name /dev/vgsrv/home
VG Name vgsrv
LV UUID ScquFn-q2D6-uOGO-GuiL-y4DF-IvbM-FqYuRh
LV Write Access read/write
LV Status available
# open 1
LV Size 256.00 MiB
Current LE 8
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:2
[root@server4 ~]# mkfs -t ext4 /dev/myvg/mylv
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
Stride=0 blocks, Stripe width=0 blocks
64512 inodes, 258048 blocks
12902 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=67371008
32 block groups
8192 blocks per group, 8192 fragments per group
2016 inodes per group
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729, 204801, 221185
Writing inode tables: done
Creating journal (4096 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@server4 ~]# cd /
[root@server4 /]# mkdir storage
[root@server4 /]# ls
bin dev lib media net root srv tmp
boot etc lib64 misc opt sbin storage usr
cgroup home lost+found mnt proc selinux sys var
[root@server4 /]# vim /etc/fstab
[root@server4 /]# mount -a
[root@server4 /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vgsrv-root
3.3G 2.2G 962M 70% /
tmpfs 246M 260K 246M 1% /dev/shm
/dev/vda1 248M 30M 206M 13% /boot
/dev/mapper/vgsrv-home
248M 11M 226M 5% /home
/dev/mapper/myvg-mylv
245M 6.1M 226M 3% /storage
df -h 라고 하면 /dev/mapper/myvg-mylv 가 된다 내가 fstab 에다
/dev/myvg/mylv 라고 했어도
ㅇ
[root@server4 ~]# fdisk -cul /dev/vda
Disk /dev/vda: 6442 MB, 6442450944 bytes
16 heads, 63 sectors/track, 12483 cylinders, total 12582912 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0003b970
Device Boot Start End Blocks Id System
/dev/vda1 * 2048 526335 262144 83 Linux
/dev/vda2 526336 9914367 4694016 8e Linux LVM
/dev/vda3 9914368 10962943 524288 8e Linux LVM
/dev/vda4 10962944 12011519 524288 8e Linux LVM
[root@server4 ~]# pvcreate /dev/vda4
Physical volume "/dev/vda4" successfully created
[root@server4 ~]# vgcreate shazam /dev/vda4
Volume group "shazam" successfully created
[root@server4 ~]# vgdisplay myvg
--- Volume group ---
VG Name myvg
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 2
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 1
Max PV 0
Cur PV 1
Act PV 1
VG Size 508.00 MiB
PE Size 4.00 MiB
Total PE 127
Alloc PE / Size 63 / 252.00 MiB
Free PE / Size 64 / 256.00 MiB
VG UUID NiNBZp-HXvb-Ot1z-7BP6-qPLC-qEfL-EbOqnn
[root@server4 ~]# lvextend -l +128M /dev/myvg/mylv
Invalid argument +128M
Error during parsing of command line.
[root@server4 ~]# lvextend -L +128M /dev/myvg/mylv
Extending logical volume mylv to 380.00 MiB
Logical volume mylv successfully resized
[root@server4 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vgsrv-root
3.3G 2.2G 959M 70% /
tmpfs 246M 260K 246M 1% /dev/shm
/dev/vda1 248M 30M 206M 13% /boot
/dev/mapper/vgsrv-home
248M 11M 226M 5% /home
[root@server4 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vgsrv-root
3.3G 2.2G 959M 70% /
tmpfs 246M 260K 246M 1% /dev/shm
/dev/vda1 248M 30M 206M 13% /boot
/dev/mapper/vgsrv-home
248M 11M 226M 5% /home
[root@server4 ~]# resize2fs -p /dev/myvg/mylv
resize2fs 1.41.12 (17-May-2010)
Please run 'e2fsck -f /dev/myvg/mylv' first.
[root@server4 ~]# e2fsck -f /dev/myvg/mylv
e2fsck 1.41.12 (17-May-2010)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/myvg/mylv: 11/64512 files (0.0% non-contiguous), 14303/258048 blocks
[root@server4 ~]# resize2fs -p /dev/myvg/mylv
resize2fs 1.41.12 (17-May-2010)
Resizing the filesystem on /dev/myvg/mylv to 389120 (1k) blocks.
Begin pass 1 (max = 16)
Extending the inode table XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
The filesystem on /dev/myvg/mylv is now 389120 blocks long.
[root@server4 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vgsrv-root
3.3G 2.2G 958M 70% /
tmpfs 246M 260K 246M 1% /dev/shm
/dev/vda1 248M 30M 206M 13% /boot
/dev/mapper/vgsrv-home
248M 11M 226M 5% /home
[root@server4 ~]# vi /etc/fstab
[root@server4 ~]# vim /etc/fstab
[root@server4 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vgsrv-root
3.3G 2.2G 958M 70% /
tmpfs 246M 260K 246M 1% /dev/shm
/dev/vda1 248M 30M 206M 13% /boot
/dev/mapper/vgsrv-home
248M 11M 226M 5% /home
[root@server4 ~]# cd /storage
[root@server4 storage]# ll
total 0
[root@server4 storage]# cd ..
[root@server4 /]# ll
total 104
dr-xr-xr-x. 2 root root 4096 Aug 28 10:51 bin
dr-xr-xr-x. 5 root root 1024 Aug 25 13:33 boot
drwxr-xr-x. 2 root root 4096 Jul 14 2010 cgroup
drwxr-xr-x. 17 root root 3580 Aug 28 11:08 dev
drwxr-xr-x. 113 root root 12288 Aug 28 11:13 etc
drwxr-xr-x. 5 root root 1024 Aug 25 13:33 home
dr-xr-xr-x. 11 root root 4096 Aug 25 13:31 lib
dr-xr-xr-x. 10 root root 12288 Aug 28 10:51 lib64
drwx------. 2 root root 16384 Aug 25 13:26 lost+found
drwxr-xr-x. 2 root root 4096 Dec 4 2009 media
drwxr-xr-x. 2 root root 0 Aug 28 11:08 misc
drwxr-xr-x. 3 root root 4096 Aug 28 10:15 mnt
drwxr-xr-x. 2 root root 0 Aug 28 11:08 net
drwxr-xr-x. 2 root root 4096 Dec 4 2009 opt
dr-xr-xr-x. 164 root root 0 Aug 28 2012 proc
dr-xr-x---. 26 root root 4096 Aug 28 11:13 root
dr-xr-xr-x. 2 root root 12288 Aug 28 10:51 sbin
drwxr-xr-x. 7 root root 0 Aug 28 2012 selinux
drwxr-xr-x. 2 root root 4096 Dec 4 2009 srv
drwxr-xr-x. 2 root root 4096 Aug 28 10:57 storage
drwxr-xr-x. 13 root root 0 Aug 28 2012 sys
drwxrwxrwt. 14 root root 4096 Aug 28 11:11 tmp
drwxr-xr-x. 13 root root 4096 Aug 25 13:27 usr
drwxr-xr-x. 24 root root 4096 Aug 25 13:30 var
[root@server4 /]# mount -a
[root@server4 /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vgsrv-root
3.3G 2.2G 958M 70% /
tmpfs 246M 260K 246M 1% /dev/shm
/dev/vda1 248M 30M 206M 13% /boot
/dev/mapper/vgsrv-home
248M 11M 226M 5% /home
/dev/mapper/myvg-mylv
369M 6.1M 344M 2% /storage
[root@server4 /]# umount /storage
[root@server4 /]# fsck -f /dev/myvg/mylv
fsck from util-linux-ng 2.17.2
e2fsck 1.41.12 (17-May-2010)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/mapper/myvg-mylv: 11/96768 files (0.0% non-contiguous), 18367/389120 blocks
[root@server4 /]# resize2fs -p /dev/myvg/mylv 256M
resize2fs 1.41.12 (17-May-2010)
Resizing the filesystem on /dev/myvg/mylv to 262144 (1k) blocks.
Begin pass 3 (max = 48)
Scanning inode table XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
The filesystem on /dev/myvg/mylv is now 262144 blocks long.
[root@server4 /]# lvreduce -L 256M /dev/myvg/mylv
WARNING: Reducing active and open logical volume to 256.00 MiB
THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce mylv? [y/n]: y
Reducing logical volume mylv to 256.00 MiB
Logical volume mylv successfully resized
[root@server4 /]# mount -a
[root@server4 /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vgsrv-root
3.3G 2.2G 958M 70% /
tmpfs 246M 260K 246M 1% /dev/shm
/dev/vda1 248M 30M 206M 13% /boot
/dev/mapper/vgsrv-home
248M 11M 226M 5% /home
/dev/mapper/myvg-mylv
249M 6.1M 230M 3% /storage
'UNIX > Redhat' 카테고리의 다른 글
LVM - 솔라리스에서 RAID 사용 및 VG 활성화, VG제거, PV삭제, LV스냅샷, LV축소 (0) | 2012.08.28 |
---|---|
12/08/28 5장 계정 관리 (0) | 2012.08.28 |
12/08/28 3장 iSCSI 저장소에 액세스 (0) | 2012.08.28 |
12/08/27 3장 저장 장치 관리 (0) | 2012.08.27 |
12/08/27 2장 네트워크 관리 (0) | 2012.08.27 |