The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Can I format 2nd hard drive and erase all data?

Discussion in 'General Discussion' started by claven177, Jun 4, 2006.

  1. claven177

    claven177 Well-Known Member

    Joined:
    Sep 3, 2003
    Messages:
    61
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Taipei
    Can I format 2nd hard drive and erase all data?
    How to do it?

    My box with 2 x 80G hard drive.
    The 2nd HD, Disk /dev/hdb, I want to be a backup drive.
    but with "lost+found" diretory, nearly 30 Giga bytes size.
    Althought I use rm -rf lost+found to del the lost+found diretory,
    got a "cannot remove" error message.

    What's best method to erase all files on 2nd hard drive?

    Thanks.


    Code:
    [/backup]# rm -rf lost+found
    rm: cannot remove `lost+found/#327681/local/frontpage/version5.0/apache-fp/_vti_bin/fpexe': Operation not permitted
    rm: cannot remove `lost+found/#327681/local/cpanel/cgi-sys/FormMail.cgi': Operation not permitted
    rm: cannot remove `lost+found/#327681/local/cpanel/cgi-sys/formmail.cgi': Operation not permitted
    rm: cannot remove `lost+found/#327681/local/cpanel/cgi-sys/FormMail.pl': Operation not permitted
    rm: cannot remove `lost+found/#327681/local/cpanel/cgi-sys/formmail.pl': Operation not permitted
    rm: cannot lstat `lost+found/#1802243/p007kk/mail/.gnupg/public_html/shopos/includes/languages/english/modules/payment': Input/output error

    Code:
     [/backup]# ls -l
    total 96
    drwx--x--x    4 root root  4096 Jun  2 00:20 ./
    drwxr-xr-x   28 root root  4096 Jun  4 19:14 ../
    drwx--x--x    3 root root  4096 Jun  2 04:00 cpbackup/
    drwx------  256 root root 77824 Jun  1 13:33 lost+found/


    Code:
     [/backup/lost+found]# ls -l
    drwxr-xr-x    6 root     root         4096 Dec 18  2004 #8553605/
    drwxr-xr-x    3 root     root         4096 Aug  2  2003 #8568893/
    drwxr-xr-x    4 root     root         4096 Dec 30  2003 #8634407/
    drwxr-xr-x    3 root     root         4096 Dec  1  2004 #868366/
    drwx------    2 root     root         4096 May 22 02:15 #868747/
    drwxr-xr-x    2 root     root         4096 Nov 14  2003 #8765456/
    drwx------    3 root     root         4096 May 19 06:14 #8765492/
    drwxr-xr-x    2 root     root         4096 Mar 25 01:45 #8798792/
    drwxr-xr-x    2 root     root         4096 Feb  4  2003 #8814607/
    drwxr-xr-x    7 root     root         4096 Jul 24  2005 #8847367/
    drwxr-xr-x    3 root     root         4096 Nov 14  2003 #884751/
    drwxr-xr-x    3 root     root         4096 Oct 31  2002 #8863898/
    drwxr-xr-x    3 root     root         4096 May 22 06:14 #8865117/
    drwxr-xr-x    4    32140      644     4096 Feb 14 09:52 #8897330/
    drwxr-xr-x    2 root     root         4096 Nov 14  2003 #8912902/
    drwxr-xr-x    3 root     root         4096 Nov 14  2003 #8978440/
    drwxr-xr-x    2 root     root         4096 Dec 23  2004 #901152/
    drwxr-xr-x    2 root     root         4096 Nov 14  2003 #9125905/
    drwxr-xr-x    2 root     root         4096 Nov 14  2003 #9125912/
    drwxr-xr-x    2 root     root         4096 Nov 14  2003 #9158671/
    drwx------    2 root     root         4096 Jun 23  2004 #9160299/
    drwx------    2 exxzwant   exxverstar     4096 Nov 21  2003 #9290507/
    drwx------    2 exxzwant   exxverstar     4096 Nov 21  2003 #9290510/
    drwxr-x---    3 exxzwant   mail         4096 May  9  2004 #9290513/
    drwxr-xr-x    2 root     root         4096 Feb 24  2005 #9306118/
    drwxr-xr-x    2 root     root         4096 Jan  9  2003 #9322504/
    drwxr-xr-x    3 root     root         4096 Nov 14  2003 #9322534/
    drwxr-xr-x    2 root     root         4096 Nov 14  2003 #9322536/
    drwxr-xr-x    2 root     root         4096 Nov 14  2003 #9355267/
    drwx------    3 root     root         4096 Dec  6  2004 #9373851/
    drwxr-xr-x    2 root     root         4096 Nov 14  2003 #9388035/
    drwxr-xr-x    2 root     root         4096 Nov 14  2003 #9388054/
    drwxr-xr-x    2 root     root         4096 Nov 14  2003 #9404419/
    drwx------    2 root     root         4096 Jan 29  2003 #9453587/
    drwxrwx---    2 operator mail         4096 Nov 14  2003 #98316/
    drwxr-xr-x    6 root     root         4096 Nov 14  2003 #999439/
    drwxr-xr-x    2 root     root         4096 Nov 14  2003 #999441/
    ?---------    ? ?        ?               ?            ? C\t\203\335

    # /sbin/fdisk -l

    Disk /dev/hda: 80.0 GB, 80026361856 bytes
    255 heads, 63 sectors/track, 9729 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes

    Device Boot Start End Blocks Id System
    /dev/hda1 * 1 13 104391 83 Linux
    /dev/hda2 14 268 2048287+ 82 Linux swap
    /dev/hda3 269 399 1052257+ 83 Linux
    /dev/hda4 400 9729 74943225 5 Extended
    /dev/hda5 400 9729 74943193+ 83 Linux

    Disk /dev/hdb: 80.0 GB, 80026361856 bytes
    255 heads, 63 sectors/track, 9729 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes

    Device Boot Start End Blocks Id System
    /dev/hdb1 * 1 13 104391 83 Linux
    /dev/hdb2 14 270 2064352+ 82 Linux swap
    /dev/hdb3 271 9729 75979417+ 83 Linux​


     
  2. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    Presuming that it's /dev/hdb that you want to wipe and recreate:

    umount /backup
    fdisk /dev/hdb
    d
    1
    d
    2
    d
    3
    n
    1
    p
    [enter] and repeat until back at the prompt
    w

    mke2fs -j -L /backup /dev/hdb1

    you then need to make sure the following line exists in /etc/fstab and add/or modify it if needed:

    /dev/hdb1 /backup ext3 defaults 1 2

    Then remount it:

    mount -a
     
  3. claven177

    claven177 Well-Known Member

    Joined:
    Sep 3, 2003
    Messages:
    61
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Taipei
    Great!!!

    Is it normal when I got the message ?
    WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
    The kernel still uses the old table.
    The new table will be used at the next reboot.
    Syncing disks



    Code:
    # fdisk /dev/hdb
    
    The number of cylinders for this disk is set to 9729.
    There is nothing wrong with that, but this is larger than 1024,
    and could in certain setups cause problems with:
    1) software that runs at boot time (e.g., old versions of LILO)
    2) booting and partitioning software from other OSs
       (e.g., DOS FDISK, OS/2 FDISK)
    
    Command (m for help):
    
    
    
    
    Command (m for help): m
    Command action
       a   toggle a bootable flag
       b   edit bsd disklabel
       c   toggle the dos compatibility flag
       d   delete a partition
       l   list known partition types
       m   print this menu
       n   add a new partition
       o   create a new empty DOS partition table
       p   print the partition table
       q   quit without saving changes
       s   create a new empty Sun disklabel
       t   change a partition's system id
       u   change display/entry units
       v   verify the partition table
       w   write table to disk and exit
       x   extra functionality (experts only)
    
    
    
    
    Command (m for help): p
    
    Disk /dev/hdb: 80.0 GB, 80026361856 bytes
    255 heads, 63 sectors/track, 9729 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/hdb1               1         850     6827593+  83  Linux
    /dev/hdb2             851        9729    71320567+  83  Linux
    
    Command (m for help): w
    The partition table has been altered!
    
    Calling ioctl() to re-read partition table.
    
    [COLOR="Red"]WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
    The kernel still uses the old table.
    The new table will be used at the next reboot.
    Syncing disks.[/COLOR]
     
  4. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    That error would suggest that there are other mounted partitions on the disk. What do you get from just typing:

    mount
     
Loading...

Share This Page