Sponsored Content
Top Forums UNIX for Dummies Questions & Answers How to scrub directory only if on own partition/drive? Post 302737721 by bakunin on Thursday 29th of November 2012 12:21:56 PM
Old 11-29-2012
Wiping a disk is probably better done on the disk level, not the filesystem level. Write some stuff (random, just zeroes or just ones) at the disk device instead of the mount point.

If you still want to go with your procedure you can use the "mount" command to find out where the filesystems are mounted. It always looks a little different from system to system, so there is no general line i could give you, but surely you can figure out some parsing schema once you see it. A simple way to read a tablelike output would be (replace "<b>" and "<t>" with literal blanks/tabs when you write it):

Code:
mount | sed 's/[<b><t>][<b><t>]*/<b>/g' | while read var1 var2 var3 ... ; do
     <whatever you want to do with the filesystems here>
done

I hope this helps.

bakunin
 

10 More Discussions You Might Find Interesting

1. Filesystems, Disks and Memory

Question About Drive Partition

I'm using PartitionMagic's wizard to partition my drive for Linux, and after I get past the first step it asks if I want to screate a seperate Linux Swap Partition. What is a Linux Swap Partition and is something I need/should have? (10 Replies)
Discussion started by: Tradewynd
10 Replies

2. UNIX for Dummies Questions & Answers

Partition Hard drive

Hello everyone. I am new to Linux so hope some one could help me here. I have a 30 Gb HD and windows Xp is my O/S, HD is not partitioned,but I want to Partitioned it, so I could Install Knoppix(Linux)on one of the partitioned one, how could I do this? OR should I erase every thing and then... (1 Reply)
Discussion started by: amir
1 Replies

3. Filesystems, Disks and Memory

Dead partition on drive

We are still using solaris 1 with sunos 4.1.4 because nobody here knows Unix. My colleague did a backup (dump) to the wrong place (/dev/sd0h) and we lost this part of the drive. The information is still on tape but we cannot repartition the /dev/sd0h. fsck keeps on about the "wrong SUPER BLOCK"... (2 Replies)
Discussion started by: Tom Bekaert
2 Replies

4. AIX

Mounting Tape Drive from different partition

Dear all, I have a AIX server with logical 3 partitions and the server is connecting a tape drive. the first partition can successfully making a system backup to the tape but how can i fail to mount the tape to second and thrid partition. would anyone can help me to deal with it? what command... (3 Replies)
Discussion started by: rickhlwong
3 Replies

5. Solaris

Solaris 10: Problems booting off mirror drive -- Error 22: No such partition

Solaris 10 5/08 on Ultra 40 M2 It boots fine off primary disk but having issues booting off the mirror disk. I get this error when booting off mirror disk: Booting 'Solaris 10 ... Mirror disk' root (hd1,0,a) Error 22: No such partition Press any key to continue... Any... (7 Replies)
Discussion started by: etc
7 Replies

6. UNIX for Advanced & Expert Users

Duplicate directory in same partition help.

Hi, I have found a directory on my web server that have 2 same directory names in the same location on the same partition. Is there a way to mkdir a name twice and be able to see them both in the same location? Heres an example of the ouput: # ls access_log.1.bkup ... (10 Replies)
Discussion started by: maiku09
10 Replies

7. OS X (Apple)

How to access a NTFS partition on hard drive through Terminal in OSX ?

Hi , I have a Mac OS X Lion mac book pro. I have a hard drive which I have partitioned in two (a) OSX Partition - Mac OS Extended Journaled format. Mount point: / (b) Data Partition - Windows NT Filesystem format. Mount point: /Volumes/Data I need to access the NTFS partition (I have a... (6 Replies)
Discussion started by: neil.k
6 Replies

8. Solaris

Solaris11: Permission issues with auto-scrub ZFS pool

Short version: pfexec zpool scrub rpool fails saying I do not have permission to perform that action. Apparently scrub is not one of the pfexec allowed actions. Any idea on how to get around it? Long version: I got tired of manually running scrubs and am trying to set it to happen... (4 Replies)
Discussion started by: taltamir
4 Replies

9. Shell Programming and Scripting

Python regular expression screen scrub

Hi I am trying to write a python script that executes a command to screen scrub results below I will appreciate it very much if you can help me with a python script that can pick the percentage USAGE in the second column based on the supplied queue number in the first column import re... (0 Replies)
Discussion started by: kaf3773
0 Replies

10. Solaris

Zpool status shows scrub date of Dec 31, 1969

hello, We are using Solaris 11.3 on SPARC T5-2. The below is the actual output from "zpool status" command. The disks were scrubed last week, but it says the scrub repaired on Dec 31, 1969. Does anyone know how to correct this to report the correct date? Thanks pool: rpool state:... (5 Replies)
Discussion started by: jasonu
5 Replies
HFORMAT(1)						      General Commands Manual							HFORMAT(1)

NAME
hformat - create a new HFS filesystem and make it current SYNOPSIS
hformat [-f] [-l label] destination-path [partition-no] DESCRIPTION
hformat is used to write a new HFS filesystem to a volume. A UNIX pathname to the volume's destination must be specified. The destination may be either a block device or a regular file, but it must already exist and be writable. An optional label can be specified to name the volume. The name must be between 1-27 characters and cannot contain a colon (:). By default, the volume will be named Untitled. If the destination medium is partitioned, one partition must be selected to receive the filesystem. If there is only one HFS partition on the medium, it will be selected by default. Otherwise, the desired partition number must be specified (as the ordinal nth HFS partition) on the command-line. The size of the partition determines the size of the resulting volume. Partition number 0 can be specified to format the entire medium as a single filesystem without a partition map, erasing any existing parti- tion information. Since this will destroy all the partitions, the -f option must be specified to force this operation if the medium cur- rently contains a partition map. If the medium is not partitioned (or if partition 0 is specified), the size or capacity of the medium determines the size of the resulting volume. The new volume will be empty and will become "current" so subsequent commands will refer to it. The current working directory for the vol- ume is set to the root of the volume. EXAMPLES
% hformat /dev/fd0 If a floppy disk is available as /dev/fd0, this formats the disk as an HFS volume named Untitled. (N.B. The floppy must already have received a low-level format by other means.) % dd if=/dev/zero of=disk.hfs bs=1k count=800 % hformat -l "Test Disk" disk.hfs This sequence creates an 800K HFS volume image in the file disk.hfs in the current directory, and names it Test Disk. % hformat -l "Loma Prieta" /dev/sd2 1 If a SCSI disk is available as /dev/sd2, this initializes the first HFS partition on the disk (which must already exist) with a new filesystem, naming the resulting volume Loma Prieta. % hformat -f /dev/sd2 0 This causes the medium accessible as /dev/sd2 to be reformatted as a single HFS volume, ignoring and erasing any existing partition information on the medium. The -f option must be specified if the medium is currently partitioned; otherwise the command will fail. NOTES
This command does not create or alter partition maps, although it can erase them (as described above). Any partition number specified on the command line must already exist. The smallest volume size which can be formatted with hformat is 800K. SEE ALSO
hfsutils(1), hmount(1) FILES
$HOME/.hcwd AUTHOR
Robert Leslie <rob@mars.org> HFSUTILS
08-Nov-1997 HFORMAT(1)
All times are GMT -4. The time now is 05:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy