Format and partition device-mapper in LVM

에이바 asked:

I have a disk on a server:
/dev/VolGroup00/LogVol02 that is about 5TB.

I would like to format and partition it to make 2 500GB mount points. It doesn’t even have to be in LVM. How can I take this disk out of LVM so that I can use a tool such as parted to break up the disk to the needed 500GB mount points?

lvs:

 LV       VG         Attr   LSize   Origin Snap%  Move Log Copy%  Convert
  LogVol00 VolGroup00 -wi-ao  30.00G
  LogVol01 VolGroup00 -wi-ao 127.91G
  LogVol02 VolGroup00 -wi-ao   4.76T

pvs:

PV                  VG         Fmt  Attr PSize   PFree
  /dev/cciss/c0d0p2   VolGroup00 lvm2 a--    1.64T    0
  /dev/cciss/c0d1p1   VolGroup00 lvm2 a--    3.27T    0
  /dev/mpath/mpath0p2 VolGroup00 lvm2 a--  405.88G    0

vgs:

VG         #PV #LV #SN Attr   VSize   VFree
  VolGroup00   1   2   0 wz--n- 405.88G    0
  VolGroup00   2   3   0 wz--n-   4.91T    0

df -h

Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                       30G  7.4G   21G  27% /
/dev/cciss/c0d0p1      99M   30M   65M  32% /boot
tmpfs                  63G     0   63G   0% /dev/shm
/dev/mapper/mpath6p1  551G  151G  373G  29% /oracletest/r12
/dev/mapper/mpath2p1  4.5T  2.1T  2.2T  48% /oracletest/r12/db/apps_st/data
/dev/mapper/mpath3p1  1.5T  674G  762G  47% /oracletest/r12/db/apps_st/index
/dev/mapper/mpath4p1   92G   31G   57G  35% /oracletest/r12/db/apps_st/undo
/dev/mapper/mpath5p1  276G  151G  111G  58% /oracletest/r12/db/apps_st/temp
remoteserver.domain.com:/oaprod/dir
                      6.3T  3.8T  2.3T  63% /oaprod/dir
/dev/mapper/VolGroup00-LogVol02
                      4.7T  3.0T  1.5T  67% /oracletest_old << this one

My answer:


I think you’ve missed the point of LVM entirely.

If you don’t want a 4.76TB logical volume, then shrink it or delete it and make your own in whatever sizes you want.

lvremove /dev/VolGroup00/LogVol02
lvcreate -L 500G -n myfirstvolume VolGroup00
lvcreate -L 500G -n mysecondvolume VolGroup00

mkfs -t ext4 /dev/VolGroup00/myfirstvolume
mkfs -t ext4 /dev/VolGroup00/mysecondvolume

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.