LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 06-28-2005, 01:38 PM   #1
d-fens
LQ Newbie
 
Registered: Jul 2003
Location: Friedrichshafen, Germany
Posts: 9

Rep: Reputation: 0
merge directories


hi,

i have a directory, say /home/foo/data which is on partition A and is used by a program that runs 24/7 and produces lots of output data into this directory.
Now the space becomes too little.
I got more free space on another partition and create a directory /mnt/other/bar
on this one.
Now i want to combine those directories.
-> That means, extend the space in /home/foo/data with space borrowed from /mnt/other/bar
The running program can not be changed - so the change should be transparent.
Also i cannot move the old data to the other partition because there is not enough space -> i just need some more space from it.
example:

Filesystem Total Size Free Space Mount Point
--------------------------------------------------------------------
/dev/hdb1 80GB 1GB /home/foo
/dev/hdc1 40GB 39GB /mnt/other/bar

does anyone know how to "merge" those directories?

Thanks alot!
 
Old 06-28-2005, 04:02 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
You can't. The only possibility would be (if the foos
log-files can be in a sub-directory) to mount bar under
foo ...


Cheers,
Tink
 
Old 06-28-2005, 04:16 PM   #3
Zero-0-Effect
Member
 
Registered: Sep 2002
Location: Texas
Distribution: SlackWare - Current LFS - CVS
Posts: 267

Rep: Reputation: 31
If you mount /mnt/other/bar into /home/foo You will not be able to get to /home/foo/data anymore (data is still there just not accessible). If you looked at /home/foo after mounting the directory it would hold /mnt/other/bar's data. Once you unmount /mnt/other/bar the contents of what were in /home/foo/data will be back. .. so mounting it will allow you to increase the space but at the price of not being able to access /home/foo/data until /mnt/other/bar is unmounted.

Not sure how safe that is to do though.. Ive done it before by accident and had no problems.
 
Old 06-28-2005, 04:54 PM   #4
d-fens
LQ Newbie
 
Registered: Jul 2003
Location: Friedrichshafen, Germany
Posts: 9

Original Poster
Rep: Reputation: 0
hi Zero-0-Effect,

this is a cool idea!
Unfortunately it is not applicable in my case. The running app needs continuous access to the written log files.
 
Old 06-28-2005, 04:55 PM   #5
d-fens
LQ Newbie
 
Registered: Jul 2003
Location: Friedrichshafen, Germany
Posts: 9

Original Poster
Rep: Reputation: 0
Quote:
Originally posted by Tinkster
[B]You can't. The only possibility would be (if the foos
log-files can be in a sub-directory) to mount bar under
foo ...
no, unfortunately the app is not aware of subdirectories..
 
Old 06-28-2005, 05:57 PM   #6
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Hmmm ... one other thought: Can you create a file with the
same name in bar, then
rm foo/log ; ln -s bar/log foo/log
?
 
Old 06-28-2005, 07:04 PM   #7
Zero-0-Effect
Member
 
Registered: Sep 2002
Location: Texas
Distribution: SlackWare - Current LFS - CVS
Posts: 267

Rep: Reputation: 31
He would want to keep those existing logs/data would you not? So creating that link would require removing the old log/data, and he said he could not copy it over since it is larger than the drive.


I cant think of anything else that could help you out. Unless you got another partition on that same drive that you can enlarge that partitioin into..
 
Old 06-28-2005, 07:10 PM   #8
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
in that case
gzip foo/log ; ln -s bar/log foo/log
 
Old 06-29-2005, 08:20 AM   #9
d-fens
LQ Newbie
 
Registered: Jul 2003
Location: Friedrichshafen, Germany
Posts: 9

Original Poster
Rep: Reputation: 0
Hi,

Zero-0-Effect is right, i cannot move the files from /foo because they are too large for /bar. AND i need access to them so zipping em will not solve my problem.

I know this is a very weird case and maybe there is simply no solution possible at all
 
Old 02-04-2010, 05:48 PM   #10
Xires
LQ Newbie
 
Registered: Jun 2007
Location: Sedalia, MO - US 65301
Distribution: Slackware, Debian & Custom
Posts: 1

Rep: Reputation: 0
I know this is quite old but it's apparently unanswered so I figured I'd answer it in case someone else found the page via a google search or something.

'mount' provides a '--bind' option that allows you to bind something to a given directory. If you can momentarily pause the logging or whatever is writing data then you can copy everything there to a directory on the partition with plenty of space and then bind-mount that directory to your logging target. Then the logging can continue to log to the existing files as they are actually being updated on the partition with more space. This works as a decent temporary solution when you need something done NOW and works well with syslog-based logging on systems with very little space(e.g. embedded configurations). At a later point you really should make a better solution for the situation(e.g. changing the logging directory in some configuration or symlinking the directory desired, etc.) and not rely on this approach to serve you permanently. Keep in mind that this all gets undone if the machine reboots(info is still saved, but the bind-mount goes away).

Hope this info helps.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to merge two mailboxes--------------------- dhanju Linux - Newbie 5 05-10-2010 06:35 AM
Searching multiple directories and sub directories for a file jeep99899 Linux - Newbie 2 10-13-2005 12:23 PM
Merge JPGs mddolloff Linux - Software 5 11-21-2004 07:41 AM
merge mailboxes illtbagu Linux - Software 0 03-13-2004 01:53 PM
Merge 2 arrays in C linux_GNUbie Programming 6 12-11-2003 05:28 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:26 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration