View previous topic :: View next topic |
Author |
Message |
Gooserider Apprentice
Joined: 30 Dec 2005 Posts: 165 Location: Universe, Milky Way Galaxy, Solar System, Earth, North America, USA, MA, North Billerica
|
Posted: Sun Mar 30, 2008 8:16 am Post subject: Using thumb drive for swap problem (3/08 GMN Tips) (SOLVED!) |
|
|
Tried to find an existing thread on this, no luck - also feel free to move to a better area if there is one...
I am having a couple of problems trying to implement the suggestion to use a USB thumb drive for a swap drive as suggested in the March Gentoo Monthly Newsleter's "Tips & Tricks" section.
Per the tip, I created a type 82 swap partition using the entire space on a 2gb thumb drive, and added a line to /etc/fstab, but I can't get the swap to work.
I can't get the swap to turn on with "swapon -a" - I get the error message
Code: | # swapon -a
swapon: /dev/sda1: Invalid argument |
I am not using /dev/sda1 in my fstab file, instead I'm using the long name I got from
Code: | ls -l /dev/disk/by-id/usb-*-part1
lrwxrwxrwx 1 root root 10 Mar 30 02:22 /dev/disk/by-id/usb-USB_2.0_USB_Flash_Drive_bc71a222e9b2c2-0:0-part1 -> ../../sda1 |
The relevant part of my /etc/fstab is:
Code: | # commented out to avoid conflicts w/ swap drive (didn't help)?
# /dev/sda1 /mnt/flash auto noauto,users,rw 0 0
# swapdrive created out of 2gb USB thumb drive to give faster swap speed -
# commented line per March 08 Gentoo Monthly Newsletter, /dev/loop did not work,
# so removed encryption.
# /dev/disk/by-id/usb-USB_2.0_USB_Flash_Drive_bc71a222e9b2c2-0:0-part1 none swap sw,loop=/dev/loop7,encryption=AES128 0 0
/dev/disk/by-id/usb-USB_2.0_USB_Flash_Drive_bc71a222e9b2c2-0:0-part1 none swap sw 0 0 |
This mentions in passing the other problem I'm having, the loop device didn't work for encrypting the drive - I don't appear to have any /dev/loop devices, so I was initially getting errors about that. I'm fairly sure that might just be a problem where I haven't created the loops, but I was planning to not worry about that for now - the system is not publically accessible, and I don't use encryption on any of the rest of it, so I didn't see failing to encrypt the thumb drive as a significant added risk.
As you can see, I did have a mount for /dev/sda1 in fstab for a flash RAM from my camera that I occasionally connect to get pictures off, I commented this out on the off chance that it was part of my problem, but it didn't change anything. ls -l for /dev/sd* gives me
Code: | # ls -l /dev/sd*
brw-rw---- 1 root disk 8, 0 Mar 30 02:22 /dev/sda
brw-rw---- 1 root disk 8, 1 Mar 30 03:00 /dev/sda1
brw-rw---- 1 root disk 8, 16 Mar 30 02:22 /dev/sdb
|
I'm guessing that this thumb drive is somehow getting linked to /dev/sda1, and that this is what is getting the swap utility upset - is there some way to break that link? Also what do I need to do in order to make the camera card still work properly when I do stick it in the machine?
Thanks,
Gooserider _________________ Box 1: P2 Celeron 400, 320mb RAM, 80GB HD, Cirrus Logic 4614/22/24 sound card, ATI 3D RAGE PRO AGP 1X/2X (sound & video onboard)
Box 2: AMD Athlon 2500+ 512mb RAM, 80GB HD, Gigabyte K7 Triton (Nvidia) mobo, GeForce2 video |
|
Back to top |
|
|
Gooserider Apprentice
Joined: 30 Dec 2005 Posts: 165 Location: Universe, Milky Way Galaxy, Solar System, Earth, North America, USA, MA, North Billerica
|
Posted: Tue Apr 01, 2008 8:10 pm Post subject: |
|
|
Figured out what I missed, and that fixed it - the GMN article mentioned using FDISK to create a partition, but failed to say anything about formatting it - turns out that was the problem, once I did a mkswap on it, I was able to turn it on no problem....
Get the drive ID again:
Code: | # ls -l /dev/disk/by-id/usb-*-part1
lrwxrwxrwx 1 root root 10 Mar 30 02:22 /dev/disk/by-id/usb-USB_2.0_USB_Flash_Drive_bc71a222e9b2c2-0:0-part1 -> ../../sda1
|
Format the swap drive:
Code: | # mkswap /dev/disk/by-id/usb-USB_2.0_USB_Flash_Drive_bc71a222e9b2c2-0:0-part1
Setting up swapspace version 1, size = 2021617 kB
no label, UUID=847be986-a36a-4c0f-a4bb-1e09eb65e232
|
Turn on the swap drives, and check status:
Code: | # swapon -a
# swapon -s
Filename Type Size Used Priority
/dev/hda2 partition 979956 264036 -1
/dev/sda1 partition 1974232 0 -2
|
Notice that the existing hard-drive based swap is still there, and will be used first so: Turn OFF the old hard drive based swap, and recheck:
Code: | # swapoff /dev/hda2
# swapon -s
Filename Type Size Used Priority
/dev/sda1 partition 1974232 0 -2
Everything now looks pretty good, other than not having encryption, but as I mentioned in my first post, I'm not convinced that this is a big issue since I'm the only one using the machine and it is pretty limited access - I figure that if I have a gov't agent or other criminal break into my house, having an unencrypted thumb drive is the least of my problems...
Gooserider
|
_________________ Box 1: P2 Celeron 400, 320mb RAM, 80GB HD, Cirrus Logic 4614/22/24 sound card, ATI 3D RAGE PRO AGP 1X/2X (sound & video onboard)
Box 2: AMD Athlon 2500+ 512mb RAM, 80GB HD, Gigabyte K7 Triton (Nvidia) mobo, GeForce2 video |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|