0

Read a lot of pages in the arch linux wiki, and finally I'll install the OS, the problem is that they have a large collection of commands that I don't understand (the prefixes are illegible) so I made a text file like a cook recipe for the installation.

loadkeys la-latin1
iw dev
wifi-menu -o [iw dev output device name]
cfdisk
lsblk
mkfs -t ext4 dev/sdaX
/* here comes the swap part */
mount dev/sdaX /mnt
swapon xxx
pacstrap /mnt base base-devel grub-bios networkmanager os-prober
genfstab -U -p /mnt >> /mnt/etc/fstab
...
..
.

The thing is that I want to use swap files instead of swap partition, because I hate that messy swap table with windows.
I read a post of swap in the arch linux but I think needs a re check because I couldn't understand it at all, what is chmod 600?. Are the steps in right order?,
And I don't trust the "automated method".
How do I make a swap file just with the / folder, what lines should I add to the txt

  • If you're asking about swap files, what do the commands you presented here have to do with it? Except for swapon, none of them look like they're related. – ilkkachu Dec 9 '17 at 21:50
  • @ilkkachu in the line /* here comes the swap part */ I don't know the order of the wiki commands. it's like adding that part to the txt – Egon Stetmann. Dec 10 '17 at 1:20
1

There are several steps to setting up a file to use as swap space.

1 - make the file. Several ways, I use dd to read from /dev/zero and output to a file - dd if=/dev/zero of=/path/to/swapfile bs=1024 count=100000 will create a 1gb file. Once the file is created, set the mode to 600 - chmod 600 /path/to/swapfile and make sure that the root user is the owning user.

This dd command - if is the input file, /dev/zero in this case. of is the output file, where is the data being written to? In this case, it is the full path to our swap file. bs is block size, we want to grab 1024 bytes at a time, and count tells us how many to get (enough to make 1gb in this case)

2 - make the file a swap file system mkswap /path/to/swapfile

Once that is done, you can manually start it up when needed with swapon /path/to/swapfile or if you want it to always be active, put a reference in your /etc/fstab to load it

/path/to/swapfile    none     swap     sw     0    0

Just be sure you add the line AFTER the line to load whatever filesystem the swap file actually lives on

  • for what is the count parameter? dev/zero is the target of the partition wich I want to put the swap file isnt it? – Egon Stetmann. Dec 10 '17 at 6:56
  • @RenatoA. - editing answer to clarify – ivanivan Dec 10 '17 at 14:10
  • could be bs=1M count=1024? – Egon Stetmann. Dec 10 '17 at 17:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.