Partition Resize: различия между версиями
Материал из noname.com.ua
Перейти к навигацииПерейти к поискуSirmax (обсуждение | вклад) |
Sirmax (обсуждение | вклад) |
||
Строка 58: | Строка 58: | ||
=Уменьшить размер партиции= |
=Уменьшить размер партиции= |
||
<PRE> |
<PRE> |
||
+ | tune2fs -l /dev/sdb2 |
||
− | |||
+ | tune2fs 1.46.5 (30-Dec-2021) |
||
+ | Filesystem volume name: <none> |
||
+ | Last mounted on: / |
||
+ | Filesystem UUID: bfc54566-94ff-418d-96f6-2231e8114932 |
||
+ | Filesystem magic number: 0xEF53 |
||
+ | Filesystem revision #: 1 (dynamic) |
||
+ | Filesystem features: has_journal ext_attr resize_inode dir_index filetype needs_recovery extent 64bit flex_bg sparse_super large_file huge_file dir_nlink extra_isize metadata_csum |
||
+ | Filesystem flags: signed_directory_hash |
||
+ | Default mount options: user_xattr acl |
||
+ | Filesystem state: clean |
||
+ | Errors behavior: Continue |
||
+ | Filesystem OS type: Linux |
||
+ | Inode count: 5242880 |
||
+ | Block count: 20971520 |
||
+ | Reserved block count: 1048575 |
||
+ | Free blocks: 18472633 |
||
+ | Free inodes: 5159683 |
||
+ | First block: 0 |
||
+ | Block size: 4096 |
||
+ | Fragment size: 4096 |
||
+ | Group descriptor size: 64 |
||
+ | Reserved GDT blocks: 1024 |
||
+ | Blocks per group: 32768 |
||
+ | Fragments per group: 32768 |
||
+ | Inodes per group: 8192 |
||
+ | Inode blocks per group: 512 |
||
+ | Flex block group size: 16 |
||
+ | Filesystem created: Mon Dec 25 14:29:52 2023 |
||
+ | Last mount time: Fri Dec 29 12:12:41 2023 |
||
+ | Last write time: Fri Dec 29 12:12:41 2023 |
||
+ | Mount count: 1 |
||
+ | Maximum mount count: -1 |
||
+ | Last checked: Fri Dec 29 12:10:35 2023 |
||
+ | Check interval: 0 (<none>) |
||
+ | Lifetime writes: 12 GB |
||
+ | Reserved blocks uid: 0 (user root) |
||
+ | Reserved blocks gid: 0 (group root) |
||
+ | First inode: 11 |
||
+ | Inode size: 256 |
||
+ | Required extra isize: 32 |
||
+ | Desired extra isize: 32 |
||
+ | Journal inode: 8 |
||
+ | Default directory hash: half_md4 |
||
+ | Directory Hash Seed: e8656586-b6c5-483d-baa2-b38231103618 |
||
+ | Journal backup: inode blocks |
||
+ | Checksum type: crc32c |
||
+ | Checksum: 0xbac09600 |
||
</PRE> |
</PRE> |
||
+ | |||
+ | |||
+ | |||
+ | |||
<PRE> |
<PRE> |
||
</PRE> |
</PRE> |
||
+ | |||
+ | |||
+ | |||
+ | |||
<PRE> |
<PRE> |
||
Версия 14:23, 29 декабря 2023
Как склонировать диск большего размера на меньший
Нужно скопировать систему целиком на меньший диск (на том диске с которого производится копирование есть свободное место)
Уменьшить размер файловой системы
Первым делом при необходимости отмонтировать ФС, затем принудительно проверить:
e2fsck -f /dev/sdb2 e2fsck 1.46.5 (30-Dec-2021) Superblock needs_recovery flag is clear, but journal has data. Run journal anyway<y>? yes /dev/sdb2: recovering journal Pass 1: Checking inodes, blocks, and sizes Pass 2: Checking directory structure Pass 3: Checking directory connectivity Pass 4: Checking reference counts Pass 5: Checking group summary information Free blocks count wrong (58146063, counted=58145530). Fix<y>? yes Free inodes count wrong (15244150, counted=15244035). Fix<y>? yes /dev/sdb2: ***** FILE SYSTEM WAS MODIFIED ***** /dev/sdb2: 83197/15327232 files (0.2% non-contiguous), 3132934/61278464 blocks
Новый размер ФС - можно указывать в разных единицах
- S - 512 byte sectors
- K - kilobytes
- M - megabytes
- G - gigabytes
# resize2fs /dev/sdb2 80G resize2fs 1.46.5 (30-Dec-2021) Resizing the filesystem on /dev/sdb2 to 20971520 (4k) blocks. The filesystem on /dev/sdb2 is now 20971520 (4k) blocks long.
Проверить результат: Подмонтировать
mount /dev/sdb2 /mnt/
df -h . Filesystem Size Used Avail Use% Mounted on /dev/sdb2 78G 7.3G 67G 10% /mnt
и проверить полученный размер
Уменьшить размер партиции
tune2fs -l /dev/sdb2 tune2fs 1.46.5 (30-Dec-2021) Filesystem volume name: <none> Last mounted on: / Filesystem UUID: bfc54566-94ff-418d-96f6-2231e8114932 Filesystem magic number: 0xEF53 Filesystem revision #: 1 (dynamic) Filesystem features: has_journal ext_attr resize_inode dir_index filetype needs_recovery extent 64bit flex_bg sparse_super large_file huge_file dir_nlink extra_isize metadata_csum Filesystem flags: signed_directory_hash Default mount options: user_xattr acl Filesystem state: clean Errors behavior: Continue Filesystem OS type: Linux Inode count: 5242880 Block count: 20971520 Reserved block count: 1048575 Free blocks: 18472633 Free inodes: 5159683 First block: 0 Block size: 4096 Fragment size: 4096 Group descriptor size: 64 Reserved GDT blocks: 1024 Blocks per group: 32768 Fragments per group: 32768 Inodes per group: 8192 Inode blocks per group: 512 Flex block group size: 16 Filesystem created: Mon Dec 25 14:29:52 2023 Last mount time: Fri Dec 29 12:12:41 2023 Last write time: Fri Dec 29 12:12:41 2023 Mount count: 1 Maximum mount count: -1 Last checked: Fri Dec 29 12:10:35 2023 Check interval: 0 (<none>) Lifetime writes: 12 GB Reserved blocks uid: 0 (user root) Reserved blocks gid: 0 (group root) First inode: 11 Inode size: 256 Required extra isize: 32 Desired extra isize: 32 Journal inode: 8 Default directory hash: half_md4 Directory Hash Seed: e8656586-b6c5-483d-baa2-b38231103618 Journal backup: inode blocks Checksum type: crc32c Checksum: 0xbac09600