- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- mv question
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2006 06:58 AM
06-09-2006 06:58 AM
mv question
What happen if I try to move ( with command "mv") a file that is being written exactly at same time I am trying to move it?
1) Does it result corrupted?
2) Does the moved file is not complete (the rest of the written file remains in the original location?
3) Does the commmand wait until that process that is writing to the file terminates and after that, the command moves the file?
Same questions for "cp" command?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2006 08:42 AM
06-09-2006 08:42 AM
Re: mv question
You can move a file while is generated/populated, the file generation process will continue and the data will be available at the new location, without any corruption. The file will be moved immediatly while is generated/populated.
You can copy a file while is generated/populated, but the copy process will hang waiting for the file to be complete before copying all the contents of the file. The files will have the same data and there will be NO data loss.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2006 08:49 AM
06-09-2006 08:49 AM
Re: mv question
Usually, if the filename was test, then the name of the copy on which the system will work will be .test.swp
So there's no problem of copying /moving the file while editing.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2006 10:49 AM
06-09-2006 10:49 AM
Re: mv question
If you mv a file within a single file system, then the mv command does a rename(oldpath,newpath). That means that the file keeps the same inode. Processes writing to the file won't see any disruption. All writes will end up in the file at its final name.
If you mv a file from one file system mount point to another, then the mv command must copy the file be reading from the first location and writing to the new location. When the last data is read and written the old file location is removed with a call unlink(). Other processes that are writing to the file will continue to have the open file descriptors for the original inode as long as they hold them open. But further writes will not appear in the new file location. They will be available for reads by processes that are keeping open file descriptors for the original file. (If the original file had multiple hard links then you could still see the full effect of those writes through opening one of the other hard links.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2006 10:55 AM
06-09-2006 10:55 AM