Você está usando uma versão antiga do e2fsprogs.
Por favor, atualize, houve bazzilion de correções desde 1.41.12 (17-maio-2010)
Um sistema de arquivos ext2 pode ser redimensionado - desde que o dispositivo de bloco subjacente possa ser redimensionado - mas não ONLINE.
No entanto, como outra publicação minha mostrou, se o sistema de arquivos ext2
estiver montado como ext4
, então resize2fs
não dê uma mensagem de erro.
Informação do sistema:
Red Hat Enterprise Linux Server release 6.4 (Santiago)
e2fsprogs-1.41.12-14.el6_4.2.x86_64
Recriar (exemplo com um dispositivo de bloco LVM ("disco"):
Crie um dispositivo de bloco e um sistema de arquivos ext2 (padrão para mke2fs no RedHat 6)
[root@myServer ~]# lvcreate -L 8M -n test3 vg_myServer
Logical volume "test3" created
[root@myServer ~]# mke2fs /dev/mapper/vg_myServer-test3
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
Stride=4 blocks, Stripe width=0 blocks
2048 inodes, 8192 blocks
409 blocks (4.99%) reserved for the super user
First data block=1
Maximum filesystem blocks=8388608
1 block group
8192 blocks per group, 8192 fragments per group
2048 inodes per group
Writing inode tables: done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 38 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
# verify by checking the block ID
[root@myServer ~]# blkid /dev/mapper/vg_myServer-test3 | grep ext
/dev/mapper/vg_myServer-test3: UUID="97a46d2c-e157-46ec-a942-2df0d07eb39f" TYPE="ext2"
Monte o sistema de arquivos
# Create a mount point and mount the file system
[root@myServer ~]# mkdir -p /mnt/test3
[root@myServer ~]# mount -t ext4 /dev/mapper/vg_myServer-test3 /mnt/test3/
# See that mount percieves the filesystem as "ext4"
[root@myServer ~]# mount | grep test3
/dev/mapper/vg_myServer-test3 on /mnt/test3 type ext4 (rw)
Encha o sistema de arquivos até a capacidade
[root@myServer ~]# dd if=/dev/zero of=/mnt/test3/largefile bs=1024 count=8000
dd: writing '/mnt/test3/largefile': No space left on device
7849+0 records in
7848+0 records out
8036352 bytes (8.0 MB) copied, 2.22541 s, 3.6 MB/s
# Verify
[root@myServer ~]# df -P /dev/mapper/vg_myServer-test3
Filesystem 1024-blocks Used Available Capacity Mounted on
/dev/mapper/vg_myServer-test3 7931 7926 0 100% /mnt/test3
Estenda o dispositivo de bloco / LVM e redimensione
[root@myServer ~]# lvextend -L +8M /dev/mapper/vg_myServer-test3
Extending logical volume test3 to 16.00 MiB
Logical volume test3 successfully resized
# Perform a resize, _without_ umount
[root@myServer ~]# resize2fs /dev/mapper/vg_myServer-test3
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/mapper/vg_myServer-test3 is mounted on /mnt/test3; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 1
Performing an on-line resize of /dev/mapper/vg_myServer-test3 to 16384 (1k) blocks.
The filesystem on /dev/mapper/vg_myServer-test3 is now 16384 blocks long.
Verifique - o sistema de arquivos acha que o sistema de arquivos está estendido
[root@myServer ~]# df /dev/mapper/vg_myServer-test3
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/vg_myServer-test3 15863 7957 7089 53% /mnt/test3
Crie um segundo arquivo "grande"
[root@myServer ~]# dd if=/dev/zero of=/mnt/test3/largefile2 bs=1024 count=8000
dd: writing '/mnt/test3/largefile2': No space left on device
5230+0 records in
5229+0 records out
5354496 bytes (5.4 MB) copied, 0.280078 s, 19.1 MB/s
# Verify that the OS sees the FS as 88% full - but unable to write any more
[root@myServer ~]# df -P /dev/mapper/vg_myServer-test3
Filesystem 1024-blocks Used Available Capacity Mounted on
/dev/mapper/vg_myServer-test3 15863 13227 1819 88% /mnt/test3
umount / mount e faz um fsck no sistema de arquivos
[root@myServer ~]# umount /dev/mapper/vg_myServer-test3
[root@myServer ~]# mount -t ext4 /dev/mapper/vg_myServer-test3 /mnt/test3/
# FS suddenly has less usage...
[root@myServer ~]# df -P /dev/mapper/vg_myServer-test3
Filesystem 1024-blocks Used Available Capacity Mounted on
/dev/mapper/vg_myServer-test3 15863 7963 7083 53% /mnt/test3
# Perfor an fsck after an umount, then mount again
[root@myServer ~]# umount /dev/mapper/vg_myServer-test3
[root@myServer ~]# e2fsck -f /dev/mapper/vg_myServer-test3
e2fsck 1.41.12 (17-May-2010)
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
/dev/mapper/vg_myServer-test3: 13/4096 files (15.4% non-contiguous), 8484/16384 blocks
[root@myServer ~]# mount -t ext4 /dev/mapper/vg_myServer-test3 /mnt/test3/
Qual o tamanho que temos agora?
# Same as before the fsck
[root@myServer ~]# df -P /dev/mapper/vg_myServer-test3
Filesystem 1024-blocks Used Available Capacity Mounted on
/dev/mapper/vg_myServer-test3 15863 7963 7083 53% /mnt/test3
# A bit strange, the 8MB file and an 5MB file...?
[root@myServer ~]# ls -ld /mnt/test3/large*
-rw-r--r--. 1 root root 8036352 Jun 18 09:54 /mnt/test3/largefile
-rw-r--r--. 1 root root 5354496 Jun 18 09:55 /mnt/test3/largefile2
Tente criar um segundo arquivo grande
# Fill up again
[root@myServer ~]# dd if=/dev/zero of=/mnt/test3/largefile2 bs=1024 count=8000
dd: writing '/mnt/test3/largefile2': No space left on device
7870+0 records in
7869+0 records out
8057856 bytes (8.1 MB) copied, 2.43879 s, 3.3 MB/s
# "largefile2" has increased in size - OK
[root@myServer ~]# ls -ld /mnt/test3/large*
-rw-r--r--. 1 root root 8036352 Jun 18 09:54 /mnt/test3/largefile
-rw-r--r--. 1 root root 8057856 Jun 18 10:12 /mnt/test3/largefile2
# We are again at capacity
[root@myServer ~]# df -P /dev/mapper/vg_myServer-test3
Filesystem 1024-blocks Used Available Capacity Mounted on
/dev/mapper/vg_myServer-test3 15863 15858 0 100% /mnt/test3
E o FS é (é claro) ainda um sistema de arquivos ext2
# Still an "ext2" filesystem
[root@myServer ~]# blkid /dev/mapper/vg_myServer-test3
/dev/mapper/vg_myServer-test3: UUID="97a46d2c-e157-46ec-a942-2df0d07eb39f" TYPE="ext2"
# But mounted as "ext4"
[root@myServer ~]# mount | grep /dev/mapper/vg_myServer-test3
/dev/mapper/vg_myServer-test3 on /mnt/test3 type ext4 (rw)
Se o sistema de arquivos estiver montado como ext2
, você receberá uma mensagem de erro (corretamente) ao tentar redimensionar
[root@myServer ~]# umount /dev/mapper/vg_myServer-test3
[root@myServer ~]# mount -t ext2 /dev/mapper/vg_myServer-test3 /mnt/test3/
[root@myServer ~]# lvextend -L +8M /dev/mapper/vg_myServer-test3
Extending logical volume test3 to 24.00 MiB
Logical volume test3 successfully resized
[root@myServer ~]# resize2fs /dev/mapper/vg_myServer-test3
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/mapper/vg_myServer-test3 is mounted on /mnt/test3; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 1
resize2fs: Kernel does not support online resizing
Eu sei que o driver do sistema de arquivos ext4
pode montar o ext2 - o que é bom se você estiver em um sistema sem o driver ext2
.
Pergunta: Este é um bug ou um recurso - significando que resize2fs não apresenta uma mensagem de erro?
Em caso afirmativo, é em resize2fs
?
Você está usando uma versão antiga do e2fsprogs.
Por favor, atualize, houve bazzilion de correções desde 1.41.12 (17-maio-2010)
Tags ext4 filesystems ext2