Overwrote files on NTFS partition as blank — how to prevent in the future?
My computer dual-boots Ubuntu from ext4 and Win7 from NTFS partitions on the same physical drive. TL;DR: How can I keep mounting my NTFS to avoid read/write conflicts?
I opened the Arduino IDE, and opened a recent file (which I forgot was stored on the NTFS). It showed me a blank editing window. Briefly confused, I opened the other recent project... also blank. Then I realized what was going on, and mounted the NTFS drive... only to find the files still opened as empty. Browsing to the location, both files now exist but are 0 bytes in size.
I see what I did, and assume this is as much an Arduino software issue/bug as any Ubuntu issue. I see no reason why the file data isn't still there ,just with the header rewritten, so I'm starting to learn to use testdisk and maybe foremost to rebuild those files.
My big question is: are there ways to mount a partition (mount flags?) to avoid programs opening files before they are mounted? I do not dual boot when Windows is in hibernate, so there should be no Windows-related conflicts.
The arduino files aren't a big deal, but I could see this really messing me up with, say, my shared Thunderbird mail archive.
dual-boot data-recovery ntfs arduino
add a comment |
My computer dual-boots Ubuntu from ext4 and Win7 from NTFS partitions on the same physical drive. TL;DR: How can I keep mounting my NTFS to avoid read/write conflicts?
I opened the Arduino IDE, and opened a recent file (which I forgot was stored on the NTFS). It showed me a blank editing window. Briefly confused, I opened the other recent project... also blank. Then I realized what was going on, and mounted the NTFS drive... only to find the files still opened as empty. Browsing to the location, both files now exist but are 0 bytes in size.
I see what I did, and assume this is as much an Arduino software issue/bug as any Ubuntu issue. I see no reason why the file data isn't still there ,just with the header rewritten, so I'm starting to learn to use testdisk and maybe foremost to rebuild those files.
My big question is: are there ways to mount a partition (mount flags?) to avoid programs opening files before they are mounted? I do not dual boot when Windows is in hibernate, so there should be no Windows-related conflicts.
The arduino files aren't a big deal, but I could see this really messing me up with, say, my shared Thunderbird mail archive.
dual-boot data-recovery ntfs arduino
Are you not mounting with fstab? Back with XP, I used a shared data NTFS partition for Firefox & Thunderbird profiles and never had an issue. But always mounted with fstab. help.ubuntu.com/community/Fstab I do not like Disks as it may not use correct parameters. Better to use template/example and adjust for your specifics askubuntu.com/questions/164926/… & help.ubuntu.com/community/MountingWindowsPartitions
– oldfred
Jan 28 at 20:01
add a comment |
My computer dual-boots Ubuntu from ext4 and Win7 from NTFS partitions on the same physical drive. TL;DR: How can I keep mounting my NTFS to avoid read/write conflicts?
I opened the Arduino IDE, and opened a recent file (which I forgot was stored on the NTFS). It showed me a blank editing window. Briefly confused, I opened the other recent project... also blank. Then I realized what was going on, and mounted the NTFS drive... only to find the files still opened as empty. Browsing to the location, both files now exist but are 0 bytes in size.
I see what I did, and assume this is as much an Arduino software issue/bug as any Ubuntu issue. I see no reason why the file data isn't still there ,just with the header rewritten, so I'm starting to learn to use testdisk and maybe foremost to rebuild those files.
My big question is: are there ways to mount a partition (mount flags?) to avoid programs opening files before they are mounted? I do not dual boot when Windows is in hibernate, so there should be no Windows-related conflicts.
The arduino files aren't a big deal, but I could see this really messing me up with, say, my shared Thunderbird mail archive.
dual-boot data-recovery ntfs arduino
My computer dual-boots Ubuntu from ext4 and Win7 from NTFS partitions on the same physical drive. TL;DR: How can I keep mounting my NTFS to avoid read/write conflicts?
I opened the Arduino IDE, and opened a recent file (which I forgot was stored on the NTFS). It showed me a blank editing window. Briefly confused, I opened the other recent project... also blank. Then I realized what was going on, and mounted the NTFS drive... only to find the files still opened as empty. Browsing to the location, both files now exist but are 0 bytes in size.
I see what I did, and assume this is as much an Arduino software issue/bug as any Ubuntu issue. I see no reason why the file data isn't still there ,just with the header rewritten, so I'm starting to learn to use testdisk and maybe foremost to rebuild those files.
My big question is: are there ways to mount a partition (mount flags?) to avoid programs opening files before they are mounted? I do not dual boot when Windows is in hibernate, so there should be no Windows-related conflicts.
The arduino files aren't a big deal, but I could see this really messing me up with, say, my shared Thunderbird mail archive.
dual-boot data-recovery ntfs arduino
dual-boot data-recovery ntfs arduino
asked Jan 28 at 19:48
Dan CDan C
161
161
Are you not mounting with fstab? Back with XP, I used a shared data NTFS partition for Firefox & Thunderbird profiles and never had an issue. But always mounted with fstab. help.ubuntu.com/community/Fstab I do not like Disks as it may not use correct parameters. Better to use template/example and adjust for your specifics askubuntu.com/questions/164926/… & help.ubuntu.com/community/MountingWindowsPartitions
– oldfred
Jan 28 at 20:01
add a comment |
Are you not mounting with fstab? Back with XP, I used a shared data NTFS partition for Firefox & Thunderbird profiles and never had an issue. But always mounted with fstab. help.ubuntu.com/community/Fstab I do not like Disks as it may not use correct parameters. Better to use template/example and adjust for your specifics askubuntu.com/questions/164926/… & help.ubuntu.com/community/MountingWindowsPartitions
– oldfred
Jan 28 at 20:01
Are you not mounting with fstab? Back with XP, I used a shared data NTFS partition for Firefox & Thunderbird profiles and never had an issue. But always mounted with fstab. help.ubuntu.com/community/Fstab I do not like Disks as it may not use correct parameters. Better to use template/example and adjust for your specifics askubuntu.com/questions/164926/… & help.ubuntu.com/community/MountingWindowsPartitions
– oldfred
Jan 28 at 20:01
Are you not mounting with fstab? Back with XP, I used a shared data NTFS partition for Firefox & Thunderbird profiles and never had an issue. But always mounted with fstab. help.ubuntu.com/community/Fstab I do not like Disks as it may not use correct parameters. Better to use template/example and adjust for your specifics askubuntu.com/questions/164926/… & help.ubuntu.com/community/MountingWindowsPartitions
– oldfred
Jan 28 at 20:01
add a comment |
1 Answer
1
active
oldest
votes
two ways to do it:
From the CLI
first, run lsblk
and make a note of which partition you want to make read only. If you only have one drive, it will likely be /dev/sda#
where # is the number of your NTFS partition.
open up a terminal and run sudo nano /etc/fstab
. This will give you a file that looks something like this:
To make a drive read only here (let's assume your NTFS partiton is /dev/sda1) add a line to the bottom that says /dev/sda1 /mount/point/path auto ro 0 0
Once that's done, run sudo umount /dev/sda1
, then sudo mount /dev/sda1
, which will respectively unmount from your old options and remount with your new, read-only option.
From the GUI
Run the disks utility from the search menu, or run gnome-disks
from the CLI.
Select the device with the partition you want to make read-only, then click the gears beneath the "Volumes" section, and click "Edit mount options"
From here, simply add 'ro' to the end of the string beneath the "Symbolic Icon Name" field. You can also choose a mount point here other than the one the system designates.
Once that's done, simply unmount and remount your drive/partition from the previous screen, and you're done; no more accidental overwrites (unless you use dd
)
To remove the read only condition, you can either edit your /etc/fstab
file or pull up gnome-disks
again and remove the ro
; basically the same thing you just did, but in reverse.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1113614%2foverwrote-files-on-ntfs-partition-as-blank-how-to-prevent-in-the-future%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
two ways to do it:
From the CLI
first, run lsblk
and make a note of which partition you want to make read only. If you only have one drive, it will likely be /dev/sda#
where # is the number of your NTFS partition.
open up a terminal and run sudo nano /etc/fstab
. This will give you a file that looks something like this:
To make a drive read only here (let's assume your NTFS partiton is /dev/sda1) add a line to the bottom that says /dev/sda1 /mount/point/path auto ro 0 0
Once that's done, run sudo umount /dev/sda1
, then sudo mount /dev/sda1
, which will respectively unmount from your old options and remount with your new, read-only option.
From the GUI
Run the disks utility from the search menu, or run gnome-disks
from the CLI.
Select the device with the partition you want to make read-only, then click the gears beneath the "Volumes" section, and click "Edit mount options"
From here, simply add 'ro' to the end of the string beneath the "Symbolic Icon Name" field. You can also choose a mount point here other than the one the system designates.
Once that's done, simply unmount and remount your drive/partition from the previous screen, and you're done; no more accidental overwrites (unless you use dd
)
To remove the read only condition, you can either edit your /etc/fstab
file or pull up gnome-disks
again and remove the ro
; basically the same thing you just did, but in reverse.
add a comment |
two ways to do it:
From the CLI
first, run lsblk
and make a note of which partition you want to make read only. If you only have one drive, it will likely be /dev/sda#
where # is the number of your NTFS partition.
open up a terminal and run sudo nano /etc/fstab
. This will give you a file that looks something like this:
To make a drive read only here (let's assume your NTFS partiton is /dev/sda1) add a line to the bottom that says /dev/sda1 /mount/point/path auto ro 0 0
Once that's done, run sudo umount /dev/sda1
, then sudo mount /dev/sda1
, which will respectively unmount from your old options and remount with your new, read-only option.
From the GUI
Run the disks utility from the search menu, or run gnome-disks
from the CLI.
Select the device with the partition you want to make read-only, then click the gears beneath the "Volumes" section, and click "Edit mount options"
From here, simply add 'ro' to the end of the string beneath the "Symbolic Icon Name" field. You can also choose a mount point here other than the one the system designates.
Once that's done, simply unmount and remount your drive/partition from the previous screen, and you're done; no more accidental overwrites (unless you use dd
)
To remove the read only condition, you can either edit your /etc/fstab
file or pull up gnome-disks
again and remove the ro
; basically the same thing you just did, but in reverse.
add a comment |
two ways to do it:
From the CLI
first, run lsblk
and make a note of which partition you want to make read only. If you only have one drive, it will likely be /dev/sda#
where # is the number of your NTFS partition.
open up a terminal and run sudo nano /etc/fstab
. This will give you a file that looks something like this:
To make a drive read only here (let's assume your NTFS partiton is /dev/sda1) add a line to the bottom that says /dev/sda1 /mount/point/path auto ro 0 0
Once that's done, run sudo umount /dev/sda1
, then sudo mount /dev/sda1
, which will respectively unmount from your old options and remount with your new, read-only option.
From the GUI
Run the disks utility from the search menu, or run gnome-disks
from the CLI.
Select the device with the partition you want to make read-only, then click the gears beneath the "Volumes" section, and click "Edit mount options"
From here, simply add 'ro' to the end of the string beneath the "Symbolic Icon Name" field. You can also choose a mount point here other than the one the system designates.
Once that's done, simply unmount and remount your drive/partition from the previous screen, and you're done; no more accidental overwrites (unless you use dd
)
To remove the read only condition, you can either edit your /etc/fstab
file or pull up gnome-disks
again and remove the ro
; basically the same thing you just did, but in reverse.
two ways to do it:
From the CLI
first, run lsblk
and make a note of which partition you want to make read only. If you only have one drive, it will likely be /dev/sda#
where # is the number of your NTFS partition.
open up a terminal and run sudo nano /etc/fstab
. This will give you a file that looks something like this:
To make a drive read only here (let's assume your NTFS partiton is /dev/sda1) add a line to the bottom that says /dev/sda1 /mount/point/path auto ro 0 0
Once that's done, run sudo umount /dev/sda1
, then sudo mount /dev/sda1
, which will respectively unmount from your old options and remount with your new, read-only option.
From the GUI
Run the disks utility from the search menu, or run gnome-disks
from the CLI.
Select the device with the partition you want to make read-only, then click the gears beneath the "Volumes" section, and click "Edit mount options"
From here, simply add 'ro' to the end of the string beneath the "Symbolic Icon Name" field. You can also choose a mount point here other than the one the system designates.
Once that's done, simply unmount and remount your drive/partition from the previous screen, and you're done; no more accidental overwrites (unless you use dd
)
To remove the read only condition, you can either edit your /etc/fstab
file or pull up gnome-disks
again and remove the ro
; basically the same thing you just did, but in reverse.
answered Jan 29 at 2:29
MintyMinty
43817
43817
add a comment |
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1113614%2foverwrote-files-on-ntfs-partition-as-blank-how-to-prevent-in-the-future%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Are you not mounting with fstab? Back with XP, I used a shared data NTFS partition for Firefox & Thunderbird profiles and never had an issue. But always mounted with fstab. help.ubuntu.com/community/Fstab I do not like Disks as it may not use correct parameters. Better to use template/example and adjust for your specifics askubuntu.com/questions/164926/… & help.ubuntu.com/community/MountingWindowsPartitions
– oldfred
Jan 28 at 20:01