LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 08-15-2012, 05:13 AM   #1
kikinovak
Senior Member
 
Registered: Jun 2011
Location: Montpezat (South France)
Distribution: Slackware, Slackware64
Posts: 1,871

Rep: Reputation: 937Reputation: 937Reputation: 937Reputation: 937Reputation: 937Reputation: 937Reputation: 937Reputation: 937
Zero single partitions (not whole drives)?


Hi,

One of my PCs is a dedicated Slackware build box. Currently I have two systems installed on it: Slackware 13.37 and Slackware64 13.37. The main purpose of this machine is to build packages (mine or from SBo), so I can easily install them on many machines from here.

The current partitioning scheme looks like this:

Code:
[root@betadine:~] # fdisk -l /dev/sda

Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 têtes, 63 secteurs/piste, 9729 cylindres, total 156301488 secteurs
Unités = secteurs de 1 * 512 = 512 octets
Taille de secteur (logique / physique)*: 512*octets / 512*octets
taille d'E/S (minimale / optimale)*: 512*octets / 512*octets
Identifiant de disque*: 0x0005ac98

Périphérique Amorce  Début        Fin      Blocs     Id  Système
/dev/sda1              63     4000184     2000061   82  Linux swap
/dev/sda2   *     4000185     4192964       96390   83  Linux
/dev/sda3         4192965    42090299    18948667+  83  Linux
/dev/sda4        42090300   156301487    57105594    5  Étendue
/dev/sda5   *    42090363    42283079       96358+  83  Linux
/dev/sda6        42283143    80180414    18948636   83  Linux
/dev/sda7   *    80180478    80373194       96358+  83  Linux
/dev/sda8        80373258   118270529    18948636   83  Linux
/dev/sda9   *   118270593   118463309       96358+  83  Linux
/dev/sda10      118463373   156301487    18919057+  83  Linux
- sda1 is the swap partition shared by all the installed systems
- Slackware 13.37 is installed on sda2 and sda3
- Slackware64 13.37 is installed on sda5 and sda6.

Currently, partitions sda7 to sda10 are unused. They're supposed to get two fresh installs of Slackware 14.0 and Slackware64 14.0 as soon as the stable release is out.

In the meantime, whenever I have to do some experimenting that's liable to create havoc, I always backup the machine using G4L (Ghost For Linux). This simple software sends the raw contents of the hard disk to a local FTP server, byte by byte.

Usually I try to reduce the size of the compressed disk images by writing zeros to every unused area of the disk before backing it up, somehow like this. Within the installed system:

Code:
# dd if=/dev/zero of=/0bits bs=20M ; rm -f /0bits
Now I wonder if I can simply write zeros to single partitions from, say, a live system. Say I'd like to fill only sda7 with zeros, can I issue the following command?

Code:
# dd if=/dev/zero of=/dev/sda7
Of course, this shouldn't affect all the other partitions (sda1-6, sda8-10).

I'm not exactly sure, so I'd better ask first, since an error of judgement could destroy a few days' work.

Last edited by kikinovak; 08-15-2012 at 05:14 AM.
 
Old 08-15-2012, 05:21 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,446

Rep: Reputation: 1068Reputation: 1068Reputation: 1068Reputation: 1068Reputation: 1068Reputation: 1068Reputation: 1068Reputation: 1068
Yes. A better solution is to simply mkfs.
 
Old 08-15-2012, 06:27 AM   #3
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Main: Gentoo Others: What fits the task
Posts: 15,623
Blog Entries: 2

Rep: Reputation: 4077Reputation: 4077Reputation: 4077Reputation: 4077Reputation: 4077Reputation: 4077Reputation: 4077Reputation: 4077Reputation: 4077Reputation: 4077Reputation: 4077
Quote:
Originally Posted by syg00 View Post
Yes. A better solution is to simply mkfs.
Actually it is not a better solution to use mkfs. mkfs will not zero out the partition, so you will not get a better compression rate.

@kikinovak: Your approach with dd will work fine. I would recommend to play a bit with the blocksizes (default is 512 bytes) to get better performance, I get the best performance in the range between 8 and 32MB (seems to be dependent on the hardware).
 
1 members found this post helpful.
Old 08-15-2012, 06:31 AM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,446

Rep: Reputation: 1068Reputation: 1068Reputation: 1068Reputation: 1068Reputation: 1068Reputation: 1068Reputation: 1068Reputation: 1068
I stand corrected - I glossed over the compression requirement.
 
Old 08-15-2012, 08:42 AM   #5
kikinovak
Senior Member
 
Registered: Jun 2011
Location: Montpezat (South France)
Distribution: Slackware, Slackware64
Posts: 1,871

Original Poster
Rep: Reputation: 937Reputation: 937Reputation: 937Reputation: 937Reputation: 937Reputation: 937Reputation: 937Reputation: 937
Quote:
Originally Posted by TobiSGD View Post
@kikinovak: Your approach with dd will work fine. I would recommend to play a bit with the blocksizes (default is 512 bytes) to get better performance, I get the best performance in the range between 8 and 32MB (seems to be dependent on the hardware).
OK, thanks. That worked. When I invoke dd from within the system, I usually choose bs=20M for best performance.
 
  


Reply

Tags
dd, zero partition


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
[SOLVED] Buffalo 1 TB usb drive: single or mult partitions? dave_joseph Slackware 6 12-26-2010 02:46 AM
partitions in a two harddrive, single OS laptop Cultist Linux - General 3 06-09-2010 01:07 AM
mounting partitions in single user mode Steve Riley Red Hat 1 01-27-2008 08:02 AM
Mounting multipul partitions into a single folder. xconspirisist Linux - Hardware 6 02-23-2007 11:11 PM
how do I add partitions to drives that have Logical Volume (LVM) partitions? The MJ Linux - Software 5 08-17-2006 07:15 PM


All times are GMT -5. The time now is 07:48 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration