티스토리 뷰

EN/Debian 6

Debian 6 LVM Physical Volumes

ServerWorld 2016.05.23 22:15

Debian 6 LVM Physical Volumes


Physical Volumes


1. How to create LVM partition when a new hard disk is installed


root@debian:~# fdisk /dev/sdb# create a partition in new HD


The number of cylinders for this disk is set to 20023.

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): p# show partition table


Disk /dev/sdb: 164.6 GB, 164696555520 bytes

255 heads, 63 sectors/track, 20023 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes


  Device BootStartEndBlocksIdSystem

 # none

Command (m for help): n# create a partition

Command action

  e    extended

  p    primary partition (1-4)

p# primary

Partition number (1-4): 1# partition number

First cylinder (1-20023, default 1): # First cylinder

Using default value 1

Last cylinder or +size or +sizeM or +sizeK (1-20023, default 20023):  # Last cylinder 

Using default value 20023


Command (m for help): p# show partition table


Disk /dev/sdb: 164.6 GB, 164696555520 bytes

255 heads, 63 sectors/track, 20023 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes


  Device BootStartEndBlocksIdSystem

  /dev/sdb112002316083471683Linux   # created


Command (m for help): t# change partition type

Selected partition 1# number

Hex code (type L to list codes): L# show list of types


0 Empty1e Hidden W95 FAT180 Old Minixbe Solaris boot

1 FAT1224 NEC DOS81 Minix / old Linbf Solaris

2 XENIX root39 Plan 982 Linux swap / Soc1 DRDOS/sec

3 XENIX usr3c PartitionMagic83 Linuxc4 DRDOS/sec

4 FAT16 <32M40 Venix 8028684 OS/2 hidden C:c6 DRDOS/sec

5 Extended41 PPC PReP Boot85 Linux extendedc7 Syrinx

6 FAT1642 SFS86 NTFS volume setda Non-FS data

7 HPFS/NTFS4d QNX4.x 87 NTFS volume setdb CP/M / 

8 AIX4e QNX4.x 2nd part88 Linux plaintextde Dell Utility

9 AIX bootable4f QNX4.x 3rd part8e Linux LVMdf BootIt

a OS/2 Boot Manag50 OnTrack DM93 Amoebae1 DOS access

b W95 FAT3251 OnTrack DM6 Aux94 Amoeba BBTe3 DOS R/O

c W95 FAT32 (LBA)52 CP/M9f BSD/OSe4 SpeedStor

e W95 FAT16 (LBA)53 OnTrack DM6 Auxa0 IBM Thinkpad hieb BeOS fs

f W95 Ext'd (LBA)54 OnTrackDM6a5 FreeBSDee EFI GPT

10 OPUS55 EZ-Drivea6 OpenBSDef EFI (FAT-12

11 Hidden FAT1256 Golden Bowa7 NeXTSTEPf0 Linux/PA-

12 Compaq diagnost5c Priam Ediska8 Darwin UFSf1 SpeedStor

14 Hidden FAT16 <361 SpeedStora9 NetBSDf4 SpeedStor

16 Hidden FAT1663 GNU HURD or Sysab Darwin bootf2 DOS sec

17 Hidden HPFS/NTF64 Novell Netwareb7 BSDI fsfd Linux raid

18 AST SmartSleep65 Novell Netwareb8 BSDI swapfe LANstep

1b Hidden W95 FAT370 DiskSecure Multbb Boot Wizard hidff BBT

1c Hidden W95 FAT375 PC/IX


Hex code (type L to list codes): 8e   # Linux LVM

Changed system type of partition 1 to 8e (Linux LVM)


Command (m for help): p# show partition tables


Disk /dev/sdb: 164.6 GB, 164696555520 bytes

255 heads, 63 sectors/track, 20023 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes


  Device BootStartEndBlocksIdSystem

  /dev/sdb11200231608347168eLinux LVM   # changed


Command (m for help): w# save and exit


The partition table has been altered!


Calling ioctl() to re-read partition table.

Syncing disks.

otaec:~# sfdisk -l /dev/sdb# show status


Disk /dev/sdb: 20023 cylinders, 255 heads, 63 sectors/track

Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0


Device Boot StartEnd#cyls#blocksIdSystem

/dev/sdb10+2002220023-1608347168eLinux LVM  # created

/dev/sdb20-000Empty

/dev/sdb30-000Empty

/dev/sdb40-000Empty




2. Create a Physical Volume


root@debian:~# pvcreate /dev/sdb1# Create a Physical Volume 

  Physical volume "/dev/sdb1" successfully created


# input command like below if you would like to specify partition size

root@debian:~# pvcreate --setphysicalvolumesize 100G /dev/sdb1

  Physical volume "/dev/sdb1" successfully created


  

  

3. Display status of Physical volume


root@debian:~# pvdisplay /dev/sdb1# display status

  --- NEW Physical volume ---

  PV Name/dev/sdb1

  VG Name

  PV Size153.38 GB

  AllocatableNO

  PE Size (KByte) 0

  Total PE0

  Free PE0

  Allocated PE0

  PV UUIDm1DOwB-iAmG-8qMn-5GWW-kVCh-d0VP-6N34H5




4. Change volume size of Physical volume


# change a Physical volume to 100G

root@debian:~# pvresize --setphysicalvolumesize 100G /dev/sdb1

  Physical volume "/dev/sdb1" changed

  1 physical volume(s) resized / 0 physical volume(s) not resized

root@debian:~# pvdisplay /dev/sdb1

  --- NEW Physical volume ---

  PV Name/dev/sdb1

  VG Name

  PV Size100.00 GB# changed

  AllocatableNO

  PE Size (KByte) 0

  Total PE0

  Free PE0

  Allocated PE0

  PV UUIDm1DOwB-iAmG-8qMn-5GWW-kVCh-d0VP-6N34H5

  

  

  

5. Output reports of Physical volume


root@debian:~# pvs /dev/sdb1

  PV VGFmtAttrPSizePFree

  /dev/sdb1lvm2--100.00G100.00G

  

  

  

6. Scan Physical volume


root@debian:~# pvscan /dev/sdb1

  PV/dev/sda2VG Xenlvm2 [152.56 GB / 46.56 GB free]

  PV/dev/sdc1VG Xenlvm2 [74.50 GB / 37.50 GB free]

  PV/dev/sdb1lvm2 [100.00 GB]

  Total: 3 [327.06 GB] / in use: 2 [227.06 GB] / in no VG: 1 [100.00 GB]

  

  

  

7. Remove Physical volume


root@debian:~# pvremove /dev/sdb1

  Labels on physical volume "/dev/sdb1" successfully wiped

root@debian:~# pvdisplay /dev/sdb1

  No physical volume label read from /dev/sdb1   # disappear

  Failed to read physical volume "/dev/sdb1"


※ Next manual


저작자 표시 비영리 변경 금지
신고

'EN > Debian 6' 카테고리의 다른 글

Debian 6 LVM Logical Volumes  (0) 2016.05.23
Debian 6 LVM Volume Groups  (0) 2016.05.23
Debian 6 LVM Physical Volumes  (0) 2016.05.23
Debian 6 Create SSL Certificates  (0) 2016.05.23
Debian 6 Desktop Env VNC Server  (0) 2016.05.23
Debian 6 Desktop Env Desktop Environment  (0) 2016.05.23
댓글