LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   How to freeze ext3 file system (https://www.linuxquestions.org/questions/programming-9/how-to-freeze-ext3-file-system-229937/)

A-Liang 09-13-2004 01:59 AM

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:Pengy:

ToniT 09-19-2004 09:49 PM

How about
Code:

mount -o remount -o ro /dev/hdXX
?

A-Liang 09-22-2004 06:41 AM

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.

ToniT 09-22-2004 08:01 AM

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.

A-Liang 09-22-2004 08:31 PM

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.

ToniT 09-22-2004 10:03 PM

Code:

init 1
the later is not so trivial.

A-Liang 09-22-2004 10:34 PM

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.

ToniT 09-22-2004 11:31 PM

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.

A-Liang 09-23-2004 12:27 AM

กกกก
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.


All times are GMT -5. The time now is 04:14 PM.