Debian filesystem expand
Zvydenie kapaciy disku debian (ext4)
Info disku:
# df -h .
Filesystem Size Used Avail Use% Mounted on
/dev/xvda1 7.8G 642M 6.8G 9% /
Disk bol rozsireny na 20GB:
# fdisk -l
Disk /dev/xvda: 20 GiB, 21474836480 bytes, 41943040 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xd7f2e0e8
Device Boot Start End Sectors Size Id Type
/dev/xvda1 * 4096 16773119 16769024 8G 83 Linux
Dsik je pozuivany ako root nieje ho mozne odpojit:
# umount /
umount: /: target is busy.
(In some cases useful info about processes that use
the device is found by lsof(8) or fuser(1))
Zmazanie a vytvorenie novej particie:
# fdisk /dev/xvda
Welcome to fdisk (util-linux 2.25.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): p
Disk /dev/xvda: 20 GiB, 21474836480 bytes, 41943040 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xd7f2e0e8
Device Boot Start End Sectors Size Id Type
/dev/xvda1 * 4096 16773119 16769024 8G 83 Linux
Zmazanie:
Command (m for help): d
Selected partition 1
Partition 1 has been deleted.
Vytvorenie:
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):
First sector (2048-41943039, default 2048): 4096
Last sector, +sectors or +size{K,M,G,T,P} (4096-41943039, default 41943039):
Created a new partition 1 of type 'Linux' and of size 20 GiB.
Command (m for help): a
Selected partition 1
The bootable flag on partition 1 is enabled now.
Command (m for help): p
Disk /dev/xvda: 20 GiB, 21474836480 bytes, 41943040 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xd7f2e0e8
Device Boot Start End Sectors Size Id Type
/dev/xvda1 * 4096 41943039 41938944 20G 83 Linux
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Re-reading the partition table failed.: Device or resource busy
The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8).
Vynutenie FSCK po reboote:
nano /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="quiet fsck.mode=force"
Update grub
update-grub
Rozsirenie particie:
resize2fs /dev/xvda1