Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Directory file size change

If none of the specific sub-forums seem right for your thread, ask here.
Post Reply
Message
Author
admiincomp
Posts: 31
Joined: 2023-12-19 09:25
Been thanked: 1 time

Directory file size change

#1 Post by admiincomp »

I have a standard Picture directory which should have a size of 4096 bytes but for some reason is larger. I removed the directory recreated the same directory name and place exctly the same files back into the directory and the Picture directory remained the same. I have a machne with this same condition.

What is the cause of the Picture directory getting larger ?

ls -l
total 44
drwxr-xr-x 8 Name Name 4096 Dec 11 18:18 Desktop
drwxr-xr-x 18 Name Name 4096 Dec 8 22:56 Documents
drwxr-xr-x 12 Name Name 4096 Dec 11 21:41 Downloads
drwxr-xr-x 3 Name Name 4096 Jun 23 03:14 Music
drwxr-xr-x 4 Name Name 12288 Dec 8 21:06 Pictures
drwxr-xr-x 2 Name Name 4096 Aug 12 18:11 Public
drwxr-xr-x 2 Name Name 4096 Aug 14 2022 Templates
drwxr-xr-x 2 Name Name 4096 Dec 14 23:03 Videos
drwxr-xr-x 6 Name Name 4096 Dec 6 18:19 'VirtualBox VMs'

User avatar
wizard10000
Global Moderator
Global Moderator
Posts: 628
Joined: 2019-04-16 23:15
Location: southeastern us
Has thanked: 84 times
Been thanked: 98 times

Re: Directory file size change

#2 Post by wizard10000 »

I'm guessing you have a lot of pictures :)

Your filesystem reserves 4096 bytes for a directory's metadata. For *most* directories that's just fine but if the metadata is > 4096 bytes the filesystem will allocate more space for metadata. My e-books directory is also 12288 bytes but it has a couple hundred subdirectories :)

Completely normal.
we see things not as they are, but as we are.
-- anais nin

User avatar
sunrat
Administrator
Administrator
Posts: 6511
Joined: 2006-08-29 09:12
Location: Melbourne, Australia
Has thanked: 119 times
Been thanked: 489 times

Re: Directory file size change

#3 Post by sunrat »

wizard10000 wrote: 2024-03-08 12:12My e-books directory is also 12288 bytes but it has a couple hundred subdirectories :)
My Music folder shows 110592 bytes. Do I win? :mrgreen:
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!

CwF
Global Moderator
Global Moderator
Posts: 2719
Joined: 2018-06-20 15:16
Location: Colorado
Has thanked: 41 times
Been thanked: 201 times

Re: Directory file size change

#4 Post by CwF »

Extra Credit
So, now we know it's related to the number of contents growing the meta data.
So what is it when it shows 160 bytes?
What is it when the directory shows 0 B?

User avatar
wizard10000
Global Moderator
Global Moderator
Posts: 628
Joined: 2019-04-16 23:15
Location: southeastern us
Has thanked: 84 times
Been thanked: 98 times

Re: Directory file size change

#5 Post by wizard10000 »

sunrat wrote: 2024-03-08 14:15My Music folder shows 110592 bytes. Do I win? :mrgreen:
Absolutely :mrgreen:
we see things not as they are, but as we are.
-- anais nin

User avatar
fabien
Forum Helper
Forum Helper
Posts: 688
Joined: 2019-12-03 12:51
Location: Anarres (Toulouse, France actually)
Has thanked: 62 times
Been thanked: 161 times

Re: Directory file size change

#6 Post by fabien »

CwF wrote: 2024-03-08 15:19 So what is it when it shows 160 bytes?
With /tmp/ mounted as tmpfs, an empty directory has a size of 40 bytes. Less metadata when there's no underlying filesystem I guess.
Edit: no need to allocate sectors rather, of course.
CwF wrote: 2024-03-08 15:19 What is it when the directory shows 0 B?
I have this for example in /dev/pts/ (devpts pseudo filesystem).

CwF
Global Moderator
Global Moderator
Posts: 2719
Joined: 2018-06-20 15:16
Location: Colorado
Has thanked: 41 times
Been thanked: 201 times

Re: Directory file size change

#7 Post by CwF »

Yes @fabien, I get 40+ for tmpfs mounts and 0B for inactive mounts.
I'm still experimenting with 'transient data' solutions. I have some images running tmpfs for ~/Desktop, Downloads, and others along with automounts and timeouts for datasets. The ~/Desktop one is neat, I can drag-n-drop a file from host to vm and it appears on the vm desktop, to be used or moved, without hitting the disk. Overall, have all data unmounted when not in use and random stuff we don't need a record of in memory. All ~/.profile activated. Fun. No major explosions yet...

Speaking of ~/Music, I have 5 mount points in there with 1 minute timeouts. The most obvious issue I thought would be access time. So fire up deadbeef with existing play list and it searches and reviews all data without triggering the mount (any of 5). Then hit play, and instantly playing. Maybe my brain is slow, but no delay at all. I'm a tad surprised it is so fast.

User avatar
dilberts_left_nut
Administrator
Administrator
Posts: 5347
Joined: 2009-10-05 07:54
Location: enzed
Has thanked: 13 times
Been thanked: 66 times

Re: Directory file size change

#8 Post by dilberts_left_nut »

wizard10000 wrote: 2024-03-08 15:52
sunrat wrote: 2024-03-08 14:15My Music folder shows 110592 bytes. Do I win? :mrgreen:
Absolutely :mrgreen:
Not so fast ... :D

Code: Select all

drwx------ 2 vmail vmail 6893568 Mar  5 16:46 /var/mail/archive/Maildir/.2023/cur/
AdrianTM wrote:There's no hacker in my grandma...

admiincomp
Posts: 31
Joined: 2023-12-19 09:25
Been thanked: 1 time

Re: Directory file size change

#9 Post by admiincomp »

It has nothing to do with the files in the directory. If I move all files to a second directory called Pictures2 you can see the directory size remains the same 4096

ls -l
total 48
drwxr-xr-x 7 name name 4096 Mar 10 13:11 Desktop
drwxr-xr-x 19 name name 4096 Mar 12 03:09 Documents
drwxr-xr-x 13 name name 4096 Mar 11 02:42 Downloads
drwxr-xr-x 3 name name 4096 Jun 23 2023 Music
drwxr-xr-x 6 name name 12288 Mar 10 12:23 Pictures
drwxr-xr-x 5 name name 4096 Mar 12 16:29 Pictures2
drwxr-xr-x 2 name name 4096 Aug 12 2023 Public
drwxr-xr-x 2 name name 4096 Aug 14 2022 Templates
drwxr-xr-x 3 name name 4096 Mar 12 13:38 Videos
drwxr-xr-x 6 name name 4096 Feb 7 10:53 'VirtualBox VMs'

User avatar
wizard10000
Global Moderator
Global Moderator
Posts: 628
Joined: 2019-04-16 23:15
Location: southeastern us
Has thanked: 84 times
Been thanked: 98 times

Re: Directory file size change

#10 Post by wizard10000 »

I did the same thing with my ebooks directory - moved them to an ebooks2 directory. ebooks2 was at 4096 bytes until I rebooted the machine and then it read 12288 bytes, same as my original ebooks directory. My understanding is that ext4 doesn't truncate directory metadata unless you force the issue.
we see things not as they are, but as we are.
-- anais nin

admiincomp
Posts: 31
Joined: 2023-12-19 09:25
Been thanked: 1 time

Re: Directory file size change

#11 Post by admiincomp »

I have seen it before and it is always Pictures directory. What metadata would be associated with a directory?

User avatar
wizard10000
Global Moderator
Global Moderator
Posts: 628
Joined: 2019-04-16 23:15
Location: southeastern us
Has thanked: 84 times
Been thanked: 98 times

Re: Directory file size change

#12 Post by wizard10000 »

admiincomp wrote: 2024-03-14 03:23 I have seen it before and it is always Pictures directory.
Not on my machine.

Code: Select all

wizard@server: 06:42 $ cd /media/internal
wizard@server: 06:42 $ ls -l
total 72
drwxr-xr-x 297 wizard wizard 12288 Mar 12 16:20 books
drwxr-xr-x   6 wizard wizard  4096 Dec 29 16:04 desktop
drwxr-xr-x  12 wizard wizard  4096 Dec 27 07:01 documents
drwxr-xr-x  26 wizard wizard  4096 Sep 16  2021 humor
drwxr-xr-x   6 wizard wizard  4096 Feb 15  2023 laptop
drwxr-xr-x 112 wizard wizard  4096 Aug 29  2023 music
drwxr-xr-x  58 wizard wizard  4096 Feb 14  2023 pictures
drwxr-xr-x   2 wizard wizard  4096 Dec 22 03:55 plex-backup
drwxr-xr-x   7 wizard wizard  4096 Dec  6 00:01 prowlarr
drwxr-xr-x   7 wizard wizard  4096 Dec  6 00:01 radarr
drwxr-xr-x   6 wizard wizard  4096 Mar 15  2022 server
drwxr-xr-x  19 wizard wizard  4096 Mar 13 07:48 software
drwxr-xr-x   7 wizard wizard  4096 Dec 28 08:11 sonarr
drwxr-xr-x   6 wizard wizard  4096 Jul 12  2022 tablet
drwxr-xr-x   4 wizard wizard  4096 Mar  5 10:05 temp
drwxr-xr-x   4 wizard wizard  4096 Apr  3  2022 videos
wizard@server: 06:42 $
admiincomp wrote: 2024-03-14 03:23 What metadata would be associated with a directory?
Information about the directory's contents.
we see things not as they are, but as we are.
-- anais nin

admiincomp
Posts: 31
Joined: 2023-12-19 09:25
Been thanked: 1 time

Re: Directory file size change

#13 Post by admiincomp »

The contents of the directory Picture and Pictures2 are identical. After seeing the size difference on Pictures I copied everything into the directory Pictures2, then i compared the directory using diff command. That is how I know it is not the files that causes the size difference.

I am suspecting an application.

Post Reply