Setting a File to Enter the Protection State
After a WORM file system is created, you may need to enable files in the WORM file system to enter the protection state manually. The protection state includes locked and appending states.
Windows-based Client
- Access a WORM file system shared in CIFS mode.
- Set a file in the WORM file system to the locked state.
- Right-click the file that you want to set to the locked state.
The shortcut menu is displayed.
- Choose Properties from the shortcut menu that is displayed.
The Properties dialog box is displayed.
- In the Properties dialog box that is displayed, click the General tab and select Read-only. Then click Apply.
After the file enters the locked state, Accessed of the file indicates the overdue time of the file, as shown in Figure 3-2.
In Windows, you cannot set a protection period for a file. You can only use the default protection period of the WORM file system, which is 70 years.
- Click OK.
If the size of the file is not 0 bytes, skip the following steps.
- Right-click the file that you want to set to the locked state.
- (Optional) Shift the file whose size is 0 bytes from the locked state to the appending state.
- Right-click the file that you want to set to the appending state.
The shortcut menu is displayed.
- Choose Properties from the shortcut menu that is displayed.
The Properties dialog box is displayed.
- In the Properties dialog box that is displayed, click the General tab and deselect Read-only. Then click Apply.
- Click OK.
- Right-click the file that you want to set to the appending state.
- (Optional) Add contents to the end of the file.
- Right-click the file that you want to set to the appending state.
The shortcut menu is displayed.
- Choose Open from the shortcut menu that is displayed.
The page for editing files is displayed.
- Add contents that need to be protected to the end of the file.
- Click Close.
- Right-click the file that you want to set to the appending state.
- (Optional) Set a file in the appending state to the locked state.
- Right-click the file that you want to set to the locked state.
The shortcut menu is displayed.
- Choose Properties from the shortcut menu that is displayed.
The Properties dialog box is displayed.
- In the Properties dialog box that is displayed, click the General tab and select Read-only. Then click Apply.
- Click OK.
- Right-click the file that you want to set to the locked state.
Linux-based Client
- Access a WORM file system shared in NFS mode.
- (Optional) Run the touch -a -t time file command to set the protection period of a file.
- time indicates the overdue time of the file.
- file indicates the name of the file for which you want to set the overdue time.
If you have not run the touch -a -t time file command to set the protection period of the file, the protection period of the newly created file is the default protection period of the WORM file system.
- Run the chmod ugo-w file command to set the file to the locked state.
file indicates the name of the file that you want to set to the locked state.
If the size of the file is not 0 bytes, skip the following steps.
- (Optional) Run the chmod ugo+w file command to set a file of 0 bytes to the appending state.
file indicates the name of the file that you want to set to the appending state.
- (Optional) Run the echo content >>file command to add contents that need to be protected to the end of the file.
- content indicates the contents to be added.
- file indicates the name of the file to which you want to add contents.
- Run the cat file command to read the file.
file indicates the name of the file that you want to read.
- (Optional) Run the chmod ugo-w file command to set a file in the appending state to the locked state.
file indicates the name of the file that you want to set to the locked state.
linux-11:/mnt/fs1 # touch -a -t 202010100600 demo linux-11:/mnt/fs1 # stat demo File: `demo' Size: 0 Blocks: 0 IO Block: 4096 regular empty file Device: 802h/2050d Inode: 3760144 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root) Access: 2020-10-10 06:00:00.000000000 +0800 Modify: 2014-11-29 11:51:25.000000000 +0800 Change: 2014-11-29 11:52:11.000000000 +0800 linux-11:/mnt/fs1 # chmod u-w demo linux-11:/mnt/fs1 # stat demo File: `demo' Size: 0 Blocks: 0 IO Block: 4096 regular empty file Device: 802h/2050d Inode: 3760144 Links: 1 Access: (0444/-r--r--r--) Uid: ( 0/ root) Gid: ( 0/ root) Access: 2020-10-10 06:00:00.000000000 +0800 Modify: 2014-11-29 11:51:25.000000000 +0800 Change: 2014-11-29 11:54:11.000000000 +0800 linux-11:/mnt/fs1 # chmod u+w demo linux-11:/mnt/fs1 # stat demo File: `demo' Size: 0 Blocks: 0 IO Block: 4096 regular empty file Device: 802h/2050d Inode: 3760144 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root) Access: 2020-10-10 06:00:00.000000000 +0800 Modify: 2014-11-29 11:51:25.000000000 +0800 Change: 2014-11-29 11:56:17.000000000 +0800 linux-11:/mnt/fs1 # echo hello world>>demo linux-11:/mnt/fs1 # cat demo hello world linux-11:/mnt/fs1 # chmod u-w demo linux-11:/mnt/fs1 # stat demo File: `demo' Size: 12 Blocks: 8 IO Block: 4096 regular file Device: 802h/2050d Inode: 3760144 Links: 1 Access: (0444/-r--r--r--) Uid: ( 0/ root) Gid: ( 0/ root) Access: 2020-10-10 06:00:00.000000000 +0800 Modify: 2014-11-29 11:57:10.000000000 +0800 Change: 2014-11-29 11:57:55.000000000 +0800 linux-11:/mnt/fs1 # echo 123>>demo linux-11:/mnt/fs1 # cat demo hello world linux-11:/mnt/fs1 #