ext4 filesystem logical volume resizing# Operation System/Linux2021. 4. 21. 09:16
Table of Contents
728x90
반응형
lvm으로 합쳤던 디스크를 사이즈 줄이고 새로 마운트해야할일이 있어서 아래와 같이 진행하였습니다.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
|
# df -Th
Filesystem Type Size Used Avail Use% Mounted on
devtmpfs devtmpfs 7.8G 0 7.8G 0% /dev
tmpfs tmpfs 7.8G 0 7.8G 0% /dev/shm
tmpfs tmpfs 7.8G 8.8M 7.8G 1% /run
tmpfs tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup
/dev/mapper/centos-root ext4 9.8G 1.9G 7.4G 21% /
/dev/sda1 xfs 1014M 195M 820M 20% /boot
/dev/mapper/centos-apps ext4 425G 70M 403G 1% /apps
tmpfs tmpfs 1.6G 0 1.6G 0% /run/user/0
# vgs
VG #PV #LV #SN Attr VSize VFree
centos 2 3 0 wz--n- 448.99g 0
# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 centos lvm2 a-- <149.00g 0
/dev/sdb1 centos lvm2 a-- <300.00g 0
# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
apps centos -wi-ao---- <431.12g
root centos -wi-ao---- 10.00g
swap centos -wi-ao---- <7.88g
# lvreduce -L -300G /dev/centos/apps
WARNING: Reducing active logical volume to <131.12 GiB.
THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce centos/apps? [y/n]: y
Size of logical volume centos/apps changed from <431.12 GiB (110366 extents) to <131.12 GiB (33566 extents).
Logical volume centos/apps successfully resized.
# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
apps centos -wi-a----- <131.12g
root centos -wi-ao---- 10.00g
swap centos -wi-ao---- <7.88g
# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 centos lvm2 a-- <149.00g 4.00m
/dev/sdb1 centos lvm2 a-- <300.00g <300.00g
# mkfs.ext4 /dev/centos/apps
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
8593408 inodes, 34371584 blocks
1718579 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2183135232
1049 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, 23887872
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
# mount /apps
# df -Th
Filesystem Type Size Used Avail Use% Mounted on
devtmpfs devtmpfs 7.8G 0 7.8G 0% /dev
tmpfs tmpfs 7.8G 0 7.8G 0% /dev/shm
tmpfs tmpfs 7.8G 8.8M 7.8G 1% /run
tmpfs tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup
/dev/mapper/centos-root ext4 9.8G 1.9G 7.4G 21% /
/dev/sda1 xfs 1014M 195M 820M 20% /boot
tmpfs tmpfs 1.6G 0 1.6G 0% /run/user/0
/dev/mapper/centos-apps ext4 129G 61M 123G 1% /apps
# mkdir -p /data
# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 centos lvm2 a-- <149.00g 4.00m
/dev/sdb1 centos lvm2 a-- <300.00g <300.00g
# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
apps centos -wi-ao---- <131.12g
root centos -wi-ao---- 10.00g
swap centos -wi-ao---- <7.88g
# pvscan
PV /dev/sda2 VG centos lvm2 [<149.00 GiB / 4.00 MiB free]
PV /dev/sdb1 VG centos lvm2 [<300.00 GiB / <300.00 GiB free]
Total: 2 [448.99 GiB] / in use: 2 [448.99 GiB] / in no VG: 0 [0 ]
# lvcreate -n data -l +100%FREE centos
Logical volume "data" created.
# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
apps centos -wi-ao---- <131.12g
data centos -wi-a----- 300.00g
root centos -wi-ao---- 10.00g
swap centos -wi-ao---- <7.88g
# mkfs.ext
mkfs.ext2 mkfs.ext3 mkfs.ext4
# mkfs.ext4 /dev/centos/data
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
19660800 inodes, 78643200 blocks
3932160 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2227175424
2400 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, 23887872, 71663616
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
# mount -t ext4 /dev/centos/data /data
# df -Th
Filesystem Type Size Used Avail Use% Mounted on
devtmpfs devtmpfs 7.8G 0 7.8G 0% /dev
tmpfs tmpfs 7.8G 0 7.8G 0% /dev/shm
tmpfs tmpfs 7.8G 8.9M 7.8G 1% /run
tmpfs tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup
/dev/mapper/centos-root ext4 9.8G 1.9G 7.4G 21% /
/dev/sda1 xfs 1014M 195M 820M 20% /boot
tmpfs tmpfs 1.6G 0 1.6G 0% /run/user/0
/dev/mapper/centos-apps ext4 129G 61M 123G 1% /apps
/dev/mapper/centos-data ext4 296G 65M 281G 1% /data
# vi /etc/fstab
#
# /etc/fstab
# Created by anaconda on Tue Apr 20 13:35:55 2021
#
# 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
#
/dev/mapper/centos-root / ext4 defaults 1 1
/dev/mapper/centos-apps /apps ext4 defaults 1 2
/dev/mapper/centos-data /data ext4 defaults 1 2
UUID=a231425f-fbd8-4e0d-b231-3e04bcb82390 /boot xfs defaults 0 0
/dev/mapper/centos-swap swap swap defaults 0 0
|
cs |
728x90
반응형
'# Operation System > Linux' 카테고리의 다른 글
code-server 설치 (0) | 2021.09.24 |
---|---|
[리눅스]vi 에디터 사용법 (0) | 2021.06.15 |
[리눅스]SWAP 메모리 생성 (0) | 2021.04.05 |
centos6x openssl 및 nginx 업데이트 (0) | 2021.02.15 |
geoip 자동업데이트 스크립트 (0) | 2020.10.23 |
@다크쉐라빔 :: 다크쉐라빔의 주절주절
안녕하세요. 이곳은 IT위주의 잡다한 정보를 올려두는 개인 블로그입니다.
포스팅이 좋았다면 "좋아요❤️" 또는 "구독👍🏻" 해주세요!