LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-08-2010, 02:27 PM   #1
Carsto
Member
 
Registered: Aug 2009
Posts: 97

Rep: Reputation: 17
fdisk questions (split off from hi-jacked thread)


Pixellany,

I always work as root in terminal. So it looks like this;

[root@condor ~]# fdisk /dev/sdd

Unable to open /dev/sdd

OK, so try:
[root@condor ~]# fdisk -l /dev/sdd
[root@condor ~]#

OK, so try:
[root@condor ~]# fdisk -l /dev/sd*

Which as expected gives my sda1 and sda2 partitions on sda.

Other information.
I used the fdisk, mkfs & fsck commands from my FC12 USB drive to reformat my hard disc because of the following situation. Previously I used a script to extend my hard disc transparently by my SD card. Before and after the format, this card shows an ext4, vfat & an ext3 volume. The ext4 holds the content of an FC12 boot disc which must have been transferred during an earlier installation to hard disc. The vfat volume shows a bog standard file system; Documents, Downloads et al. I use Dolphin for file management.

The ext3 volume gives an error;
org.freedesktop.Hal.Device.Volume.UnknownFailure:
mount: /dev/mmcblk0 already mounted or media/disk-2 busy.

Are there any other commands I can try?
 
Old 02-08-2010, 02:53 PM   #2
Carsto
Member
 
Registered: Aug 2009
Posts: 97

Original Poster
Rep: Reputation: 17
DD command

Just remembered I saw something on the dd command this morning.

Tried dd if= /dev/zero of= /dev/sdd bs=4k conv=notrunc
but got an error unrecognized operand ' /dev/zero'.

Can I make a KWord file with zeroes, say 512 as the default size goes and use it in that command line? I'm brushing up on hex editors. I suspect I'd then be able to use something like /root/hex/file.bin instead of /dev/zero
 
Old 02-08-2010, 10:33 PM   #3
sumeet inani
Member
 
Registered: Oct 2008
Posts: 908
Blog Entries: 26

Rep: Reputation: 49
Quote:
Originally Posted by Carsto View Post
Tried dd if= /dev/zero of= /dev/sdd bs=4k conv=notrunc
but got an error unrecognized operand ' /dev/zero'.
I think there should be no space after if=
That is if=/dev/zero

(1)Also difference between /dev/null & /dev/zero is that you can keep on reading zeroes from /dev/zero but you get nothing from /dev/null.Thus /dev/null useless to create file of specific size (not zero). Though you can dump outputs to either .
(2)You can create zero byte files using
Code:
$cat /dev/null > FILE
$touch FILE #provided file does not exist
(3)Beware of
Code:
$cat /dev/zero > FILE
This will take away all space on disk because file is being filled with unending stream of zeroes.

If you find this helpful then thank me by pressing thumbs up button.Thank You.

Last edited by sumeet inani; 02-08-2010 at 11:05 PM.
 
1 members found this post helpful.
Old 02-08-2010, 10:37 PM   #4
damgar
Senior Member
 
Registered: Sep 2009
Location: dallas, tx
Distribution: Slackware - current multilib/gsb Arch
Posts: 1,949
Blog Entries: 8

Rep: Reputation: 203Reputation: 203Reputation: 203
No space after if=

Quote:
dd if=/dev/cdrom of=/home/sam/myCD.iso bs=2048 conv=sync,notrunc
 
1 members found this post helpful.
Old 02-08-2010, 11:41 PM   #5
sumeet inani
Member
 
Registered: Oct 2008
Posts: 908
Blog Entries: 26

Rep: Reputation: 49
to damgar
Why do you include notrunc option if we are creating iso image for first time.I think notrunc is used when output file already exists & you want to replace its bytes but not drop those beyond the range of command given.
 
1 members found this post helpful.
Old 02-09-2010, 06:44 AM   #6
Carsto
Member
 
Registered: Aug 2009
Posts: 97

Original Poster
Rep: Reputation: 17
Right both counts.

Thank you, I'll try it. Can report; however; that I did look closely to copy type the line correctly. Should've remembered that terminal does not use spaces that much.

dd --help says exactly what you do on notrunc.
 
Old 02-09-2010, 07:33 AM   #7
damgar
Senior Member
 
Registered: Sep 2009
Location: dallas, tx
Distribution: Slackware - current multilib/gsb Arch
Posts: 1,949
Blog Entries: 8

Rep: Reputation: 203Reputation: 203Reputation: 203
Quote:
Originally Posted by sumeet inani View Post
to damgar
Why do you include notrunc option if we are creating iso image for first time.I think notrunc is used when output file already exists & you want to replace its bytes but not drop those beyond the range of command given.
You'll see that the line is wrapped in quote rather than code tags. It was intended as an example of form taken fromi the dd wiki to answer the question immediately preceding my post, rather than as a specific answer to the original question.

I apologzie for any confusion.
 
1 members found this post helpful.
Old 02-09-2010, 11:47 PM   #8
Carsto
Member
 
Registered: Aug 2009
Posts: 97

Original Poster
Rep: Reputation: 17
damgar,

I did think that might have been your idea, yet it did confuse me somewhat. Then again, as a real example it can be useful and indeed it did show me another use of the command.

Thank you for trying to help, you did.
 
Old 02-10-2010, 07:22 AM   #9
damgar
Senior Member
 
Registered: Sep 2009
Location: dallas, tx
Distribution: Slackware - current multilib/gsb Arch
Posts: 1,949
Blog Entries: 8

Rep: Reputation: 203Reputation: 203Reputation: 203
Gladly
 
Old 02-11-2010, 02:33 AM   #10
Carsto
Member
 
Registered: Aug 2009
Posts: 97

Original Poster
Rep: Reputation: 17
sumeet,

Thank you the edit worked, but I'm now getting other stuff. The correct reaction comes from the terminal as checked against this thread;

http://www.linuxquestions.org/questi...ommand-362506/

Got it in a LinuxForums thread on how to erase the hard disc completely.

Done by AweSomeMachine, it really rocks, very well done.

The other stuff; dd reports that my sdb SD card is erased, yet in Dolphin I can still access it. This is weird (it seems Fedora remembers the fie systems once they're on, could this be the ext4 journalling?) Also I got the LVM "partition" system back after re-doing my hard disc with fdisk and company. Fedora 12 only allowed ext4 fs on sda2, sda1 is ext2. The card is also LVM. I read in other threads that LVM can throw problems. Maybe like this.

Anyway, there quite a few things I'll have to check out before I come back again.

Maybe you can give me ideas on where to look how to get rid of the LVM thing. Seems this could be really dangerous, not so much data - none anyway - more like destroying the disc itself.
 
Old 02-11-2010, 03:01 AM   #11
Carsto
Member
 
Registered: Aug 2009
Posts: 97

Original Poster
Rep: Reputation: 17
sumeet,

Thanks, the edit worked but I'm getting other weird stuff. It seems Fedora may be the reason, but I'll have to check out quite a lot of things before I can come back to you.

Any ideas on how to get rid of the Logical Volume Management (LVM) file/"partition" system? This persists and it seems Fedora remembers old, useless data. Re-did the disc with fdisk et al, sda1 is ext2, OK, but sda2 will only accept ext4.
 
Old 02-13-2010, 02:06 AM   #12
sumeet inani
Member
 
Registered: Oct 2008
Posts: 908
Blog Entries: 26

Rep: Reputation: 49
Frankly I don't know much.
But if you want to partition a disk you can use gparted

#yum install gparted #for rpm based distros
#apt-get install gparted #for debian based

In the gparted GUI.Select Device > Set disklabel for the device you wish to erase completely(Be careful to check selected device at top right).Also you can check your /etc/fstab file to see whether there is an entry for your external device if yes then comment it so that your OS tries to detect file system and mount it at appropriate location.I will suggest that before running any script understand its meaning as another senior member http://www.linuxquestions.org/user/agrouf-202383/ says.
 
1 members found this post helpful.
Old 02-15-2010, 04:57 AM   #13
Carsto
Member
 
Registered: Aug 2009
Posts: 97

Original Poster
Rep: Reputation: 17
sumeet,

Thanks for your continued patience with me. One thing I'd like to know is whether only heads of files or partitions are cut off or marked as deleted as in databases where the records are deleted by batch process? I've seen this in file systems even before Windows 1.3. IBM AT's,XT's and, if I'm correct, the Amiga as well.

Reason for this is the NB's different reaction after every remedy I try. The latest is that I'm getting installation errors in Java Runtime Environment after answering 'yes' [A]ll to delete files before re-installing them. There are also other apps that show non-perfect behaviour. Samegame under Games > Tactical has an array 15x10 of balls to delete. Horizontal and vertically adjacent balls are marked to be deleted on click. Score = (Balls marked-1)squared added into running total. After the third re-install of FC12 neither the marked or running total is shown in the game, yet at the end your total is shown and tabulated on the highest score board.

In the beginning I had a battle with getting my Motorola Razr V3 to connect for a net link. After many dialogs and resettings later, I plugged it in out of habit and there it was, like Start Menu; "Automatic Mobile Broadband connected". Scout's honour, I didn't touch it.

Oh yes, the widgets also moved from the Panel's widget adding dialog to the main menu. Huh??
Yes, it was eye-popping. Hence the scorched earth tactics. Moved past it, other fish to fry.

I don't mind Fedora remembering things in an effort to be "context sensitive", but in this case it ain't workin'.

OK, so, will Gparted "make" Fedora 12 not use it's own re-initialization routine? It seems I need to get rid of the Logical Volume Management scheme. How do I do that? How do I get Fedora 12 to not force certain files systems on me?
 
Old 02-16-2010, 02:55 AM   #14
sumeet inani
Member
 
Registered: Oct 2008
Posts: 908
Blog Entries: 26

Rep: Reputation: 49
I think
(1)when you delete files in file system the entry of its starting address is deleted from file allocation table normally (if you use 'rm' command or gui with shift+delete).
(2)You can use use 'shred' command to delete as well overwrite the data so no recovery possible.
(3)Usually file is allocated a cluster of sector (called blocksize) when it is created & if data exceeds 1 unit(blocksize) then there are pointers to next part stored in another block.This is a general idea.In unix there are inodes which are structure data type variable.Deletion involves reducing link count & 0 means that location can be overwritten.
(4)Fedora 12 uses ext4 partition.If you can afford to reinstall then boot using live cd or live USB and use partition editor to delete your previous boot,home & root partitions (hope you have stored your document,music,video etc in safe place) . During installation process you can go manual to decide which partition to use as what (you need a root & swap atleast). This will be start from scratch.
Good luck

Last edited by sumeet inani; 02-16-2010 at 03:04 AM.
 
1 members found this post helpful.
Old 02-17-2010, 03:49 AM   #15
Carsto
Member
 
Registered: Aug 2009
Posts: 97

Original Poster
Rep: Reputation: 17
Thanks, your point 4 is exactly what I did. But it seems there is another problem. I used a script from macles' site to extend my sda memory transparently from 8GB to 12GB with an SD card, sdd. This worked, but ...

Just did this;
NB off. Plug in USB stick. Plug out SD card. Boot. Click on Device Notifier (DN) in Panel.
DN; USB icon. Volume (vfat).

Ok, plug in SD card to see if I can pick things out.
DN; SD icon. Volume (vfat). Click opens Dolphin FM: .Volume (vfat). Content Correct.
SD icon. Volume (ext4). Click opens Dolphin FM: .Volume (ext4). Live USB content.
SD icon. Volume (ext3). Click opens Dolphin FM: .Home > Documents. Content Correct.
USB icon. Volume (vfat). Click opens Dolphin FM: .Root > media > disk. Content Correct.

Clicking on Volume (ext4) is done last because it makes the USB stick disappear. I now see that the two vfats must be the same thing. (Dolphin remains open as shown here). But, how the ext3 becomes my Home file beats me. Dolphin & Terminal shows same content. (FC12 - ext4, no?) Also where the Live USB content comes from for the ext4 is a mystery. Big but; there is no other USB plugged in!! This is constant, seen many times - very confusing.

I tried DD command on the SD card but it does not work. Some protection on the card.

OK, this is just to let you know. I will just have to get stuck into it and solve it. Thanks for taking interest in it.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
The answers without questions thread.... cyent Linux - Software 5 12-23-2008 05:24 PM
Split out from "Awesome machines" dd thread in Newbie AwesomeMachine General 18 08-27-2008 09:06 AM
fdisk, parted questions? darkleaf Linux - Software 2 10-14-2004 04:07 AM
Linux Thread Questions and Problems esi-eric Linux - Software 1 07-28-2004 12:21 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:42 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration