Minores orbis reposuit in Linux cum maioribus orbis

Hi omnes. In vigilia initium novum cursum coetus "Administrator Linux" Materiam utilem a nostro discipulo scriptam praedicamus, necnon matronae cursum, auxilium technicum specialitas pro products corporatum REG.RU - Roman Travin.

Hic articulus considerabit 2 casus reponendi orbis ac informationes transferendi ad novos orbes capacitatis amplioris cum ulteriore expansione systematis ordinati ac lima. Primus casus ad subrogationem orbis cum eisdem MBR/MBR vel GPT/GPT partiendis spectabit, secundus casus ad subrogationem orbis cum MBR partitionibus cum disci cum capacitate plus quam 2 TB, in quo instituere debebis. GPT partitio cum biosboot partitio. In utroque casu, orbis ad quos notitias transferimus, iam in calculonis servi sunt. Tabellae ratio adhibita ad partitionem radicis ext4.

Causa I: Repositoque minor orbis cum maior orbis (usque ad 1TB)

Negotium: Reponere orbis vena cum maioribus orbis (usque ad 2 TB) cum notitia translationis. In hoc casu habemus 2 x 240 GB SSD (RAID-1) orbes cum systemate inaugurato et 2 x 1 TB SATA orbis ad quos ratio transferri debet.

Inspice orbis hodiernam extensionem.

[root@localhost ~]# lsblk
NAME           MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda              8:0    0 223,6G  0 disk  
├─sda1           8:1    0     1G  0 part  
│ └─md126        9:126  0  1023M  0 raid1 /boot
└─sda2           8:2    0 222,5G  0 part  
  └─md127        9:127  0 222,4G  0 raid1 
    ├─vg0-root 253:0    0 206,4G  0 lvm   /
    └─vg0-swap 253:1    0    16G  0 lvm   [SWAP]
sdb              8:16   0 223,6G  0 disk  
├─sdb1           8:17   0     1G  0 part  
│ └─md126        9:126  0  1023M  0 raid1 /boot
└─sdb2           8:18   0 222,5G  0 part  
  └─md127        9:127  0 222,4G  0 raid1 
    ├─vg0-root 253:0    0 206,4G  0 lvm   /
    └─vg0-swap 253:1    0    16G  0 lvm   [SWAP]
sdc              8:32   0 931,5G  0 disk  
sdd              8:48   0 931,5G  0 disk  

Let's check the currently used file system space.

[root@localhost ~]# df -h
Файловая система     Размер Использовано  Дост Использовано% Cмонтировано в
devtmpfs                32G            0   32G            0% /dev
tmpfs                   32G            0   32G            0% /dev/shm
tmpfs                   32G         9,6M   32G            1% /run
tmpfs                   32G            0   32G            0% /sys/fs/cgroup
/dev/mapper/vg0-root   204G         1,3G  192G            1% /
/dev/md126            1007M         120M  837M           13% /boot
tmpfs                  6,3G            0  6,3G            0% /run/user/0

Magnitudo systematis tabellae antequam orbis reponatur, est 204 GB, 2 md126, programmata vestium adhibentur quae annectitur in /boot и md127, quod dicitur as corporis volumine for VG group vg0.

Vestit 1. removere ab orbe saepta

Reprehendo de statu ordinata

[root@localhost ~]# cat /proc/mdstat 
Personalities : [raid1] 
md126 : active raid1 sda1[0] sdb1[1]
      1047552 blocks super 1.2 [2/2] [UU]
      bitmap: 0/1 pages [0KB], 65536KB chunk

md127 : active raid1 sda2[0] sdb2[1]
      233206784 blocks super 1.2 [2/2] [UU]
      bitmap: 0/2 pages [0KB], 65536KB chunk

unused devices: <none>

Ratio utitur II vestit: md126 (Mons punctum /boot) - Constat sectionem /dev/sda1 и /dev/sdb1, md127 (LVM for PERMUTO et radix tabellae ratio) - constat ex /dev/sda2 и /dev/sdb2.

Partitiones primi orbis notamus quae in singulis malis sunt ordinata.

mdadm /dev/md126 --fail /dev/sda1

mdadm /dev/md127 --fail /dev/sda2

Remota fabrica saepta /dev/sda impedimentum ex vestit.

mdadm /dev/md126 --remove /dev/sda1

mdadm /dev/md127 --remove /dev/sda2

Postquam orbis ex acie removimus, informationes fabricae truncus hoc modo spectabit.

[root@localhost ~]# lsblk
NAME           MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda              8:0    0 223,6G  0 disk  
├─sda1           8:1    0     1G  0 part  
└─sda2           8:2    0 222,5G  0 part  
sdb              8:16   0 223,6G  0 disk  
├─sdb1           8:17   0     1G  0 part  
│ └─md126        9:126  0  1023M  0 raid1 /boot
└─sdb2           8:18   0 222,5G  0 part  
  └─md127        9:127  0 222,4G  0 raid1 
    ├─vg0-root 253:0    0 206,4G  0 lvm   /
    └─vg0-swap 253:1    0    16G  0 lvm   [SWAP]
sdc              8:32   0 931,5G  0 disk  
sdd              8:48   0 931,5G  0 disk  

Status vestit dimissis orbis.

[root@localhost ~]# cat /proc/mdstat 
Personalities : [raid1] 
md126 : active raid1 sdb1[1]
      1047552 blocks super 1.2 [2/1] [_U]
      bitmap: 0/1 pages [0KB], 65536KB chunk

md127 : active raid1 sdb2[1]
      233206784 blocks super 1.2 [2/1] [_U]
      bitmap: 1/2 pages [4KB], 65536KB chunk

unused devices: <none>

2. Effingo partitio mensa ad novum orbem

Tabulam partitionem in disco adhiberi potes cum mandato sequenti.

fdisk -l /dev/sdb | grep 'Disk label type'

MBR output for esset:

Disk label type: dos

ad GPT:

Disk label type: gpt

MBR pro tabula partitione exscribend testatem:

sfdisk -d /dev/sdb | sfdisk /dev/sdc

Hic dolor primus orbis significatur с quibus Markup exscriptus est: secundo - ubi effingo.

IUDICIUM: Pro GPT primus orbis significatur in quo copy markup; secundo orbis indicat orbis a quo copy markup. Si misceas orbes, initio bona partitio overscripta et destruenda erit.

Tabula layout de imitando GPT:

sgdisk -R /dev/sdс /dev/sdb

Deinde, disci UUID temere tribue (pro GPT).


sgdisk -G /dev/sdc

Post hoc mandatum est, partitiones in disco appareant /dev/sdc.

[root@localhost ~]# lsblk
NAME           MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda              8:0    0 223,6G  0 disk  
├─sda1           8:1    0     1G  0 part  
└─sda2           8:2    0 222,5G  0 part  
sdb              8:16   0 223,6G  0 disk  
├─sdb1           8:17   0     1G  0 part  
│ └─md126        9:126  0  1023M  0 raid1 /boot
└─sdb2           8:18   0 222,5G  0 part  
  └─md127        9:127  0 222,4G  0 raid1 
    ├─vg0-root 253:0    0 206,4G  0 lvm   /
    └─vg0-swap 253:1    0    16G  0 lvm   [SWAP]
sdc              8:32   0 931,5G  0 disk  
├─sdc1           8:33   0     1G  0 part  
└─sdc2           8:34   0 222,5G  0 part  
sdd              8:48   0 931,5G  0 disk  

Si, facto actione, partitiones in systematis orbis /dev/sdc indecisum, deinde mandatum, partitionem tabulae relegere.

sfdisk -R /dev/sdc

Si hodiernae orbis tabulae MBR utantur et informationes in orbes maiores quam 2 TB transferri debent, tunc in novis orbis partibus opus erit ut GPT partitionem manualem creare utens partitio biosboot. De hoc casu in Parte 2 huius articuli disseretur.

3. Addens parietes novi orbis ad ordinata

Addamus disci partitiones ad vestit respondentes.

mdadm /dev/md126 --add /dev/sdc1

mdadm /dev/md127 --add /dev/sdc2

Reprehendimus sectiones additas esse.

[root@localhost ~]# lsblk
NAME           MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda              8:0    0 223,6G  0 disk  
├─sda1           8:1    0     1G  0 part  
└─sda2           8:2    0 222,5G  0 part  
sdb              8:16   0 223,6G  0 disk  
├─sdb1           8:17   0     1G  0 part  
│ └─md126        9:126  0  1023M  0 raid1 /boot
└─sdb2           8:18   0 222,5G  0 part  
  └─md127        9:127  0 222,4G  0 raid1 
    ├─vg0-root 253:0    0 206,4G  0 lvm   /
    └─vg0-swap 253:1    0    16G  0 lvm   [SWAP]
sdc              8:32   0 931,5G  0 disk  
├─sdc1           8:33   0     1G  0 part  
│ └─md126        9:126  0  1023M  0 raid1 /boot
└─sdc2           8:34   0 222,5G  0 part  
  └─md127        9:127  0 222,4G  0 raid1 
    ├─vg0-root 253:0    0 206,4G  0 lvm   /
    └─vg0-swap 253:1    0    16G  0 lvm   [SWAP]
sdd              8:48   0 931,5G  0 disk  

Post hoc vestit synchronise exspectamus.

[root@localhost ~]# cat /proc/mdstat 
Personalities : [raid1] 
md126 : active raid1 sdc1[2] sdb1[1]
      1047552 blocks super 1.2 [2/2] [UU]
      bitmap: 0/1 pages [0KB], 65536KB chunk

md127 : active raid1 sdc2[2] sdb2[1]
      233206784 blocks super 1.2 [2/1] [_U]
      [==>..................]  recovery = 10.6% (24859136/233206784) finish=29.3min speed=118119K/sec
      bitmap: 2/2 pages [8KB], 65536KB chunk

unused devices: <none>

Continuos monere potes processus synchronisation utens utilitate watch.

watch -n 2 cat /proc/mdstat

parametri -n specificat, quibus intervallis in secundis intervallis pro- ceptum sisto exsecutioni mandandum sit.

Repetere vestigia 1 - 3 pro tunc postea reposito orbis.

Partitiones secundi orbis notamus quae in singulis malis sunt ordinata.

mdadm /dev/md126 --fail /dev/sdb1

mdadm /dev/md127 --fail /dev/sdb2

obstructionum parietes removere fabrica /dev/sdb de vestit.

mdadm /dev/md126 --remove /dev/sdb1

mdadm /dev/md127 --remove /dev/sdb2

Postquam orbis ex acie removimus, informationes fabricae truncus hoc modo spectabit.

[root@localhost ~]# lsblk
NAME           MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda              8:0    0 223,6G  0 disk  
├─sda1           8:1    0     1G  0 part  
└─sda2           8:2    0 222,5G  0 part  
sdb              8:16   0 223,6G  0 disk  
├─sdb1           8:17   0     1G  0 part  
└─sdb2           8:18   0 222,5G  0 part  
sdc              8:32   0 931,5G  0 disk  
├─sdc1           8:33   0     1G  0 part  
│ └─md126        9:126  0  1023M  0 raid1 /boot
└─sdc2           8:34   0 222,5G  0 part  
  └─md127        9:127  0 222,4G  0 raid1 
    ├─vg0-root 253:0    0 206,4G  0 lvm   /
    └─vg0-swap 253:1    0    16G  0 lvm   [SWAP]
sdd              8:48   0 931,5G  0 disk  

Status vestit dimissis orbis.

[root@localhost ~]# cat /proc/mdstat 
Personalities : [raid1] 
md126 : active raid1 sdc1[2]
      1047552 blocks super 1.2 [2/1] [U_]
      bitmap: 0/1 pages [0KB], 65536KB chunk

md127 : active raid1 sdc2[2]
      233206784 blocks super 1.2 [2/1] [U_]
      bitmap: 1/2 pages [4KB], 65536KB chunk

unused devices: <none>

MBR maceriæ solvens exscribend testatem orbis /dev/sdс ad disci /dev/sdd.

sfdisk -d /dev/sdс | sfdisk /dev/sdd

Post hoc mandatum est, partitiones in disco appareant /dev/sdd.

[root@localhost ~]# lsblk
NAME           MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda              8:0    0 223,6G  0 disk  
├─sda1           8:1    0     1G  0 part  
└─sda2           8:2    0 222,5G  0 part  
sdb              8:16   0 223,6G  0 disk  
├─sdb1           8:17   0     1G  0 part  
└─sdb2           8:18   0 222,5G  0 part  
sdc              8:32   0 931,5G  0 disk  
├─sdc1           8:33   0     1G  0 part  
│ └─md126        9:126  0  1023M  0 raid1 /boot
└─sdc2           8:34   0 222,5G  0 part  
  └─md127        9:127  0 222,4G  0 raid1 
    ├─vg0-root 253:0    0 206,4G  0 lvm   /
    └─vg0-swap 253:1    0    16G  0 lvm   [SWAP]
sdd              8:48   0 931,5G  0 disk  
├─sdd1           8:49   0     1G  0 part  
└─sdd2           8:50   0 222,5G  0 part  

Orbis partitiones ad addendo vestit.

mdadm /dev/md126 --add /dev/sdd1

mdadm /dev/md127 --add /dev/sdd2

Reprehendimus sectiones additas esse.

[root@localhost ~]# lsblk
NAME           MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda              8:0    0 223,6G  0 disk  
├─sda1           8:1    0     1G  0 part  
└─sda2           8:2    0 222,5G  0 part  
sdb              8:16   0 223,6G  0 disk  
├─sdb1           8:17   0     1G  0 part  
└─sdb2           8:18   0 222,5G  0 part  
sdc              8:32   0 931,5G  0 disk  
├─sdc1           8:33   0     1G  0 part  
│ └─md126        9:126  0  1023M  0 raid1 /boot
└─sdc2           8:34   0 222,5G  0 part  
  └─md127        9:127  0 222,4G  0 raid1 
    ├─vg0-root 253:0    0 206,4G  0 lvm   /
    └─vg0-swap 253:1    0    16G  0 lvm   [SWAP]
sdd              8:48   0 931,5G  0 disk  
├─sdd1           8:49   0     1G  0 part  
│ └─md126        9:126  0  1023M  0 raid1 /boot
└─sdd2           8:50   0 222,5G  0 part  
  └─md127        9:127  0 222,4G  0 raid1 
    ├─vg0-root 253:0    0 206,4G  0 lvm   /
    └─vg0-swap 253:1    0    16G  0 lvm   [SWAP]

Post hoc vestit synchronise exspectamus.

[root@localhost ~]# cat /proc/mdstat 
Personalities : [raid1] 
md126 : active raid1 sdd1[3] sdc1[2]
      1047552 blocks super 1.2 [2/2] [UU]
      bitmap: 0/1 pages [0KB], 65536KB chunk

md127 : active raid1 sdd2[3] sdc2[2]
      233206784 blocks super 1.2 [2/1] [U_]
      [>....................]  recovery =  0.5% (1200000/233206784) finish=35.4min speed=109090K/sec
      bitmap: 2/2 pages [8KB], 65536KB chunk

unused devices: <none>

5. VERMIS Installing in novis agitet

pro Cento:

grub2-install /dev/sdX

Pro Debian/Ubuntu:

grub-install /dev/sdX

quibus X — littera scandali fabrica. Hoc in casu, necesse est ut VERMIS inaugurari debeas /dev/sdc и /dev/sdd.

6. Tabellae extensio (ext4) radicis partitionis

De novis orbis /dev/sdc и /dev/sdd 931.5 GB available. Ob hoc quod tabulae partitionis e tabulis minoribus transcripta est, partitiones /dev/sdc2 и /dev/sdd2 222.5 GB available.

sdc              8:32   0 931,5G  0 disk  
├─sdc1           8:33   0     1G  0 part  
│ └─md126        9:126  0  1023M  0 raid1 /boot
└─sdc2           8:34   0 222,5G  0 part  
  └─md127        9:127  0 222,4G  0 raid1 
    ├─vg0-root 253:0    0 206,4G  0 lvm   /
    └─vg0-swap 253:1    0    16G  0 lvm   [SWAP]
sdd              8:48   0 931,5G  0 disk  
├─sdd1           8:49   0     1G  0 part  
│ └─md126        9:126  0  1023M  0 raid1 /boot
└─sdd2           8:50   0 222,5G  0 part  
  └─md127        9:127  0 222,4G  0 raid1 
    ├─vg0-root 253:0    0 206,4G  0 lvm   /
    └─vg0-swap 253:1    0    16G  0 lvm   [SWAP]

oportet;

  1. Praetende partitionem 2 in singulis orbium ;
  2. Dilata ordinata md127;
  3. Expand PV (volumen physicum);
  4. Expand LV (logo-volumen) vg0-radix;
  5. Dilata tabella ratio.

Uti ad utilitatem navigaremus abstracti Sit scriptor expand sectioni /dev/sdc2 ad maximi pretii. Mandatum parted /dev/sdc (I) ac videre current maceriæ solvens cum imperio p (2).

Minores orbis reposuit in Linux cum maioribus orbis

Ut videre potes, finis partitionis 2 finit 240 GB. Sit scriptor expand partitio cum imperio resizepart 2, ubi 2 est numerus sectionis (3). Valorem in forma digitali indicamus, exempli gratia 1000 GB, vel indicatione disco participes - 100%. Iterum refutamus partitionem novam magnitudinem habere (4).

Iterare supra gradus ad disci /dev/sdd. Post crescentem parietibus /dev/sdc2 и /dev/sdd2 factus est = 930.5 GB.

[root@localhost ~]# lsblk                                                 
NAME           MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda              8:0    0 223,6G  0 disk  
├─sda1           8:1    0     1G  0 part  
└─sda2           8:2    0 222,5G  0 part  
sdb              8:16   0 223,6G  0 disk  
├─sdb1           8:17   0     1G  0 part  
└─sdb2           8:18   0 222,5G  0 part  
sdc              8:32   0 931,5G  0 disk  
├─sdc1           8:33   0     1G  0 part  
│ └─md126        9:126  0  1023M  0 raid1 /boot
└─sdc2           8:34   0 930,5G  0 part  
  └─md127        9:127  0 222,4G  0 raid1 
    ├─vg0-root 253:0    0 206,4G  0 lvm   /
    └─vg0-swap 253:1    0    16G  0 lvm   [SWAP]
sdd              8:48   0 931,5G  0 disk  
├─sdd1           8:49   0     1G  0 part  
│ └─md126        9:126  0  1023M  0 raid1 /boot
└─sdd2           8:50   0 930,5G  0 part  
  └─md127        9:127  0 222,4G  0 raid1 
    ├─vg0-root 253:0    0 206,4G  0 lvm   /
    └─vg0-swap 253:1    0    16G  0 lvm   [SWAP]

Post hoc ampliamus aciem md127 ad maximum.

mdadm --grow /dev/md127 --size=max

Comprimamus ordinata dilatata. Nunc magnitudo eius facta 930.4 GB.

[root@localhost ~]# lsblk
NAME           MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda              8:0    0 223,6G  0 disk  
├─sda1           8:1    0     1G  0 part  
└─sda2           8:2    0 222,5G  0 part  
sdb              8:16   0 223,6G  0 disk  
├─sdb1           8:17   0     1G  0 part  
└─sdb2           8:18   0 222,5G  0 part  
sdc              8:32   0 931,5G  0 disk  
├─sdc1           8:33   0     1G  0 part  
│ └─md126        9:126  0  1023M  0 raid1 /boot
└─sdc2           8:34   0 930,5G  0 part  
  └─md127        9:127  0 930,4G  0 raid1 
    ├─vg0-root 253:0    0 206,4G  0 lvm   /
    └─vg0-swap 253:1    0    16G  0 lvm   [SWAP]
sdd              8:48   0 931,5G  0 disk  
├─sdd1           8:49   0     1G  0 part  
│ └─md126        9:126  0  1023M  0 raid1 /boot
└─sdd2           8:50   0 930,5G  0 part  
  └─md127        9:127  0 930,4G  0 raid1 
    ├─vg0-root 253:0    0 206,4G  0 lvm   /
    └─vg0-swap 253:1    0    16G  0 lvm   [SWAP]

Extendit extensio corporis volumine. Priusquam expandamus, statum hodiernam PV cohibeamus.

[root@localhost ~]# pvscan
  PV /dev/md127   VG vg0             lvm2 [222,40 GiB / 0    free]
  Total: 1 [222,40 GiB] / in use: 1 [222,40 GiB] / in no VG: 0 [0   ]

Ut videri potest, PV . /dev/md127 utitur 222.4 GB spatii.

Capitulum PV cum sequenti mandato.

pvresize /dev/md127

Reprehendo eventum expansionis PV.

[

root@localhost ~]# pvscan
  PV /dev/md127   VG vg0             lvm2 [930,38 GiB / 707,98 GiB free]
  Total: 1 [930,38 GiB] / in use: 1 [930,38 GiB] / in no VG: 0 [0   ]

Expanding logice volumen. Priusquam expandamus, praesentem statum LV cohibeamus (1).

[root@localhost ~]# lvscan
  ACTIVE            '/dev/vg0/swap' [<16,00 GiB] inherit
  ACTIVE            '/dev/vg0/root' [<206,41 GiB] inherit

LV /dev/vg0/root utitur 206.41 GR.

Volumus capitulum LV cum sequenti mandato (2).

lvextend -l +100%FREE /dev/mapper/vg0-root

Actionem peractam refutamus (3).

[root@localhost ~]# lvscan 
  ACTIVE            '/dev/vg0/swap' [<16,00 GiB] inherit
  ACTIVE            '/dev/vg0/root' [<914,39 GiB] inherit

Ut videre potes, crescente LV, moles orbis tractus occupati factus est 914.39 GB.

Minores orbis reposuit in Linux cum maioribus orbis

LV volumen auxit (4), sed tabella ratio adhuc 204 GB obtinet (5).

1. Dilatetur ratio tabellae.

resize2fs /dev/mapper/vg0-root

Postquam mandatum est exsecutum, magnitudinem ratio lima reprimimus.

[root@localhost ~]# df -h
Файловая система     Размер Использовано  Дост Использовано% Cмонтировано в
devtmpfs                32G            0   32G            0% /dev
tmpfs                   32G            0   32G            0% /dev/shm
tmpfs                   32G         9,5M   32G            1% /run
tmpfs                   32G            0   32G            0% /sys/fs/cgroup
/dev/mapper/vg0-root   900G         1,3G  860G            1% /
/dev/md126            1007M         120M  837M           13% /boot
tmpfs                  6,3G            0  6,3G            0% /run/user/0

Magnitudo systematis fasciculi radicis ad 900 GB augebitur. Peractis gradibus, orbis veteres tollere potes.

Causa II: Repositoque minor orbis cum maior disks (magis quam 2TB)

Exercitatio: Praesens repone cum orbis maioribus orbis (2 x 3TB) servatis informationibus. In hoc casu habemus 2 x 240 GB SSD (RAID-1) orbes cum systemate inaugurato et 2 x 3 TB SATA orbis ad quos ratio transferri debet. Discus currentis in mensa partitione MBR utuntur. Cum in novis orbis capacitatem maiorem quam 2 TB habeant, necesse erit ut tabula GPT utatur, cum MBR non possit cum orbiculis amplioribus quam 2 TB laborare.

Inspice orbis hodiernam extensionem.

[root@localhost ~]# lsblk
NAME           MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda              8:0    0 223,6G  0 disk  
├─sda1           8:1    0     1G  0 part  
│ └─md126        9:126  0  1023M  0 raid1 /boot
└─sda2           8:2    0 222,5G  0 part  
  └─md127        9:127  0 222,4G  0 raid1 
    ├─vg0-root 253:0    0 206,4G  0 lvm   /
    └─vg0-swap 253:1    0    16G  0 lvm   [SWAP]
sdb              8:16   0 223,6G  0 disk  
├─sdb1           8:17   0     1G  0 part  
│ └─md126        9:126  0  1023M  0 raid1 /boot
└─sdb2           8:18   0 222,5G  0 part  
  └─md127        9:127  0 222,4G  0 raid1 
    ├─vg0-root 253:0    0 206,4G  0 lvm   /
    └─vg0-swap 253:1    0    16G  0 lvm   [SWAP]
sdc              8:32   0   2,7T  0 disk  
sdd              8:48   0   2,7T  0 disk  

Sit scriptor reprehendo in mensa maceriæ solvens usus est in disco /dev/sda.

[root@localhost ~]# fdisk -l /dev/sda | grep 'Disk label type'
Disk label type: dos

In orbe /dev/sdb simili partitio mensae adhibetur. Sit scriptor reprehendo orbis tractus usus est in ratio.

[root@localhost ~]# df -h
Файловая система     Размер Использовано  Дост Использовано% Cмонтировано в
devtmpfs                16G            0   16G            0% /dev
tmpfs                   16G            0   16G            0% /dev/shm
tmpfs                   16G         9,5M   16G            1% /run
tmpfs                   16G            0   16G            0% /sys/fs/cgroup
/dev/mapper/vg0-root   204G         1,3G  192G            1% /
/dev/md126            1007M         120M  837M           13% /boot
tmpfs                  3,2G            0  3,2G            0% /run/user/0

Ut videre potes, radix tabellae ratio occupat 204 GB. Praesens reprimamus statum programmatis INCURSUS ordinata.

1. Installing GPT maceriæ solvens ac disci partitionibus

Sit in regione orbis layout reprehendo.

[root@localhost ~]# parted /dev/sda print
Модель: ATA KINGSTON SVP200S (scsi)
Диск /dev/sda: 240GB
Размер сектора (логич./физич.): 512B/512B
Таблица разделов: msdos
Disk Flags: 

Номер  Начало  Конец   Размер  Тип      Файловая система  Флаги
 1     1049kB  1076MB  1075MB  primary                    загрузочный, raid
 2     1076MB  240GB   239GB   primary                    raid

In novo orbe 3TB opus est creare 3 partitiones:

  1. sectioni bios_grub 2MiB magnitudo pro GPT BIOS convenientiae;
  2. Distinctio ordinata pro incursione inclusum erit /boot.
  3. Distinctio ad INCURSUS ordinata in qua erunt radix LV и LV PERMUTO.

Utilitatem installing navigaremus abstracti bigas yum install -y parted (for Centos); apt install -y parted (for Debian/Ubuntu).

using navigaremus abstracti Mandata sequentia curramus partiri orbis.

Mandatum parted /dev/sdc et vade ad disci layout emendandi modum.

GPT partitione mensa creare.

(parted) mktable gpt

Partum I sectionem bios_grub sectionem et vexillum pro eo.

(parted) mkpart primary 1MiB 3MiB
(parted) set 1 bios_grub on  

Partem 2 crea et vexillum pro ea pone. Partitio utendum est ut stipes pro incursione ordinata et inclusa /boot.

(parted) mkpart primary ext2 3MiB 1028MiB
(parted) set 2 boot on

Partem tertiam creamus, quae etiam utendum est ut impedimentum ordinatum in quo LVM collocabitur.

(parted) mkpart primary 1028MiB 100% 

Quo in casu, non est necesse vexillum ponere, sed si opus sit, cum sequenti mandato apponi potest.

(parted) set 3 raid on

Tabulam creatam refutamus.

(parted) p                                                                
Модель: ATA TOSHIBA DT01ACA3 (scsi)
Диск /dev/sdc: 3001GB
Размер сектора (логич./физич.): 512B/4096B
Таблица разделов: gpt
Disk Flags: 

Номер  Начало  Конец   Размер  Файловая система  Имя      Флаги
 1     1049kB  3146kB  2097kB                    primary  bios_grub
 2     3146kB  1077MB  1074MB                    primary  загрузочный
 3     1077MB  3001GB  3000GB                    primary

GUID novum discri temere assignamus.

sgdisk -G /dev/sdd

2. removere saepta primi orbis ex vestit

Reprehendo de statu ordinata

[root@localhost ~]# cat /proc/mdstat 
Personalities : [raid1] 
md126 : active raid1 sda1[0] sdb1[1]
      1047552 blocks super 1.2 [2/2] [UU]
      bitmap: 0/1 pages [0KB], 65536KB chunk

md127 : active raid1 sda2[0] sdb2[1]
      233206784 blocks super 1.2 [2/2] [UU]
      bitmap: 0/2 pages [0KB], 65536KB chunk

unused devices: <none>

Ratio utitur 2 vestit: md126 (mons punctum / tabernus) - constat /dev/sda1 и /dev/sdb1, md127 (LVM for swap et radix tabellae ratio) - constat ex /dev/sda2 и /dev/sdb2.

Partitiones primi orbis notamus quae in singulis malis sunt ordinata.

mdadm /dev/md126 --fail /dev/sda1

mdadm /dev/md127 --fail /dev/sda2

obstructionum parietes removere fabrica /dev/sda de vestit.

mdadm /dev/md126 --remove /dev/sda1

mdadm /dev/md127 --remove /dev/sda2

Reperiens statum ordinata sublato orbe.

[root@localhost ~]# cat /proc/mdstat 
Personalities : [raid1] 
md126 : active raid1 sdb1[1]
      1047552 blocks super 1.2 [2/1] [_U]
      bitmap: 0/1 pages [0KB], 65536KB chunk

md127 : active raid1 sdb2[1]
      233206784 blocks super 1.2 [2/1] [_U]
      bitmap: 2/2 pages [8KB], 65536KB chunk

unused devices: <none>

3. Addens parietes novi orbis ad ordinata

Proximus gradus est addere partitiones novi orbis ad vestes pro synchronisationi. Inspice statum hodiernam orbis layout.

[root@localhost ~]# lsblk
NAME           MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda              8:0    0 223,6G  0 disk  
├─sda1           8:1    0     1G  0 part  
└─sda2           8:2    0 222,5G  0 part  
sdb              8:16   0 223,6G  0 disk  
├─sdb1           8:17   0     1G  0 part  
│ └─md126        9:126  0  1023M  0 raid1 /boot
└─sdb2           8:18   0 222,5G  0 part  
  └─md127        9:127  0 222,4G  0 raid1 
    ├─vg0-root 253:0    0 206,4G  0 lvm   /
    └─vg0-swap 253:1    0    16G  0 lvm   [SWAP]
sdc              8:32   0   2,7T  0 disk  
├─sdc1           8:33   0     2M  0 part  
├─sdc2           8:34   0     1G  0 part  
└─sdc3           8:35   0   2,7T  0 part  
sdd              8:48   0   2,7T  0 disk  

sectioni /dev/sdc1 Est bios_grub sectionem et non implicatum in creatione vestit. Vestit modo uti /dev/sdc2 и /dev/sdc3. Has sectiones addimus in vestimentis respondentibus.

mdadm /dev/md126 --add /dev/sdc2

mdadm /dev/md127 --add /dev/sdc3

Tunc expectamus synchronise ordinata.

[root@localhost ~]# cat /proc/mdstat 
Personalities : [raid1] 
md126 : active raid1 sdc2[2] sdb1[1]
      1047552 blocks super 1.2 [2/2] [UU]
      bitmap: 0/1 pages [0KB], 65536KB chunk

md127 : active raid1 sdc3[2] sdb2[1]
      233206784 blocks super 1.2 [2/1] [_U]
      [>....................]  recovery =  0.2% (619904/233206784) finish=31.2min speed=123980K/sec
      bitmap: 2/2 pages [8KB], 65536KB chunk
unused devices: <none>

Discus partitionibus additis partitionibus ad aciem.

[root@localhost ~]# lsblk
NAME           MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda              8:0    0 223,6G  0 disk  
├─sda1           8:1    0     1G  0 part  
└─sda2           8:2    0 222,5G  0 part  
sdb              8:16   0 223,6G  0 disk  
├─sdb1           8:17   0     1G  0 part  
│ └─md126        9:126  0  1023M  0 raid1 /boot
└─sdb2           8:18   0 222,5G  0 part  
  └─md127        9:127  0 222,4G  0 raid1 
    ├─vg0-root 253:0    0 206,4G  0 lvm   /
    └─vg0-swap 253:1    0    16G  0 lvm   [SWAP]
sdc              8:32   0   2,7T  0 disk  
├─sdc1           8:33   0     2M  0 part  
├─sdc2           8:34   0     1G  0 part  
│ └─md126        9:126  0  1023M  0 raid1 /boot
└─sdc3           8:35   0   2,7T  0 part  
  └─md127        9:127  0 222,4G  0 raid1 
    ├─vg0-root 253:0    0 206,4G  0 lvm   /
    └─vg0-swap 253:1    0    16G  0 lvm   [SWAP]
sdd              8:48   0   2,7T  0 disk  

4. removere parietes secundi orbis ex vestit

Partitiones secundi orbis notamus quae in singulis malis sunt ordinata.

mdadm /dev/md126 --fail /dev/sdb1

mdadm /dev/md127 --fail /dev/sdb2

obstructionum parietes removere fabrica /dev/sda de vestit.

mdadm /dev/md126 --remove /dev/sdb1

mdadm /dev/md127 --remove /dev/sdb2

5. Effingo GPT layout mensam et synchronize ordinata

Ad tabulam GPT markup effingo utemur utilitate sgdisk, quae in sarcina inclusa est ad operandum cum partitionibus disci et tabula GPT - gdisk.

occasum gdisk pro Cento;

yum install -y gdisk

occasum gdisk Debian / Ubuntu:

apt install -y gdisk

IUDICIUM: Pro GPT primus orbis significatur in quo markup effingo; secundo orbis indicat orbis a quo markup effingo. Si misceas orbes, initio bona partitio overscripta et destruenda erit.

GPT markup effingo mensam.

sgdisk -R /dev/sdd /dev/sdc

Orbis mensam partitionibus translatis ad disci /dev/sdd.

[root@localhost ~]# lsblk
NAME           MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda              8:0    0 223,6G  0 disk  
├─sda1           8:1    0     1G  0 part  
└─sda2           8:2    0 222,5G  0 part  
sdb              8:16   0 223,6G  0 disk  
├─sdb1           8:17   0     1G  0 part  
└─sdb2           8:18   0 222,5G  0 part  
sdc              8:32   0   2,7T  0 disk  
├─sdc1           8:33   0     2M  0 part  
├─sdc2           8:34   0     1G  0 part  
│ └─md126        9:126  0  1023M  0 raid1 /boot
└─sdc3           8:35   0   2,7T  0 part  
  └─md127        9:127  0 222,4G  0 raid1 
    ├─vg0-root 253:0    0 206,4G  0 lvm   /
    └─vg0-swap 253:1    0    16G  0 lvm   [SWAP]
sdd              8:48   0   2,7T  0 disk  
├─sdd1           8:49   0     2M  0 part  
├─sdd2           8:50   0     1G  0 part  
└─sdd3           8:51   0   2,7T  0 part  

Deinde addimus singulas partitiones quae programmatis INCURSUS vestit.

mdadm /dev/md126 --add /dev/sdd2

mdadm /dev/md127 --add /dev/sdd3

Exspectamus ordinata synchronise.

[root@localhost ~]# cat /proc/mdstat 
Personalities : [raid1] 
md126 : active raid1 sdd2[3] sdc2[2]
      1047552 blocks super 1.2 [2/2] [UU]
      bitmap: 1/1 pages [4KB], 65536KB chunk

md127 : active raid1 sdd3[3] sdc3[2]
      233206784 blocks super 1.2 [2/1] [U_]
      [>....................]  recovery =  0.0% (148224/233206784) finish=26.2min speed=148224K/sec
      bitmap: 2/2 pages [8KB], 65536KB chunk
unused devices: <none>

Post partitionem GPT ad alterum orbis novi describendum, partitio hoc modo spectabit.

[root@localhost ~]# lsblk
NAME           MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda              8:0    0 223,6G  0 disk  
├─sda1           8:1    0     1G  0 part  
└─sda2           8:2    0 222,5G  0 part  
sdb              8:16   0 223,6G  0 disk  
├─sdb1           8:17   0     1G  0 part  
└─sdb2           8:18   0 222,5G  0 part  
sdc              8:32   0   2,7T  0 disk  
├─sdc1           8:33   0     2M  0 part  
├─sdc2           8:34   0     1G  0 part  
│ └─md126        9:126  0  1023M  0 raid1 /boot
└─sdc3           8:35   0   2,7T  0 part  
  └─md127        9:127  0 222,4G  0 raid1 
    ├─vg0-root 253:0    0 206,4G  0 lvm   /
    └─vg0-swap 253:1    0    16G  0 lvm   [SWAP]
sdd              8:48   0   2,7T  0 disk  
├─sdd1           8:49   0     2M  0 part  
├─sdd2           8:50   0     1G  0 part  
│ └─md126        9:126  0  1023M  0 raid1 /boot
└─sdd3           8:51   0   2,7T  0 part  
  └─md127        9:127  0 222,4G  0 raid1 
    ├─vg0-root 253:0    0 206,4G  0 lvm   /
    └─vg0-swap 253:1    0    16G  0 lvm   [SWAP]

Deinde, GRUB in novo orbes institue.

CentOS instruitur:

grub2-install /dev/sdX

Installation for Debian/Ubuntu:

grub-install /dev/sdX

quibus X - litteras coegi, in casu nostro agitet /dev/sdc и /dev/sdd.

Notitia de update ordinata sumus.

pro Cento:

mdadm --detail --scan --verbose > /etc/mdadm.conf

Pro Debian/Ubuntu:

echo "DEVICE partitions" > /etc/mdadm/mdadm.conf

mdadm --detail --scan --verbose | awk '/ARRAY/ {print}' >> /etc/mdadm/mdadm.conf

Adaequationis imaginem initrd:
pro Cento:

dracut -f -v --regenerate-all

Pro Debian/Ubuntu:

update-initramfs -u -k all

VERMIS configurationem renovamus.

pro Cento:

grub2-mkconfig -o /boot/grub2/grub.cfg

Pro Debian/Ubuntu:

update-grub

Expletis gradibus, orbis veteris removeri possunt.

6. Tabellae extensio (ext4) radicis partitionis

Orbis partitionis ante fasciculi systematis expansionem post migrationem systematis ad 2 x 3TB orbis (RAID-1).

[root@localhost ~]# lsblk
NAME           MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda              8:0    0 223,6G  0 disk  
sdb              8:16   0 223,6G  0 disk  
sdc              8:32   0   2,7T  0 disk  
├─sdc1           8:33   0     2M  0 part  
├─sdc2           8:34   0     1G  0 part  
│ └─md127        9:127  0  1023M  0 raid1 /boot
└─sdc3           8:35   0   2,7T  0 part  
  └─md126        9:126  0 222,4G  0 raid1 
    ├─vg0-root 253:0    0 206,4G  0 lvm   /
    └─vg0-swap 253:1    0    16G  0 lvm   [SWAP]
sdd              8:48   0   2,7T  0 disk  
├─sdd1           8:49   0     2M  0 part  
├─sdd2           8:50   0     1G  0 part  
│ └─md127        9:127  0  1023M  0 raid1 /boot
└─sdd3           8:51   0   2,7T  0 part  
  └─md126        9:126  0 222,4G  0 raid1 
    ├─vg0-root 253:0    0 206,4G  0 lvm   /
    └─vg0-swap 253:1    0    16G  0 lvm   [SWAP]

Nunc sectiones /dev/sdc3 и /dev/sdd3 occupant 2.7 TB. Cum novum orbis extensionem cum mensa GPT creavimus, partitionis magnitudo 3 statim ad spatium orbis maxime possibilis destinatum est, hoc in casu, partitionem ampliare non oportet.

oportet;

  1. Dilata ordinata md126;
  2. Expand PV (volumen physicum);
  3. Expand LV (logo-volumen) vg0-radix;
  4. Dilata tabella ratio.

1. Dilata ordinata md126 ad maximum.

mdadm --grow /dev/md126 --size=max

Post expansion ordinata md126 amplitudo spatii occupati crevit usque ad 2.7 TB.

[root@localhost ~]# lsblk
NAME           MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda              8:0    0 223,6G  0 disk  
sdb              8:16   0 223,6G  0 disk  
sdc              8:32   0   2,7T  0 disk  
├─sdc1           8:33   0     2M  0 part  
├─sdc2           8:34   0     1G  0 part  
│ └─md127        9:127  0  1023M  0 raid1 /boot
└─sdc3           8:35   0   2,7T  0 part  
  └─md126        9:126  0   2,7T  0 raid1 
    ├─vg0-root 253:0    0 206,4G  0 lvm   /
    └─vg0-swap 253:1    0    16G  0 lvm   [SWAP]
sdd              8:48   0   2,7T  0 disk  
├─sdd1           8:49   0     2M  0 part  
├─sdd2           8:50   0     1G  0 part  
│ └─md127        9:127  0  1023M  0 raid1 /boot
└─sdd3           8:51   0   2,7T  0 part  
  └─md126        9:126  0   2,7T  0 raid1 
    ├─vg0-root 253:0    0 206,4G  0 lvm   /
    └─vg0-swap 253:1    0    16G  0 lvm   [SWAP]

Expanding corporis volumine.

Priusquam dilatare, siste praesentem valorem spatii occupati PV /dev/md126.

[root@localhost ~]# pvs
  PV         VG  Fmt  Attr PSize   PFree
  /dev/md126 vg0 lvm2 a--  222,40g    0 

Capitulum PV cum sequenti mandato.

pvresize /dev/md126

Cohibemus peractam actionem.

[root@localhost ~]# pvs
  PV         VG  Fmt  Attr PSize  PFree
  /dev/md126 vg0 lvm2 a--  <2,73t 2,51t

Expanding logicum volumen vg0-radix.

Dilatato PV, stringamus spatium occupatum VG.

[root@localhost ~]# vgs
  VG  #PV #LV #SN Attr   VSize  VFree
  vg0   1   2   0 wz--n- <2,73t 2,51t

Inhibeamus spatium occupatum LV.

[root@localhost ~]# lvs
  LV   VG  Attr       LSize    Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root vg0 -wi-ao---- <206,41g                                                    
  swap vg0 -wi-ao----  <16,00g            

In vg0-radix volumen occupat 206.41 GB.

Expandamus LV ad spatium orbis maximum.

lvextend -l +100%FREE /dev/mapper/vg0-root 

Reperiens LV spatium post expansionem.

[root@localhost ~]# lvs
  LV   VG  Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root vg0 -wi-ao----   2,71t                                                    
  swap vg0 -wi-ao---- <16,00g

Expandi ratio tabellae (ext4).

Praesens magnitudo tabella ratio reprehendo.

[root@localhost ~]# df -h
Файловая система     Размер Использовано  Дост Использовано% Cмонтировано в
devtmpfs                16G            0   16G            0% /dev
tmpfs                   16G            0   16G            0% /dev/shm
tmpfs                   16G         9,6M   16G            1% /run
tmpfs                   16G            0   16G            0% /sys/fs/cgroup
/dev/mapper/vg0-root   204G         1,4G  192G            1% /
/dev/md127            1007M         141M  816M           15% /boot
tmpfs                  3,2G            0  3,2G            0% /run/user/0

Volumen /dev/mapper/vg0-radix 204 GB post LV expansionem obtinet.

Expandi ratio tabellae.

resize2fs /dev/mapper/vg0-root 

Reperiens ratio limae magnitudinem dilatavit.

[root@localhost ~]# df -h
Файловая система     Размер Использовано  Дост Использовано% Cмонтировано в
devtmpfs                16G            0   16G            0% /dev
tmpfs                   16G            0   16G            0% /dev/shm
tmpfs                   16G         9,6M   16G            1% /run
tmpfs                   16G            0   16G            0% /sys/fs/cgroup
/dev/mapper/vg0-root   2,7T         1,4G  2,6T            1% /
/dev/md127            1007M         141M  816M           15% /boot
tmpfs                  3,2G            0  3,2G            0% /run/user/0

Magnitudo systematis fasciculi aucta est ad totum volumen operiendum.

Source: www.habr.com

Add a comment