Schlagwort: Arch

  • How to add a swap drive to your system, in this case I did this for a virtual machine (qemu) running Arch Linux.

    See at the bottom for information about the virtual drive for qemu.

    List current available to system disks:

    sudo blkid

    List all disks:

    sudo lsblk

    Format as swap:

    sudo mkswap /dev/vdb

    gives back the UUID

    Now the new swap disk will be shown when executing this again:

    sudo blkid

    (also give the UUID)

    Take the UUID from above and add an entry in /etc/fstab like this:

    echo "UUID=56445300-90f5-40b4-860b-99037d0e8aad none swap sw 0 0" |sudo tee -a /etc/fstab

    Actiate available swap disks, ie. from fstab or on GPT volume.

    sudo swapon -a

    Check the swap is available now:

    sudo swapon --show

    The qemu image I created as „raw“, VirtIO and set the cache mode to „writeback“, this should be fine for swap while being fast too. See explanation here and here.

    I also looked at this information about how to add a swap disk.

    As always, give me your feedback, I will add information that can help in the future.

    Keine Kommentare zu How to add a swap drive to your system
  • … is an easy to use and powerful tool, it can be used to replace part of file name (string1) with some other string. Something one can also do with some „sed“ hack, but this tool is much easier to use, especially for beginners.

    You can get all information needed from „rename –help“ (here from Linux Mint):

    rename --help
    Usage:
        rename [ -h|-m|-V ] [ -v ] [ -n ] [ -f ] [ -e|-E perlexpr]*|perlexpr
        [ files ]
    
    Options:
        -v, -verbose
                Verbose: print names of files successfully renamed.
    
        -n, -nono
                No action: print names of files to be renamed, but don't rename.
    
        -f, -force
                Over write: allow existing files to be over-written.
    
        -h, -help
                Help: print SYNOPSIS and OPTIONS.
    
        -m, -man
                Manual: print manual page.
    
        -V, -version
                Version: show version number.
    
        -e      Expression: code to act on files name.
    
                May be repeated to build up code (like "perl -e"). If no -e, the
                first argument is used as code.
    
        -E      Statement: code to act on files name, as -e but terminated by
                ';'.

    I did use this tool rename some files that contained the string „www“, which I had to replace with „web“, lets say there were files named like this:

    www.example.com-97126.ccd
    www.example.com-54852.ccd
    www.example.com-87430.ccd
    www.example.com-75413.ccd

    For Ubuntu, maybe also Debian, based systems I use the following command to rename all above files:

    rename -e 's/www/web/' *.ccd

    After this the files are now called
    web.example.com-….
    ….

    The only problem is, the syntax varies from one Linux distribution to another, so check the syntax before you use rename.

    For Arch Linux I found that something like this would work:

    rename www web *.ccd

    The expression „*.ccd“ defines which files to act on, so this will act on all files that match „*.ccd*, in the example above you could also use „www.example.com-*.ccd“ or something similar.

    Main thing I wanted to get out there is, there is an easy tool to batch rename files instead of some complex if-for bash code. Which I tried to use before but failed at.

    Keine Kommentare zu rename