Make a disk disappear from fdisk output


 
Thread Tools Search this Thread
Operating Systems Linux Red Hat Make a disk disappear from fdisk output
# 1  
Old 09-29-2014
RedHat Make a disk disappear from fdisk output

Hello,

1 ) Fdisk -l # Displays all the disk with partition table information

My Query )

A ) How can i make one disk ex: /dev/sdd not visible in fdisk -l output ?
B) From where fdisk -l collect and display the information ?

Last edited by saurabh84g; 09-29-2014 at 02:51 PM.. Reason: Spell Correction
# 2  
Old 09-29-2014
Try:

Code:
fdisk -l | awk '$0!~s "[0-9:]"' s=/dev/sdd RS= ORS='\n\n'

This User Gave Thanks to Scrutinizer For This Post:
# 3  
Old 09-29-2014
Thanks.. :-)

What if we do not have use awk. I am looking at as

Suppose a disk /dev/sdd is gone faulty and we do not want this disk to be visible ...isnt there is somewhere we can blacklist kinda do for this disk....so, that whoever is firing fdisk -l does not have to remember the faulty disk name ???
# 4  
Old 09-29-2014
If you well and truly don't want anything to touch that disk, you could remove the device file...
# 5  
Old 09-29-2014
Quote:
Originally Posted by saurabh84g
Thanks.. :-)

What if we do not have use awk. I am looking at as

Suppose a disk /dev/sdd is gone faulty and we do not want this disk to be visible ...isnt there is somewhere we can blacklist kinda do for this disk....so, that whoever is firing fdisk -l does not have to remember the faulty disk name ???
Temporarily (until next boot) remove disk sdd from system
Code:
echo 1 > /sys/block/sdd/device/delete

If you want to add disk sdd back to the system without reboot you must know the host number BEFORE removing it, which the following command will do.
Code:
 readlink /sys/block/sdd

The red part is what you need:
Code:
../devices/pci0000:00/0000:00:10.0/host2/target2:0:3/2:0:3:0/block/sdd

Knowing that you can re-enable that disk executing:

Code:
echo "- - -" > /sys/class/scsi_host/host2/scan

This User Gave Thanks to Aia For This Post:
# 6  
Old 09-30-2014
Thanks everyone. This question was asked to me and my answers was to remove. However, i was specifically asked - We dont want to see the disk in fdisk output. I will keep searching and will post when i find it.
# 7  
Old 09-30-2014
Quote:
Originally Posted by saurabh84g
Thanks everyone. This question was asked to me and my answers was to remove. However, i was specifically asked - We dont want to see the disk in fdisk output. I will keep searching and will post when i find it.
Is this one of those question asked in an interview where the interviewer must resort to "witty" and "tricks" instead of realistic questions that might concern the actual position?

A possible answer to such a BS question is that you specify the devices as parameters to list and it will not show the one you don't want. Otherwise, fdisk -l will use the content of /proc/partitions as devices to show you partition information.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Use of awk/sed to filter out fdisk output

Hi , I am trying to filter out the below output of fdisk -l command : fdisk -l Disk /dev/sda: 42.9 GB, 42949672960 bytes 255 heads, 63 sectors/track, 5221 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sda1 ... (9 Replies)
Discussion started by: omkar.jadhav
9 Replies

2. Red Hat

Fdisk reports the old size after disk resize

Hi, I'm running a Red Hat Enterprise Linux Server release 5.3 (Tikanga) on VMWare. It is a production system for which I may not get downtime soon. I happened to resize a underlying disk and the changes are not reflecting in the fdisk ouput. Further details are as follows. The disk which i... (3 Replies)
Discussion started by: maverick_here
3 Replies

3. UNIX for Dummies Questions & Answers

How can we identify SAN devices in fdisk -l output.?

We can Know the storage devices in fdisk -l. But Please tell me how can i identify the SAN devices :wall: How SAN devices are represented in the fdisk -l output :wall::wall: Thanks in Advance........:D (3 Replies)
Discussion started by: vamshigvk475
3 Replies

4. BSD

OpenBSD fdisk - Linux fdisk compatibility ?

Hello, MBR partition table made by linux fdisk looks certainly not correct when printed by openbsd fdisk: Partition table created on linux (centos 6.3): # fdisk -l /dev/sdc Disk /dev/sdc: 10.7 GB, 10737418240 bytes 255 heads, 63 sectors/track, 1305 cylinders Units = cylinders of 16065 *... (2 Replies)
Discussion started by: vilius
2 Replies

5. UNIX for Dummies Questions & Answers

add disk redhat, fdisk -l doesn't work

i'm trying to add disk to red hat , use fdisk -l but it doesn't recognize it what should i do it to get it works? (3 Replies)
Discussion started by: prpkrk
3 Replies

6. Solaris

Fdisk partitions on boot disk and disaster recovery

I'm preparing to recover a Oracle Fire X4170 server in a disaster recovery test at a different location than in prod. I have some questions about fdisk partitions. I'm using Solaris 10 update 10. On my prod server, the boot disk has 2 partitions, diagnostic and solaris. Is the diagnostic... (1 Reply)
Discussion started by: TKD
1 Replies

7. Solaris

How to make sure that a disk is not used?

Hi, I want to make sure a local disk c1t1d0s2 is not being used. SVM and VxVM are used on this Solaris 10 systems. This disk can not be found using 'df -k', 'metastat' and 'vxprint -ht'. But I can't mount it though format shows it contains ufs filesystem: # mount /dev/dsk/c1t1d0s0 /mnt Aug 18... (5 Replies)
Discussion started by: aixlover
5 Replies

8. Shell Programming and Scripting

Make the typed text disappear...

Hi all... I-m quite a new user of UNIX and i was trying to write a simple program and my problem is the following:how can i make a typed letter disappear (as we see in the MORE command, when we type <space>, b, q etc...) i know that for typing some text that has to be read it's used the structure:... (0 Replies)
Discussion started by: Cellofan
0 Replies

9. Shell Programming and Scripting

how to make a line BLINKING in output and also how to increase font size in output

how to make a line BLINKING in output and also how to increase font size in output suppose in run a.sh script inside echo "hello world " i want that this should blink in the output and also the font size of hello world should be big .. could you please help me out in this (3 Replies)
Discussion started by: mail2sant
3 Replies

10. UNIX for Dummies Questions & Answers

how to make a boot disk

I need to know how to make a boot disk to get Solaris 7 to load on a intel machine. I have checked out Sun.Com, but did not understand how to download and convert the files to a disk. any help would be appericated thanks Bobby (2 Replies)
Discussion started by: Youngadmin
2 Replies
Login or Register to Ask a Question

Featured Tech Videos