Linux lessons 6 (разбиение жесткого диска)

fdisk -l покажет существующие диски
fdisk /dev/sdb выбираем диск

Command (m for help): m

Help:

DOS (MBR)
a toggle a bootable flag
b edit nested BSD disklabel
c toggle the dos compatibility flag

Generic
d delete a partition
F list free unpartitioned space
l list known partition types
n add a new partition
p print the partition table
t change a partition type
v verify the partition table
i print information about a partition

Misc
m print this menu
u change display/entry units
x extra functionality (experts only)

Script
I load disk layout from sfdisk script file
O dump disk layout to sfdisk script file

Save & Exit
w write table to disk and exit
q quit without saving changes

Create a new label
g create a new empty GPT partition table
G create a new empty SGI (IRIX) partition table
o create a new empty DOS partition table
s create a new empty Sun partition table

Размечаем диск

Command (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-21810379, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-21810379, default 21810379): +2GB

Created a new partition 1 of type ‘Linux’ and of size 1.9 GiB.

Command (m for help): n
Partition type
p primary (1 primary, 0 extended, 3 free)
e extended (container for logical partitions)
Select (default p): e
Partition number (2-4, default 2): 2
First sector (3907584-21810379, default 3907584):
Last sector, +sectors or +size{K,M,G,T,P} (3907584-21810379, default 21810379): +4GB

Created a new partition 2 of type ‘Extended’ and of size 3.7 GiB.

Command (m for help): n
Partition type
p primary (1 primary, 1 extended, 2 free)
l logical (numbered from 5)
Select (default p):

Using default response p.
Partition number (3,4, default 3): 3
First sector (11720704-21810379, default 11720704):
Last sector, +sectors or +size{K,M,G,T,P} (11720704-21810379, default 21810379):

Created a new partition 3 of type ‘Linux’ and of size 4.8 GiB.

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

fdisk -l

mkfs.ext4 /dev/sdb3 форматирование раздела

swapon -s просмотор текущего раздела подкачки
cat /etc/fstab постоянные точки монтирования

mkdir mounted
mount /dev/sdb3 /mounted
монтируем диск

pvdisplay
vgdisplay
lvdisplay

Удаляем все разделы и создаем занова два новых

pvcreate /dev/sdb1 создаем физические волумы
pvcreate /dev/sdb2

vgcreate vg_andrey /dev/sdb1 /dev/sdb2 создаем группу

lvcreate -n lv1 -L 2G vg_andrey создаем группу логических томов
lvcreate -n lv2 -L 3G vg_andrey

mkfs.ext4 /dev/vg_andrey/lv1 Форматируем

mkfs.ext4 /dev/vg_andrey/lv2 Форматируем