Menu

#56 Ability to zero a linux swap partition

open
nobody
None
1
2015-04-04
2015-04-04
Andrei B.
No

I would like to request the ability to zero a linux swap partition (although keeping it's swap partition signiture so the actual system using it will not be affected) in order to minimize images created off an entire disk containing such a partition.

Thank you.

Related

Feature Requests: #56

Discussion

  • Michael Setzer II

    On 4 Apr 2015 at 9:08, Andrei B. wrote:

    To: "Ticket 56" 56@feature-requests.g4l.p.re.sf.net
    From: "Andrei B." andrixnet@users.sf.net
    Send reply to: "Ticket 56" 56@feature-requests.g4l.p.re.sf.net
    Subject: [g4l:feature-requests] #56 Ability to zero a linux swap partition
    Date sent: Sat, 04 Apr 2015 09:08:13 +0000

    [feature-requests:#56] Ability to zero a linux swap partition
    Status: open
    Group: Next_Release_(example)
    Created: Sat Apr 04, 2015 09:08 AM UTC by Andrei B.
    Last Updated: Sat Apr 04, 2015 09:08 AM UTC
    Owner: nobody
    I would like to request the ability to zero a linux swap partition (although keeping it's swap
    partition signiture so the actual system using it will not be affected) in order to minimize images
    created off an entire disk containing such a partition.
    Thank you.

    The zero function was designed to clear partitions that linux can mount and
    then write zeros to directly. The swap partition isn't of that type. I just did a
    test with this little scripted called clearswap and it does seem to do the job in
    my test, but will have to see how to implement it.

    The first line gets the partition that is listed as type swap. (assumes on 1?)
    The second line gets the current UUID of the partition to be used in
    recreating (mkswap)
    The third line just prints the info will testing to make sure it was correct.
    The forth line clears the physical partition
    The fifth line then recreates the partition as a swap using the UUID

    PART=blkid | grep swap | cut -f 1 -d:
    UUID=blkid | grep swap | cut -f 2 -d\"
    echo $PART $UUID
    dd if=/dev/zero bs=20M of=$PART
    mkswap $PART -U $UUID

    So, it doesn't seem to be a big thing, but not sure what would happen with
    swap partitions that are setup using label or perhaps.

    Sent from sourceforge.net because you indicated interest in
    https://sourceforge.net/p/g4l/feature-requests/56/
    To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

    +----------------------------------------------------------+
    Michael D. Setzer II - Computer Science Instructor
    Guam Community College Computer Center
    mailto:mikes@kuentos.guam.net
    mailto:msetzerii@gmail.com
    http://www.guam.net/home/mikes
    Guam - Where America's Day Begins
    G4L Disk Imaging Project maintainer
    http://sourceforge.net/projects/g4l/
    +----------------------------------------------------------+

    http://setiathome.berkeley.edu (Original)
    Number of Seti Units Returned: 19,471
    Processing time: 32 years, 290 days, 12 hours, 58 minutes
    (Total Hours: 287,489)

    BOINC@HOME CREDITS
    ROSETTA 27644660.569066 | SETI 48525986.389359
    ABC 16613838.513356 | EINSTEIN 56388547.145700

     

    Related

    Feature Requests: #56

  • Andrei B.

    Andrei B. - 2015-04-04

    I've just played a bit with that script as well.
    Looks good. But needs to be adjusted for the case of multiple swap partitions.
    I'll try and have a look at mkswap source as well. I admit I am unfamiliar with the on-disk format of the linux swap file.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.