[20190301]簡單測試linux fsfreeze命令.txt

lfree發表於2019-03-01

[20190301]簡單測試linux fsfreeze命令.txt


--//簡單測試學習linux的fsfreeze命令.


# man fsfreeze

FSFREEZE(8)                  System Administration                 FSFREEZE(8)


NAME

       fsfreeze - suspend access to a filesystem (Linux Ext3/4, ReiserFS, JFS, XFS)


SYNOPSIS

       fsfreeze -f mountpoint


       fsfreeze -u mountpoint


DESCRIPTION

       fsfreeze suspends and resumes access to an filesystem


  fsfreeze halts new access to the filesystem and creates a stable image on disk.  fsfreeze is intended to be used

  with hardware RAID devices that support the creation of snapshots.


  fsfreeze is unnecessary for device-mapper devices. The device-mapper (and LVM) automatically freezes filesystem

  on the device when a  snapshot  creation is requested.  For more details see the dmsetup(8) man page.


  The  mount-point argument is the pathname of the directory where the filesystem is mounted.  The filesystem must

  be mounted to be frozen (see mount(8)).


..


-f, --freeze

  This option requests the specified a filesystem to be frozen from new modifications.  When this is selected,  all

  ongoing  transactions  in  the filesystem  are  allowed  to complete, new write system calls are halted, other

  calls which modify the filesystem are halted, and all dirty data,metadata, and log information are written to

  disk.  Any process attempting to write to the frozen filesystem will block waiting for the  filesystem to be

  unfrozen.


Note  that  even after freezing, the on-disk filesystem can contain information on files that are still in the process

  of unlinking.  These files will not be unlinked until the filesystem is unfrozen or a clean mount of the snapshot

  is complete.


-u, --unfreeze

 This option is used to un-freeze the filesystem and allow operations to continue.  Any filesystem modifications

 that were blocked by  the  freeze are unblocked and allowed to complete.


--//很簡單-f 凍結,-u 解凍.這樣可以在出現一些意外操作時臨時凍結檔案系統.


1.測試:


# dd if=/dev/zero of=image.10m count=1 bs=10M

1+0 records in

1+0 records out

10485760 bytes (10 MB) copied, 0.0483896 seconds, 217 MB/s


# mke4fs image.10m

mke4fs 1.41.12 (17-May-2010)

image.10m is not a block special device.

Proceed anyway? (y,n) y

Filesystem label=

OS type: Linux

Block size=1024 (log=0)

Fragment size=1024 (log=0)

Stride=0 blocks, Stripe width=0 blocks

2560 inodes, 10240 blocks

512 blocks (5.00%) reserved for the super user

First data block=1

Maximum filesystem blocks=10485760

2 block groups

8192 blocks per group, 8192 fragments per group

1280 inodes per group

Superblock backups stored on blocks:

        8193


Writing inode tables: done

Creating journal (1024 blocks): done

Writing superblocks and filesystem accounting information: done


This filesystem will be automatically checked every 38 mounts or

180 days, whichever comes first.  Use tune4fs -c or -i to override.


# mount -o loop image.10m /mnt/backup/


# cd /mnt/backup

# echo 'this is a testcat '> test1.txt


2.測試:

--//凍結

# fsfreeze -f /mnt/backup/

# echo 'this is a testcat '>> /mnt/backup/test1.txt

--//... 掛起.不能寫入資訊


--//解凍:

# fsfreeze -u /mnt/backup/

--//檢視另外視窗:

# echo 'this is a testcat '>> test1.txt


# cat test1.txt

this is a test!!

this is a testcat


--//不知道在實際工作中是否有用.


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2637261/,如需轉載,請註明出處,否則將追究法律責任。

相關文章