LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Remove ext3 filesystem but not it's partition ? (https://www.linuxquestions.org/questions/slackware-14/remove-ext3-filesystem-but-not-its-partition-715540/)

Vilius 03-30-2009 01:11 PM

Remove ext3 filesystem but not it's partition ?
 
Hi,

How do I remove ext3 filesystem structure from it's partition ?
I don't want to delete partition and I don't want to create new filesystem structure.
I want to get similar result like before making mke2fs call.

thanks
Vilius

lupinix 03-30-2009 01:39 PM

Example for /dev/sda1 (change the device for your needs)(the structure of the filesystem will be overwritten by many zeros)

Quote:

cat /dev/zero > /dev/sda1
No Warranty!

Vilius 03-31-2009 03:47 PM

But isn't it fill all partition with zeros - I mean if partition is big enaugh it could take a lot of time.
Maybe there is another method to remove/erase only ext3 structure ? - and not the data itself ?

thanks
Vilius

Ilgar 03-31-2009 03:57 PM

Vilius I can't see what you're trying to do. If you delete the inodes then you can't know where to find the data, so what's the point of keeping them? Could you explain the purpose of doing this?

Vilius 03-31-2009 04:30 PM

I'm just looking the simplest way to remove filesystem from it's partition - I want some programs like os setups to indicate partition as empty(not formatted).
Recreating partition leaves filesystem unchanged if I recreate partition on the same cylinder boundary (am I right ?)

V

mlangdn 03-31-2009 04:38 PM

Delete the partition. Any Linux OS will recognize the deleted partition as unused, empty space. Just don't recreate the partition until you need it again.

Ilgar 03-31-2009 04:59 PM

Quote:

Originally Posted by Vilius (Post 3494154)
I'm just looking the simplest way to remove filesystem from it's partition - I want some programs like os setups to indicate partition as empty(not formatted).
Recreating partition leaves filesystem unchanged if I recreate partition on the same cylinder boundary (am I right ?)

V

Yes if you recreate it you should find the filesystem there, but you can simply format it during installation. That is, you don't need to make it look like empty. Besides, installers detect the partitions but they usually don't know or care what filesystem lies inside (unless you explicitly ask them not to overwrite but to mount those partitions somewhere in your filesystem).

One indicator which gives the computer an idea about what kind of filesystem sits inside is the hex code (type) of the partition. In fdisk, you can see a list with the l option:

Code:


 0  Empty          1e  Hidden W95 FAT1 80  Old Minix      bf  Solaris       
 1  FAT12          24  NEC DOS        81  Minix / old Lin c1  DRDOS/sec (FAT-
 2  XENIX root      39  Plan 9          82  Linux swap      c4  DRDOS/sec (FAT-
 3  XENIX usr      3c  PartitionMagic  83  Linux          c6  DRDOS/sec (FAT-
 4  FAT16 <32M      40  Venix 80286    84  OS/2 hidden C:  c7  Syrinx       
 5  Extended        41  PPC PReP Boot  85  Linux extended  da  Non-FS data   
 6  FAT16          42  SFS            86  NTFS volume set db  CP/M / CTOS / .
 7  HPFS/NTFS      4d  QNX4.x          87  NTFS volume set de  Dell Utility 
 8  AIX            4e  QNX4.x 2nd part 88  Linux plaintext df  BootIt       
 9  AIX bootable    4f  QNX4.x 3rd part 8e  Linux LVM      e1  DOS access   
 a  OS/2 Boot Manag 50  OnTrack DM      93  Amoeba          e3  DOS R/O       
 b  W95 FAT32      51  OnTrack DM6 Aux 94  Amoeba BBT      e4  SpeedStor     
 c  W95 FAT32 (LBA) 52  CP/M            9f  BSD/OS          eb  BeOS fs       
 e  W95 FAT16 (LBA) 53  OnTrack DM6 Aux a0  IBM Thinkpad hi ee  GPT           
 f  W95 Ext'd (LBA) 54  OnTrackDM6      a5  FreeBSD        ef  EFI (FAT-12/16/
10  OPUS            55  EZ-Drive        a6  OpenBSD        f0  Linux/PA-RISC b
11  Hidden FAT12    56  Golden Bow      a7  NeXTSTEP        f1  SpeedStor     
12  Compaq diagnost 5c  Priam Edisk    a8  Darwin UFS      f4  SpeedStor     
14  Hidden FAT16 <3 61  SpeedStor      a9  NetBSD          f2  DOS secondary 
16  Hidden FAT16    63  GNU HURD or Sys ab  Darwin boot    fb  VMware VMFS   
17  Hidden HPFS/NTF 64  Novell Netware  b7  BSDI fs        fc  VMware VMKCORE
18  AST SmartSleep  65  Novell Netware  b8  BSDI swap      fd  Linux raid auto
1b  Hidden W95 FAT3 70  DiskSecure Mult bb  Boot Wizard hid fe  LANstep       
1c  Hidden W95 FAT3 75  PC/IX          be  Solaris boot    ff  BBT

So you can mark the partition type 0 to make the installers think it's empty. This code doesn't have anything to do with formatting and may not even match the real content of the partition; but gives the installers a hint of what they are. For example Slackware installers will detect partitions of type 82 (swap) and automatically suggest activating them as swap space.

GazL 03-31-2009 05:43 PM

If you don't want to spend the time to blank the whole partition, then it's still a good idea to blank out at least the first few sectors of the partition when you're done with it. That way you don't leave old lvm or filesystem meta-data/headers around which could potentially cause you problems in the future.

Something along the lines of the following should do the trick:
Code:

dd if=/dev/zero bs=512 count=512 of=/dev/your_partition
(clears the first 256K - I pulled the number out of the air, but it ought to be big enough to do the job)

It's not strictly necessary, but it's a good habit to get into.

bjmgeek 11-18-2015 11:15 AM

wipefs is another possibility.
 
The wipefs utilitity will automatically remove any relevant FS metadata, without overwriting the whole disk. Therefore, when you try to make a new fs, with mke2fs or what have you, it will not see the disk as already containing a file system. On debian, it's part of the util-linux package.


All times are GMT -5. The time now is 03:14 AM.