LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-13-2004, 01:59 AM   #1
A-Liang
LQ Newbie
 
Registered: Sep 2004
Location: China
Posts: 13

Rep: Reputation: 0
Cool How to freeze ext3 file system


I want to develop a application with C for Red Hat Linux Enterprise AS2.1 platform...

The function is as follows:
- freeze the file system(ext2 or ext3)
- take the backup
- thaw the file system.

But I don't know that how to freeze the file system with ioctl or other system calls?
So I want to get some help.
Please tell me for detail usage and notice items.


thanks...

Regards,
Xiao Liang
 
Old 09-19-2004, 09:49 PM   #2
ToniT
Senior Member
 
Registered: Oct 2003
Location: Zurich, Switzerland
Distribution: Debian/unstable
Posts: 1,357

Rep: Reputation: 47
How about
Code:
mount -o remount -o ro /dev/hdXX
?
 
Old 09-22-2004, 06:41 AM   #3
A-Liang
LQ Newbie
 
Registered: Sep 2004
Location: China
Posts: 13

Original Poster
Rep: Reputation: 0
ToniT

I think that other processes still can access mountpoint with read-only. but also the processes which is writing data to mountpoint terminate for failing to write.

regards.
 
Old 09-22-2004, 08:01 AM   #4
ToniT
Senior Member
 
Registered: Oct 2003
Location: Zurich, Switzerland
Distribution: Debian/unstable
Posts: 1,357

Rep: Reputation: 47
If some are trying to write into it while you remount it, your remounting fails.

If you really don't want anyone to even try to open the disk for writing, then you should drop into single user mode for that time. Though I don't see much harm in processes trying to open files.
 
Old 09-22-2004, 08:31 PM   #5
A-Liang
LQ Newbie
 
Registered: Sep 2004
Location: China
Posts: 13

Original Poster
Rep: Reputation: 0
Sorry, Please teach that how to drop into single user mode?

In addition, before taking the backup, if I want to hang
the processes which is writing data to disks and which try to open the disk for reading or writing, Please teach how to do?

regards.
 
Old 09-22-2004, 10:03 PM   #6
ToniT
Senior Member
 
Registered: Oct 2003
Location: Zurich, Switzerland
Distribution: Debian/unstable
Posts: 1,357

Rep: Reputation: 47
Code:
init 1
the later is not so trivial.
 
Old 09-22-2004, 10:34 PM   #7
A-Liang
LQ Newbie
 
Registered: Sep 2004
Location: China
Posts: 13

Original Poster
Rep: Reputation: 0
That will restart Linux, this is not expecting.

Before taking the backup, as follows require can be got:
1. don't unmount the disks
2. block(or hang) the processes which have opened the disks for reading or writing, but don't make the processes terminate.
3. block(or hang) the processes which try to open disks,
but don't make the processes terminate.
4. take the backup.
5. recovery, make the processes which have opened the disks for reading or writing continue to do.


Regards.
 
Old 09-22-2004, 11:31 PM   #8
ToniT
Senior Member
 
Registered: Oct 2003
Location: Zurich, Switzerland
Distribution: Debian/unstable
Posts: 1,357

Rep: Reputation: 47
init 1 wont restart linux. init 0 or init 6 does.

Why can't you just tar to take a running copy of the system?
If this, for some reason, unacceptable, you might want to familiarize yourself with raid mirroring (they make an exact copy of the partition while it is actively in use). Alternatively you can try to do some tricks with lvm; they do process holding and some other tricks when moving data around in physical layers.
 
Old 09-23-2004, 12:27 AM   #9
A-Liang
LQ Newbie
 
Registered: Sep 2004
Location: China
Posts: 13

Original Poster
Rep: Reputation: 0
กกกก
At present, lvm have realized above functions(freeze function) on the file system reiserfs, Veritas File System also have realized on the file system vxfs.

Now I also want to realize above functions on the file system ext3 not to use lvm or Veritas File System. But I don't know how to do.

Regards.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to ext3 file system A-Liang Programming 2 09-13-2004 10:14 PM
How to freeze ext3 file system A-Liang LinuxQuestions.org Member Intro 1 09-13-2004 04:35 AM
file system freeze david@aber Red Hat 0 07-21-2004 04:52 AM
ext3: File system error big_gie Linux - General 6 07-16-2004 11:44 AM
Large tar file taking huge disk space in ext3 file system pcwulf Linux - General 2 10-20-2003 07:45 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:45 PM.

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