centos 파일시스템 생성시 inode 수 늘리기

centos 파일시스템 생성시 inode 수 늘리기
Linux 시스템을 사용하다 보면, 파일갯수 초과로 인해 여유 디스크 공간을 사용하지 못하는 경우가 있다.
이러한 시스템은 최초 생성시 inode 개수를 늘려서 파일 시스템을 생성해 줘야 한다. 
mkfs 명령으로 파일시스템을 생성할때, -i 옵션을 이용하여 최대 사용가능한 inode 개수를 늘릴 수 있는데, -i 옵션은 단위 inode당 byte를 뜻하는 것으로 default 값이 ext3 파일 시스템에서는 8192, ext4 파일 시스템에서는 16384 이다.

최대사용가능한 inode 개수를 늘리기 위해서는 단위 inode당 byte 수를 줄여주면 된다.

ext3 파일시스템에서는 mkfs.ext3 -i 4096 옵션으로 파일시스템을 생성하게 되면 기본 inode수 보다 2배 증가하며, -i 2048 으로 생성하면 inode 수가 4배 늘어나게 된다.

마찬가지로 ext4 파일시스템에서는 mkfs.ext4 -i 8192 옵션으로 inode수를 2배 늘릴수 있으며, -i 4096 으로 생성하면 inode수는 4배로 늘어나게 된다. 

그리고, inode 수를 늘릴수록 가용 disk 공간은 줄어들기 때문에 적당히 필요한 만큼만 늘려서 써야 한다.


예제)

- ext3 파일시스템 생성
  기본값과, -i 8192 옵션이 동일하고, -i 4096옵션의 경우 inode수가 2배 늘어난 것을 확인 할 수 있다. 

[root@localhost ~]# mkfs.ext3 /dev/sda5
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
125696 inodes, 251007 blocks
12550 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=260046848
8 block groups
32768 blocks per group, 32768 fragments per group
15712 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376

Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 32 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

[root@localhost ~]# mkfs.ext3 -i 8192 /dev/sda5
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
125696 inodes, 251007 blocks
12550 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=260046848
8 block groups
32768 blocks per group, 32768 fragments per group
15712 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376

Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 28 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

[root@localhost ~]# mkfs.ext3 -i 4096 /dev/sda5
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
251136 inodes, 251007 blocks
12550 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=260046848
8 block groups
32768 blocks per group, 32768 fragments per group
31392 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376

Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 23 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
[root@localhost ~]#


- ext4 파일시스템 생성
  기본값과, -i 16384 옵션이 결과가 동일하고, -i 4096옵션의 경우 inode수가 4배 늘어난 것을 확인 할 수 있다. 
  그리고, inode 수를 늘려서 파일시스템을 생성하고, mount 했을때 사용 가능한 공간이 줄어드는 것을 확인 할 수 있다. 

[root@localhost ~]# mkfs.ext4 /dev/xvdb1
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
655360 inodes, 2620595 blocks
131029 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2684354560
80 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 36 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
[root@localhost /]# mount /dev/xvdb1 /mnt/
[root@localhost /]# df
Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/xvda3       7866824 6267472   1193080  85% /
tmpfs             958168       0    958168   0% /dev/shm
/dev/xvda1        245679   35360    197212  16% /boot
/dev/xvdb1      10186756   23028   9639612   1% /mnt
[root@localhost /]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/xvda3      7.6G  6.0G  1.2G  85% /
tmpfs           936M     0  936M   0% /dev/shm
/dev/xvda1      240M   35M  193M  16% /boot
/dev/xvdb1      9.8G   23M  9.2G   1% /mnt
[root@localhost /]#

[root@localhost /]# mkfs.ext4 -i 16384 /dev/xvdb1
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
655360 inodes, 2620595 blocks
131029 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2684354560
80 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 27 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
[root@localhost /]#

[root@localhost /]# mkfs.ext4 -i 4096 /dev/xvdb1
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
2621440 inodes, 2620595 blocks
131029 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2684354560
80 block groups
32768 blocks per group, 32768 fragments per group
32768 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 24 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
[root@localhost /]#
[root@localhost /]# mount /dev/xvdb1 /mnt/
[root@localhost /]# df
Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/xvda3       7866824 6267472   1193080  85% /
tmpfs             958168       0    958168   0% /dev/shm
/dev/xvda1        245679   35360    197212  16% /boot
/dev/xvdb1       9695236   23028   9148092   1% /mnt
[root@localhost /]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/xvda3      7.6G  6.0G  1.2G  85% /
tmpfs           936M     0  936M   0% /dev/shm
/dev/xvda1      240M   35M  193M  16% /boot
/dev/xvdb1      9.3G   23M  8.8G   1% /mnt
[root@localhost /]#
 

3개의 댓글이 있습니다.

1st 5stars

6년 이하 전

파일의 갯수에 제한이 있는줄도 몰랐네요~ ^^;;
참고할께요~

Reply

댓글 남기기

댓글을 남기기 위해서는 로그인이 필요합니다.

로그인 회원가입

6년 이하 전

오늘도 하나 배워갑니다... 감사합니다.

Reply

댓글 남기기

댓글을 남기기 위해서는 로그인이 필요합니다.

로그인 회원가입

6년 이하 전

감사합니다.

Reply

댓글 남기기

댓글을 남기기 위해서는 로그인이 필요합니다.

로그인 회원가입

댓글 남기기

댓글을 남기기 위해서는 로그인이 필요합니다.

로그인 회원가입