linux下lvm的簡單操作
[root@localhost rc.d]# fdisk -l
Disk /dev/sda: 536.8 GB, 536870912000 bytes
16 heads, 255 sectors/track, 257003 cylinders
Units = cylinders of 4080 * 512 = 2088960 bytes
Device Boot Start End Blocks Id System
Disk /dev/hda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 13 104391 83 Linux
/dev/hda2 14 2610 20860402+ 8e Linux LVM
建立PV
[root@localhost rc.d]# pvcreate /dev/sda
Physical volume "/dev/sda" successfully created
檢視PV
[root@localhost rc.d]# pvscan
PV /dev/hda2 VG VolGroup00 lvm2 [19.88 GB / 0 free]
PV /dev/sda lvm2 [500.00 GB]
Total: 2 [519.88 GB] / in use: 1 [19.88 GB] / in no VG: 1 [500.00 GB]
建立VG
[root@localhost rc.d]# vgcreate VolGroup01 /dev/sda
Volume group "VolGroup01" successfully created
啟用VG
[root@localhost rc.d]# vgchange -a y VolGroup01
0 logical volume(s) in volume group "VolGroup01" now active
建立LV
[root@localhost rc.d]# lvcreate -L8192M -nswapvol00 VolGroup01
Logical volume "swapvol00" created
查詢LV
[root@localhost rc.d]# lvscan
ACTIVE '/dev/VolGroup00/LogVol00' [18.88 GB] inherit
ACTIVE '/dev/VolGroup00/LogVol01' [1.00 GB] inherit
ACTIVE '/dev/VolGroup01/swapvol00' [8.00 GB] inherit
[root@localhost rc.d]# lvcreate -L30720M -ndataVol00 VolGroup01
Logical volume "dataVol00" created
[root@localhost rc.d]#
[root@localhost rc.d]# lvscan
ACTIVE '/dev/VolGroup00/LogVol00' [18.88 GB] inherit
ACTIVE '/dev/VolGroup00/LogVol01' [1.00 GB] inherit
ACTIVE '/dev/VolGroup01/swapvol00' [8.00 GB] inherit
ACTIVE '/dev/VolGroup01/dataVol00' [30.00 GB] inherit
格式化lv
[root@localhost rc.d]# mkfs -t ext3 /dev/VolGroup01/dataVol00
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
3932160 inodes, 7864320 blocks
393216 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
240 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000
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.
掛載檔案系統
[root@localhost rc.d]# mount /dev/VolGroup01/dataVol00 /u01
掛載swap
[root@localhost rc.d]# lvscan
ACTIVE '/dev/VolGroup00/LogVol00' [18.88 GB] inherit
ACTIVE '/dev/VolGroup00/LogVol01' [1.00 GB] inherit
ACTIVE '/dev/VolGroup01/swapvol00' [8.00 GB] inherit
ACTIVE '/dev/VolGroup01/dataVol00' [30.00 GB] inherit
[root@localhost rc.d]#
[root@localhost rc.d]#
[root@localhost rc.d]# mkswap /dev/VolGroup01/swapvol00
Setting up swapspace version 1, size = 8589930 kB
[root@localhost rc.d]#
[root@localhost rc.d]# swapon /dev/VolGroup01/swapvol00
[root@localhost rc.d]#
[root@localhost rc.d]# swapon -s
Filename Type Size Used Priority
/dev/mapper/VolGroup00-LogVol01 partition 1048568 0 -1
/dev/mapper/VolGroup01-swapvol00 partition 8388600 0 -3
[root@localhost rc.d]#
[root@localhost rc.d]# free -m
total used free shared buffers cached
Mem: 3959 481 3478 0 32 328
-/+ buffers/cache: 121 3838
Swap: 9215 0 9215
[root@localhost rc.d]#
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/11590946/viewspace-1064217/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Linux(05):LVM簡介LinuxLVM
- linux下mail的簡單用法LinuxAI
- Linux下LVM邏輯卷管理LinuxLVM
- Linux下一些操作的簡單整理Linux
- Linux LVMLinuxLVM
- Linux下history命令簡單原理Linux
- linux之lvmLinuxLVM
- 使用Linux lvmLinuxLVM
- 配置簡單的linux 的幾個操作步驟(Cent OS)Linux
- LVM : 簡介LVM
- windows下node更換版本(簡單操作)Windows
- Linux下簡單部署伺服器Linux伺服器
- Linux下的Mysql操作LinuxMySql
- MyBatis 的簡單 CRUD 操作MyBatis
- linux LVM詳解LinuxLVM
- Linux(06):LVM 案例LinuxLVM
- 簡單的linux Oops定位到bug程式碼行操作實踐LinuxOOP
- Nginx簡單操作Nginx
- Linux中的LVM和軟RAIDLinuxLVMAI
- springboot中redis的簡單操作Spring BootRedis
- Linux 建立LVM(Logical Volume)LinuxLVM
- LVM的知識總結和操作大全LVM
- Linux下使用LVM管理(擴充套件/縮小/刪除)LinuxLVM套件
- Linux 新增LVM分割槽及LVM分割槽擴容LinuxLVM
- Linux中LVM是什麼?LVM名詞有哪些?LinuxLVM
- linux下簡單好用的埠對映轉發工具rinetdLinux
- Linux下編譯安裝Mysql 5.5的簡單步驟Linux編譯MySql
- 簡單安裝PHP在Linux下的執行環境PHPLinux
- Maven Deploy 簡單操作Maven
- 【Javascript】——簡單cookie操作JavaScriptCookie
- WPF下使用FreeRedis操作RedisStream實現簡單的訊息佇列Redis佇列
- java實現棧的簡單操作Java
- Linux下實現 OpenSSL 簡單加密與解密字串Linux加密解密字串
- mysql的安裝和簡單的操作MySql
- linux 給lvm磁碟擴容LinuxLVM
- linux之LVM邏輯卷LinuxLVM
- oracle 10g在linux下的安裝及簡單命令Oracle 10gLinux
- [Linux]簡單的shell實現Linux
- linux下安裝redis 單節點安裝操作步驟LinuxRedis