I need some help matching my file database to my filesystem.


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users I need some help matching my file database to my filesystem.
# 1  
Old 04-23-2008
I need some help matching my file database to my filesystem.

Hi There I have a big problem, but maybe a simple question.

I'm attempting something that is turning out to be a huge job, but maybe it could be simpler if I knew some more advanced commands or techniques.

My problem is this: I work for a company that has a primary file server with 27T capacity. I have a database keeping track of the files on this server that reports that only ~10T total when I sum the file sizes.

I need to recover the wasted space by deleting files that are not referenced in the database, and then prevent this storage leak from occuring again. I know that my predecessor has "lost" the database before on at least on occasion and restored an out of date backup.

Some details:
The file ids are stored on the file server as the mysql autoincrement id like this:

id -> padded with leading 0's and broken into 2 digit folders, each file is stored in a unique folder.
1194649 -> /ifs/data/00/00/01/19/46/49/filename.ext

So far I have made a list of all directories on the file server with `find -type d` and outputted a list of all file id's. One id per line.

I tried to get unique ids that do not exist in the database and the file server directory tree by doing:

Code:
cat file_ids_from_db file_ids_from_filesystem | sort | uniq -u > list_of_unique_ids

This didn't work, I tested a sample of the ids on the database before trying to delete the files and I found matches.

My question is this: What is the best way to do a left join between these files, only getting ids that are in the filesystem and not the database?

Another question is why am I doing it this way, is there a better solution?

Thank you in advance for any help. Smilie

-Charles
# 2  
Old 04-23-2008
Network Hi,

Pls check the following command

comm -13 <(sort file1) <(sort file2)

Thanks,
Thangaraju.

Last edited by rajx; 04-23-2008 at 09:15 PM..
# 3  
Old 04-23-2008
Thanks, I'm trying the comm command out. I'll post tomorrow to let you know if I solved this problem.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. AIX

Mount Filesystem in AIX Unable to read /etc/filesystem

Dear all, We are facing prolem when we are going to mount AIX filesystem, the system returned the following error 0506-307The AFopen call failed : A file or directory in the path name does not exist. But when we ls filesystems in the /etc/ directory it show -rw-r--r-- 0 root ... (2 Replies)
Discussion started by: m_raheelahmed
2 Replies

2. Solaris

Solaris Filesystem vs. Windows FileSystem

Hi guys! Could you tell me what's the difference of filesystem of Solaris to filesystem of Windows? I need to compare both. I have read some over the net but it's so much technical. Could you explain it in a more simpler term? I am new to Solaris. Hope you help me guys. Thanks! (4 Replies)
Discussion started by: arah
4 Replies

3. UNIX for Dummies Questions & Answers

hwo to find shared filesystem and local filesystem in AIX

Hi, I wanted to find out that in my database server which filesystems are shared storage and which filesystems are local. Like when I use df -k, it shows "filesystem" and "mounted on" but I want to know which one is shared and which one is local. Please tell me the commands which I can run... (2 Replies)
Discussion started by: kamranjalal
2 Replies

4. AIX

Extending database filesystem

Ok, I'm a newbie to AIX so I just want to make sure my thinking is correct with regards to this issue. Any insight you guys could give would be appreciated. A main question I have is should I shutdown the database to extend this LV? The filesystem the dba wants to extend is /dev/fslv83 ... (3 Replies)
Discussion started by: Steelysteel
3 Replies

5. Shell Programming and Scripting

Calculate total space, total used space and total free space in filesystem names matching keyword

Good afternoon! Im new at scripting and Im trying to write a script to calculate total space, total used space and total free space in filesystem names matching a keyword (in this one we will use keyword virginia). Please dont be mean or harsh, like I said Im new and trying my best. Scripting... (4 Replies)
Discussion started by: bigben1220
4 Replies

6. Solaris

Filesystem - error when extend the filesystem

Hi all, currently , my root filesystem already reach 90 ++% I already add more cylinder in the root partition as below Part Tag Flag Cylinders Size Blocks 0 root wm 67 - 5086 38.46GB (5020/0/0) 80646300 1 swap wu 1 - ... (11 Replies)
Discussion started by: SmartAntz
11 Replies

7. HP-UX

Filesystem on file

How do i create a filesystem on a file ? In linux ( and solaris i think ) i would use losetup to attatch the file to a device, and then run mkfs as usual. But as far as i can understand theres no such functionality in HP-UX. Any pointers at all would be great. (1 Reply)
Discussion started by: jahlinder
1 Replies

8. SCO

create filesystem on file

Hello, iam pretty new to SCO, installed it yesterday in vm. Now, i'd like to create a filesystem on a file like you can do on lnx or bsd. But seems not possible for me to do so on SCO OpenServer 6.0.0. Thats what i get: bash-3.00# uname -a SCO_SV scosysv 5 6.0.0 i386 bash-3.00# mkfs... (0 Replies)
Discussion started by: user5
0 Replies

9. UNIX for Dummies Questions & Answers

Compress file into another filesystem/folder

Hi all, how can I compress file into another folder/file system?? What is the syntax like?? Thank you. (1 Reply)
Discussion started by: wkk1020
1 Replies
Login or Register to Ask a Question