LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Hiding ntfs partition in linux (https://www.linuxquestions.org/questions/linux-newbie-8/hiding-ntfs-partition-in-linux-739030/)

Kap1234 07-09-2009 06:09 PM

Hiding ntfs partition in linux
 
I need to hide a ntfs partition in linux (from boot dvd opensuse if it matters). Is it possible?
And another question: when i used fdisk from linux boot dvd, and divided my hdd space into partitions, counting the exact space each partition will have, i allocated 10GB to one of them. But when i booted from windows boot cd it show 9.3, why is that?? Have i done something wrong allocating using fdisk?

i92guboj 07-09-2009 06:38 PM

Quote:

Originally Posted by Kap1234 (Post 3602703)
I need to hide a ntfs partition in linux (from boot dvd opensuse if it matters). Is it possible?

It depends on what do you mean. If you mean being unable to see the ntfs partition from *any* arbitrary livecd you want to use, that's impossible. The hardware is there, the OS just needs to find a suitable device driver for it and as long as there's a driver the fs can be seen.

If you mean to disable it for a given installation you just need to make sure that the ntfs driver is not loaded in your concrete linux distribution.

Note that even without a driver, the partition and the device node will be accessible by tools like fdisk, and the device node will be present in /dev/, you just won't be able to mount the volume and access its contents with normal methods.

What you ask for would required some kind of unification between the firmware of your hardware and the multiple OSes you use. There's currently no way that your hardware will present a certain info to a given OS and a completely different info to another given OS... To start with, your hardware doesn't even know what an OS is.

Quote:

And another question: when i used fdisk from linux boot dvd, and divided my hdd space into partitions, counting the exact space each partition will have, i allocated 10GB to one of them. But when i booted from windows boot cd it show 9.3, why is that?? Have i done something wrong allocating using fdisk?
In the international magnitude system, a Giga is 1000 Mega, and a Mega 1000 Kilo, and a Kilo, 1000 units.

Someone thought one day that just because it's convenient for computers, a Giga for us would better be 1024, and so on.

So your disk is perfectly fine, it just depends on how you count the bytes. To avoid confusion people seem to use "GB", "MB" and so on for 1024 multiples, and "GiB", "MiB" for international system units, multiples of 1000.

chrism01 07-09-2009 08:43 PM

Re MB vs MiB etc; actually, its the other way around: http://en.wikipedia.org/wiki/Gibibyte

i92guboj 07-09-2009 08:51 PM

Thanks for the correction ;)

Tinkster 07-09-2009 09:21 PM

Quote:

Originally Posted by i92guboj (Post 3602719)
It depends on what do you mean. If you mean being unable to see the ntfs partition from *any* arbitrary livecd you want to use, that's impossible. The hardware is there, the OS just needs to find a suitable device driver for it and as long as there's a driver the fs can be seen.

Well ... there *is* a way.

You just need to delete the partition (make sure you backup
the original record). It can be re-created with the same
boundaries and just spring back to life.

That said: this only hides it from the higher level tools,
with dd or other low-level tools (or a utility that restores
partition tables) anyone can still get to it.

And the risk of course is that one accidentally *reclaims* the
free space with a new partition and/or file-system. ;}




Cheers,
Tink

i92guboj 07-09-2009 09:32 PM

Well, that's certainly possible.

However, it would help to know what exactly the purpose of this is. If what he wants is to hide the ntfs so it's not harmed accidentally while installing or testing linux distros, then this will definitely not help (in fact, it can only be worse unless you know exactly what portion of the unallocated space can or can't be used.

If what he wants is to avoid the windows partition being automounted, then either fstab or udev are the places to look into, that, or disable ntfs completely at kernel level as I said.

jefro 07-09-2009 10:09 PM

Wonder if gdisk would suit your requirement. As above anyone with access and or admin can un-hide.

i92guboj 07-09-2009 10:28 PM

Quote:

Originally Posted by jefro (Post 3602850)
Wonder if gdisk would suit your requirement. As above anyone with access and or admin can un-hide.

If you are speaking about the partition type byte, that's broadly irrelevant. Linux doesn't care about it, and it's just a byte, nothing else. Linux will mount the partitions based on the fs that there's inside, just change the partition types in fdisk for all your partitions and see how they are ignored by linux.

Cloaking a partition, physically, is just impossible. The hardware doesn't understand about partitions at all in first place. It's just some arbitrary layout that has been established by convention and most OSes agree with, but not necessarily (linux can work on an unpartitioned disk, and bsd's and other unixes use different schemes with slices and whatever else).

You can change, that silly byte, you can erase it, you can be creative and use all kind of tricks, but you can't say your hardware not to show a given partition because the hardware doesn't even know what a partition is, and since the hardware shows it, your OS sees it, there's no way around that, that is, unless your OS chooses to ignore partitions of a given type.

Even in windows, any partitioning tool will show you all what there's to see, even the so-called hidden partitions. In linux, you will see the device nodes under /dev/ regardless of how your partition is marked.

Kap1234 07-10-2009 12:56 AM

No, sorry all for misunderstanding, i meant booting from opensuse dvd, using the rescue system option(i just thought some options may not work from there), i need to create a ntfs partition as sda1, hide it before installing windows, then install windows on sda2. I have formatted my hdd, and destroyed the recovery partition used by samsung recovery solution, so I want to somehow recreate it, though I've read its not possible this way, but i want to try. Also, about the capacity question, i have formatted the partition in linux using fdisk, selecting exactly +10Gb(not G which means gigibyte) so why would windows show 9.3Gb or it showa it in Gib??

i92guboj 07-10-2009 01:10 AM

Quote:

Originally Posted by Kap1234 (Post 3602950)
No, sorry all for misunderstanding, i meant booting from opensuse dvd, using the rescue system option(i just thought some options may not work from there), i need to create a ntfs partition as sda1, hide it before installing windows, then install windows on sda2. I have formatted my hdd, and destroyed the recovery partition used by samsung recovery solution, so I want to somehow recreate it, though I've read its not possible this way, but i want to try.

It still escapes me the purpose of this all. When installing windows you can choose which partition to use to install it. What's the purpose behind "hiding" it?

I know for sure that windows *will* break if the ordering of the partitions change (i.e. you install it in sda1 but then sda1 becomes sda2 for some obscure game you played with partitions). So beware of that.

Quote:

Also, about the capacity question, i have formatted the partition in linux using fdisk, selecting exactly +10Gb(not G which means gigibyte) so why would windows show 9.3Gb or it showa it in Gib??
That you used a given unit to create the drive doesn't mean that all the programs you are using to get its capacity are going to use that same unit. The total amount of bytes should always be the same though.

Also, strictly speaking, you "created" it with fdisk, you "formatted" it with anything else (the windows installer, mkfs or whatever).

Kap1234 07-10-2009 03:24 AM

1)Alright, if you want to understand the purpose, I'll start over. I have samsung notebook q310 that has program called samsung recovery solution 3. It uses a special hidden ntfs partition to store backup image that later can be used to fully recover drive C: with all programs and windows vista itself, that was /dev/sda1 before i zeroed my hdd. Now i want to recreate it on my blank hdd and hide it before installing windows on sda2. Will this gdisk help me? Or is it sufficient enough to just enter fdisk in linux, and change sda1 id to hidden ntfs/hpfs??
2) Quote: "That you used a given unit to create the drive doesn't mean that all the programs you are using to get its capacity are going to use that same unit. The total amount of bytes should always be the same though." Alright I found out that windows really shows capacity in GiB, but i still don't understand something, if I have 250GB=250000mb, even if it's ~250GB, and i divide it by 1024, it will be ~244, and windows shows 232.9, Can someone explain my this trivial :(.

i92guboj 07-10-2009 03:38 AM

Quote:

Originally Posted by Kap1234 (Post 3603051)
1)Alright, if you want to understand the purpose, I'll start over. I have samsung notebook q310 that has program called samsung recovery solution 3. It uses a special hidden ntfs partition to store backup image that later can be used to fully recover drive C: with all programs and windows vista itself, that was /dev/sda1 before i zeroed my hdd. Now i want to recreate it on my blank hdd and hide it before installing windows on sda2. Will this gdisk help me? Or is it sufficient enough to just enter fdisk in linux, and change sda1 id to hidden ntfs/hpfs??

You can change it to hidden of whatever you want. The main point here is that you need to install your OS to sda2. Both the linux and the windows installers will allow you do do that, regardless of the status of the first partition.

What escapes me still is why do you need (or why do you think you need) sda1 to have any special "hidden" status. However, I am no specialist in Windows, maybe something basic is escaping my understanding.

Quote:

if I have 250GB=250000mb, even if it's ~250GB, and i divide it by 1024, it will be ~244, and windows shows 232.9, Can someone explain my this trivial :(.
Your maths are still a bit fuzzy, 250,000,000,000 bytes we have. If we count in multiples of 1024, they *aren't* 250000mb. If we use 1024 as the unit, we must use it for all the conversions, and not just one of them. So, 250,000,000,000 bytes are:
  • 244,140,625 kilobytes
  • 238,418 megabytes
  • 232 gigabytes

250,000,000,000/1,024/1,024/1,024

Kap1234 07-10-2009 02:51 PM

Quote:

Originally Posted by i92guboj (Post 3603057)
Your maths are still a bit fuzzy, 250,000,000,000 bytes we have. If we count in multiples of 1024, they *aren't* 250000mb. If we use 1024 as the unit, we must use it for all the conversions, and not just one of them. So, 250,000,000,000 bytes are:
  • 244,140,625 kilobytes
  • 238,418 megabytes
  • 232 gigabytes

250,000,000,000/1,024/1,024/1,024

Right, haven't slept whole night so was really silly :).
I'm trying to format my hdd using fdisk now. So to make sure everything works fine a found a manual at http://www.ehow.com/how_1000631_hard-drive-linux.html. It is made for ext file system so i have little troubles. I want to install windows first, make sure everything works, then install linux. So using fdisk i made few ntfs partitions using this manual, formatted them using mkntfs command, now it says i need to check those partitions and write them into fstab so they would mount, all of these can be done with fsck command, but it doesn't work for ntfs. I found out that i can check my ntfs using ntfsresize -fi /dev/sdaXY (check this please so i wont do anything wrong). But how do i mount them? And do i really need that for ntfs??

i92guboj 07-10-2009 03:07 PM

Quote:

Originally Posted by Kap1234 (Post 3603686)
I want to install windows first, make sure everything works, then install linux.

That's usually the best option.

Quote:

So using fdisk i made few ntfs partitions using this manual, formatted them using mkntfs command, now it says i need to check those partitions and write them into fstab so they would mount
To check the partition you usually would use fsck, but I have no idea if there's a working fsck version for ntfs. In any case, and before continuing, and for the sake of accuracy on my answers, what driver for ntfs are you using. There are two (at least), the in-kernel one, called ntfs, and a 3rd party one called ntfs-3g. The former provides only with read support (and an useless and very limited write support only). The later provides full r/w support.

So I have no idea what the correct way to check an ntfs volume on linux would be.

So, are you using ntfs or ntfs-3g?

Quote:

But how do i mount them? And do i really need that for ntfs??
I will answer this after you tell me what driver are you going to use for ntfs. If you still don't know, decide based on what kind of support do you need (read/write versus read-only).

Kap1234 07-10-2009 03:31 PM

Quote:

In any case, and before continuing, and for the sake of accuracy on my answers, what driver for ntfs are you using.
Opensuse website answers that very clearly:
"Note: To prevent damage to file system, the NTFS partition that has errors will be always mounted as read only.
To correct this you should boot Windows® and run file system repair program. Repair is not yet possible from Linux.
Seems like the ntfsresize will only check for errors but wont repair anything. I wonder if i have to check at all? I have just formatted, is there any chance of error?(guess yes :( )

Version:
11.0 For openSUSE 11.0, ntfs-3g is installed by default and write support is enabled for root only..
By default, only root user can write on NTFS partition. Modify /etc/fstab to reflect dmask=002 to enable user writing."

So now i only need to know how to mount, as it seems anyway I will have to boot from windows bootdvd.


*About ntfsresize, it is said to use options -fi, and that goes as
-i, --info
By using this option ntfsresize will determine the theoretically smallest shrunken filesystem size supported. Most of the time the result is the space already used on the filesystem. Ntfsresize will refuse shrinking to a smaller size than what you got by this option and depending on several factors it might be unable to shrink very close to this theoretical size. Although the integrity of your data should be never in risk, it's still strongly recommended to make a test run by using the --no-action option before real resizing.

Practically the smallest shrunken size generally is at around "used space" + (20-200 MB). Please also take into account that Windows might need about 50-100 MB free space left to boot safely.

This option never causes any changes to the filesystem, the partition is opened read-only.

-f, --force
Forces ntfsresize to proceed with the resize operation even if the filesystem is marked for consistency check.
Please note, ntfsresize always marks the filesystem for consistency check before a real resize operation and it leaves that way for extra safety. Thus if NTFS was marked by ntfsresize then it's safe to use this option. If you need to resize several times without booting into Windows between each resizing steps then you must use this option.

Resizing this way is the same as error repair? =/
What is actually being repaired? bad blocks? Can i use bad blocks command instead?


All times are GMT -5. The time now is 10:07 AM.