Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Moving files from Windows to Linux and back?


  • Please log in to reply
12 replies to this topic

#1 ray5450

ray5450

  • Members
  • 455 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:12:20 PM

Posted 28 May 2015 - 11:03 PM

Some time ago, I had an emergency type situation and had to move some Windows files to a Linux machine just to store and keep them safe there.  I used an external hard drive to do it.

 

Recently, I was at a point where I could move them back:

 

I formatted an external hard drive in Windows using Diskpart specifying fs=ntfs.

 

Unplugged from Windows machine, and plugged to Linux machine.

 

Moved files to said hard drive.

 

Plugged back to Windows machine.

 

Windows will now not read the drive.

 

I plugged back to Linux machine, and files are still there waiting. 

 

What is it I do not know?

 

Thanks.



BC AdBot (Login to Remove)

 


#2 paul88ks

paul88ks

  • Members
  • 1,284 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Dallas,Texas
  • Local time:12:20 PM

Posted 29 May 2015 - 01:27 AM

What is the file format of the individual files you are trying to move?Not the External drive that you formatted to NTFS.

 

The easiest way to do this is with a flash drive- just plug it in to a usb port,transfer the files onto the flashdrive ,then plug it into the windows machine and transfer back-



#3 mremski

mremski

  • Members
  • 493 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:NH
  • Local time:01:20 PM

Posted 29 May 2015 - 03:07 AM

When copying files around on a *nix system, you should keep in mind "buffers".  Files are read from disk into RAM buffers, then these buffers are marked for flushing to the other device.  That involves perhaps a different device driver.  So what could have happened is that the copy appeared to finish, but the data was not actually flushed to external drive when you unplugged it.  Think about Windows "Safely remove this device" or when you copy a lot to a USB it won't let you remove or eject it for a while?

 

I'm assuming the external drive has a USB interface?  What I would do:

reformat the drive on the Windows box again

before plugging it into the Linux machine do from a console/terminal window:

sudo mount

that will give you a list of devices currently mounted

plug the drive in, wait a minute or so.  If your desktop automounts and pops up a file explorer window, wait for that to show up.

In the same console, do the sudo mount command again.  You are looking for differences here, something like /dev/sdc1 mounted on /mnt/tmpdisk (you probably won't have these exact lines, just something similar).

Do your copy however you did it before.  When that appears to finish, in a console window enter the following:

sudo umount /dev/sdc1 (enter your info here).

If you pushed a lot of stuff, this command may take a while to finish:  don't unplug the drive until you get a prompt on the console.

 

umount is "unmounting" the device;  as part of this all dirty filesystem buffers are flushed to the physical device.


FreeBSD since 3.3, only time I touch Windows is to fix my wife's computer


#4 NickAu

NickAu

    Bleepin' Fish Doctor


  • Moderator
  • 12,684 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:127.0.0.1 Australia
  • Local time:03:20 AM

Posted 29 May 2015 - 03:22 AM

When copying files around on a *nix system, you should keep in mind "buffers".  Files are read from disk into RAM buffers, then these buffers are marked for flushing to the other device.  That involves perhaps a different device driver.  So what could have happened is that the copy appeared to finish, but the data was not actually flushed to external drive when you unplugged it.  Think about Windows "Safely remove this device" or when you copy a lot to a USB it won't let you remove or eject it for a while?

 

I'm assuming the external drive has a USB interface?  What I would do:

reformat the drive on the Windows box again

before plugging it into the Linux machine do from a console/terminal window:

sudo mount

that will give you a list of devices currently mounted

plug the drive in, wait a minute or so.  If your desktop automounts and pops up a file explorer window, wait for that to show up.

In the same console, do the sudo mount command again.  You are looking for differences here, something like /dev/sdc1 mounted on /mnt/tmpdisk (you probably won't have these exact lines, just something similar).

Do your copy however you did it before.  When that appears to finish, in a console window enter the following:

sudo umount /dev/sdc1 (enter your info here).

If you pushed a lot of stuff, this command may take a while to finish:  don't unplug the drive until you get a prompt on the console.

 

umount is "unmounting" the device;  as part of this all dirty filesystem buffers are flushed to the physical device.

 

+1


Edited by NickAu, 29 May 2015 - 08:00 PM.


#5 ray5450

ray5450
  • Topic Starter

  • Members
  • 455 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:12:20 PM

Posted 29 May 2015 - 12:08 PM

"(enter your info here)"

 

What information would that be?

 

Thanks.



#6 DeimosChaos

DeimosChaos

  • BC Advisor
  • 1,420 posts
  • ONLINE
  •  
  • Gender:Male
  • Location:United States, Delaware
  • Local time:01:20 PM

Posted 29 May 2015 - 12:30 PM

The "(enter your info here)" was just meant as replace the "/dev/sdc1" with whatever your external drive mount point is.

 

So if it is in fact "/dev/sdc1" you would run

sudo umount /dev/sdc1

Keep in mind the command is "umount" not "unmount" with an "n" after the "u".


Edited by DeimosChaos, 29 May 2015 - 12:30 PM.

OS - Ubuntu 14.04/16.04 & Windows 10
Custom Desktop PC / Lenovo Y580 / Sager NP8258 / Dell XPS 13 (9350)
_____________________________________________________
Bachelor of Science in Computing Security from Drexel University
Security +


#7 mremski

mremski

  • Members
  • 493 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:NH
  • Local time:01:20 PM

Posted 30 May 2015 - 01:53 AM

Thanks DC.  Yes, whatever device node your drive shows up as.  One way to get the info would be to enter the command "dmesg" in a console/terminal.  At the bottom you should see messages about the device you plugged in;  whatever you see that looks like "/dev/sdc1" is what you would use.

 

We've all been bitten by the umount/unmount, worst that should happen is a "command not found" error.


FreeBSD since 3.3, only time I touch Windows is to fix my wife's computer


#8 DeimosChaos

DeimosChaos

  • BC Advisor
  • 1,420 posts
  • ONLINE
  •  
  • Gender:Male
  • Location:United States, Delaware
  • Local time:01:20 PM

Posted 30 May 2015 - 08:13 PM

 

We've all been bitten by the umount/unmount, worst that should happen is a "command not found" error.

 

Haha, yeah. Thankfully with a lot of these types of things you'll just get an error and no bad things will happen.


OS - Ubuntu 14.04/16.04 & Windows 10
Custom Desktop PC / Lenovo Y580 / Sager NP8258 / Dell XPS 13 (9350)
_____________________________________________________
Bachelor of Science in Computing Security from Drexel University
Security +


#9 ray5450

ray5450
  • Topic Starter

  • Members
  • 455 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:12:20 PM

Posted 30 May 2015 - 11:06 PM

Thanks.  These are big files, so it will take me a while.  To speed things up, I also ordered another drive adapter so I can transfer directly from one external to another, and then I will try this again.



#10 mremski

mremski

  • Members
  • 493 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:NH
  • Local time:01:20 PM

Posted 31 May 2015 - 01:54 PM

I've never been a big fan of automount.  I've always added entries to /etc/fstab and then simply "sudo mount /blahblahblah".  Kind of goes along with beign more comfortable in a terminal window/console instead of GUIs.


FreeBSD since 3.3, only time I touch Windows is to fix my wife's computer


#11 ray5450

ray5450
  • Topic Starter

  • Members
  • 455 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:12:20 PM

Posted 01 June 2015 - 09:13 PM

I think we are assuming that the GUI does, or should do, that automatically, but we are going to verify whether that is true, and if not, I will do it manually as instructed.  That is my understanding.



#12 mremski

mremski

  • Members
  • 493 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:NH
  • Local time:01:20 PM

Posted 02 June 2015 - 02:34 AM

The mounting part, yep, most/all GUIs will do that unless explicitly configured not to.  It's the unmounting part that can screw things up.  There are multiple layers of buffers between the data and the physical device.  Some devices will even report "write complete" before the data is actually written to the media (caching controllers) .


FreeBSD since 3.3, only time I touch Windows is to fix my wife's computer


#13 ray5450

ray5450
  • Topic Starter

  • Members
  • 455 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:12:20 PM

Posted 16 July 2015 - 08:16 PM

What I ended up doing is transferring all the files back, and then using a different drive with the above unmounting check, to transfer them to their Windows destination.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users