Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8357131
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T10:23:11+00:00 2026-06-09T10:23:11+00:00

I think this question is technical enough for Stack Overflow and, probably, too programming-oriented

  • 0

I think this question is technical enough for Stack Overflow and, probably, too programming-oriented for Android. I am intrigued as to how files are handled in Android (or Java or Linux, as appropriate), since I did something with my new smartphone and I’d curious to know how it happened.

I was transferring a file from my laptop to my Android phone via Bluetooth. I saw the new file in the file explorer and assumed it was fully transferred so I moved it from /sdcard/bluetooth to /sdcard/torrents. After I had done so, I noticed it was in fact still being transferred. To my surprise, it successfully completed, confirmed with a notification icon on the phone, and by a manual MD5 check on both sides. In most systems the file move would have caused a crash.

What is the reason for this successful transfer? I’m aware that in general, the file path is separate to the file location on the file system (in this case, an SD card). I imagine that the Bluetooth app has opened a handle to the file, and when I did the file move, a table of ‘open files’ was updated with a new path. Is this feature generally true of any Linux system? Could I do a mv on a file being written and expect the copy – in its new location – to be correct?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T10:23:12+00:00Added an answer on June 9, 2026 at 10:23 am

    When you move a file inside the same filesystem, the file itself (the inode) isn’t moved at all. The only thing that changes are the directory entries in that filesystem. (The system call invoked by mv in this case is rename(2) – check that page for additional information and restrictions.)

    When a process opens a file, the filename is passed to the OS to indicate which file is meant, but the file descriptor you get back isn’t linked to that name at all (you can’t get back a filename from it) – it is linked to the inode.
    Since the inode remains unchanged when you rename a file (inside the same filesystem), processes that have it open can happily keep reading from and writing to it – nothing changed for them, their file descriptor is still valid and pointing to the right data.

    Same thing if you delete a file. Processes can keep reading and writing from it even if the file is no longer reachable through any directory entry. (This can lead to confusing situations where df reports that your disk is full, but du says you’re using much less space that df reports. The blocks assigned to deleted files that are still open won’t be released until those processes close their file descriptor.)

    If the mv moves the file across filesystems, then the behavior is different since inodes are specific to each filesystem. In that case, mv will actually copy the data over, creating a new inode (and directory entry) on the destination filesystem. When the copy is over, the old file is unlinked, and removed if there are no open filehandles on it, as above.
    In your case, if you had crossed a filesystem boundary, you’d have a partial file in the destination. And your upload process happily writing to a deleted file you can’t easily access, possibly filling up that filesystem, until the upload finished at which point the inode would get dropped.

    Some posts on Unix & Linux that you could find interesting:

    • How are directories implemented in Unix filesystems?
    • What is a Superblock, Inode, Dentry and a File?
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I got this question in a programming test. Do you think this question is
I think this question is more of a coding style rather than technical issue.
I think this question has been asked many a times but I've been searching
I think this question may end up being a bit subjective so I'm marking
I think this question is really about my understanding of Garbage collection and variable
My apologies if you think this question is supposed to be on the Math
I don't think this question has been asked before. I'm a bit confused on
this question is about style, because i think this is a very common problem
I am using PrimeFaces p:messages but I think this question applies equally to h:messages
I mostly develop using C#, but I think this question might be suitable for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.